问:
Java Asterisk Rectangle
For my CS class, my instructor has given us the assignment of creating a rectangle made of asterisks with diagonal lines drawn through it in Java.

He also told us to write it in as few bytes as possible. I've gotten it down to 190 bytes, but I need to find a few to simplify this code even more to decrease bytes. Can anyone help me with this?

This code is functional:

interface d{static void main(String[]a){for(int z=0,w=new Byte(a[0]),h=new Byte(a[1]);z<h*w;){int y=z/w,x=z++%w;System.out.print((x>w-2)?"*\n":(y%(h-1)*x*((y-x)%3)==0)?"*":" ");}}}
```
<p>Input is <code>10 10</code>.</p>
<p>Output:</p>
```**********
**  *  * *
* *  *  **
*  *  *  *
**  *  * *
* *  *  **
*  *  *  *
**  *  * *
* *  *  **
```

答:
I don't actually have Java on my computer so I can't test this but I think it should work for 174 bytes and almost definitely could be golfed more

```<code>class d{static void main(String[]a){for(int i=0,w=new Byte(a[0]),h=new Byte(a[1]);i<h;i++)for(int j=0;j<w;j++)System.out.print(j==w-1?"*\n":i%h-1==0||!j||i+j%2==0?"*":" ");}}
</code>```

Whitespace added for clarity:

```<code>class d {
    static void string main(String[] a) {
        for(int i=0,w=new Byte(a[0]),h=new Byte(a[1]);i<h;i++)
            for(int j=0;j<w;j++)
                System.out.print(j==w-1 ? "*\n" : i % h-1 == 0 || !j || i+j % 2 == 0 ? "*":" ");
    }
}
</code>```

print *\n for the last char in each line, * for all of the first and last lines and the first column, and * for any time that the sum of the row and column is even, otherwise prints

Title: Java Asterisk Rectangle

Body:
I don't actually have Java on my computer so I can't test this but I think it should work for 174 bytes and almost definitely could be golfed more

class d{static void main(String[]a){for(int i=0,w=new Byte(a[0]),h=new Byte(a[1]);i<h;i++)for(int j=0;j<w;j++)System.out.print(j==w-1?"*\n":i%h-1==0||!j||i+j%2==0?"*":" ");}}

Whitespace added for clarity:

class d {
    static void string main(String[] a) {
        for(int i=0,w=new Byte(a[0]),h=new Byte(a[1]);i<h;i++)
            for(int j=0;j<w;j++)
                System.out.print(j==w-1 ? "*\n" : i % h-1 == 0 || !j || i+j % 2 == 0 ? "*":" ");
    }
}

print *\n for the last char in each line, * for all of the first and last lines and the first column, and * for any time that the sum of the row and column is even, otherwise prints


问:
Alphabet triangle strikes again

Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

答:
R, <s>120</s> <s>115</s> 111 bytes

```<code>v=c();for(i in 1:26){v=c(v,c(rep(LETTERS,26)[(sum((b=seq(1,51,2))[1:i-1])+1):sum(b[1:i])],"\n"))};cat(v,sep="")
</code>```

Ungolfed :

```<code>a=rep(LETTERS,26)
b=seq(1,51,2)
v=vector()

for(i in 1:26)
    {
    v=c(v,c(a[(sum(b[1:i-1])+1):sum(b[1:i])],"\n"))
    }

cat(v,sep="")
</code>```

Basically, b is the vector of the odd numbers between 1 and 51, thus giving the length of each line. Obviously, the sum function sums the numbers of this vector, and gives the starting and ending indexes.

-5 bytes thanks to @plannapus !

-4 bytes thanks to @plannapus !

ContentLicense: CC BY-SA 3.0

Title: Alphabet triangle strikes again

Body:
R, <s>120</s> <s>115</s> 111 bytes

v=c();for(i in 1:26){v=c(v,c(rep(LETTERS,26)[(sum((b=seq(1,51,2))[1:i-1])+1):sum(b[1:i])],"\n"))};cat(v,sep="")

Ungolfed :

a=rep(LETTERS,26)
b=seq(1,51,2)
v=vector()

for(i in 1:26)
    {
    v=c(v,c(a[(sum(b[1:i-1])+1):sum(b[1:i])],"\n"))
    }

cat(v,sep="")

Basically, b is the vector of the odd numbers between 1 and 51, thus giving the length of each line. Obviously, the sum function sums the numbers of this vector, and gives the starting and ending indexes.

-5 bytes thanks to @plannapus !

-4 bytes thanks to @plannapus !


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

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

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

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

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

Validity Checker

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

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

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

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

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

答:
Mathematica, 16 bytes

```<code>First@WordList[]
</code>```

WordList[] gives a list of common English words. First takes the first element of this list, which is "a".

Title: The Letter A without A

Body:
Mathematica, 16 bytes

First@WordList[]

WordList[] gives a list of common English words. First takes the first element of this list, which is "a".


问:
Evaluate a Dice 10,000 roll

Introduction

Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.

Look here for the full rules.

Please note that the rules (especically the scoring) change from region to region since the game is widely known. We use the rules descibed below.

The Challenge

Given a list of six numbers from one to six representing a dice roll, output their score. The score is calculated in the follwing way:

Ones counts 100 points

Fives counts 50 points

Triplets count their number times 100 points. Three twos for example give 200 points. An exception are three ones which count 1000 points.

Six of the same number count like two triplets as described above. So six threes give 600 points. The same goes for the edge case with the ones: Six ones are 2,000 points.

One die can't be used more than once. If a die is part of a triplet, it does not count for other scorings. The fives in a triplet do not count 50 points in addition to the 500 points they give.

Triples are always counted first to maximize the score. So three fives are never counted as 150 points. Four fives are counted as one triplet and one ordinary five which then gives 550 points.

Notes

The input will always contain six numbers from one to six. You will not recieve invalid input.

The numbers can be in any order. You may not assume any specific ordering.

Rules

Input format is up to  you as long as it's not preprocessed.

Function or full program allowed.

Default rules for input/output.

Standard loopholes apply.

This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases

```
[1, 2, 3, 4, 5, 6] -> 150
[1, 1, 1, 2, 3, 5] -> 1050
[1, 1, 1, 1, 1, 1] -> 2000
[2, 2, 2, 2, 2, 2] -> 400
[6, 6, 1, 5, 5, 6] -> 800
[2, 3, 4, 6, 2, 4] -> 0
[1, 5, 1, 5, 1, 5] -> 1500
[5, 5, 5, 5, 2, 3] -> 550
[1, 1, 1, 1, 1, 5] -> 1250
[3, 3, 4, 4, 3, 4] -> 700
```

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

```<code>a=>a.sort().join``.replace(/(.)\1\1|1|5/g,s=>r+=s>>7?s/1.11:s>5?1e3:s>1?50:100,r=0)&&r
</code>```

Sorts and stringifies the input so that scoring combinations can be identified by means of regexp. Edit: Saved 1 byte thanks to @Arnauld.

Title: Evaluate a Dice 10,000 roll

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

a=>a.sort().join``.replace(/(.)\1\1|1|5/g,s=>r+=s>>7?s/1.11:s>5?1e3:s>1?50:100,r=0)&&r

Sorts and stringifies the input so that scoring combinations can be identified by means of regexp. Edit: Saved 1 byte thanks to @Arnauld.


问:
Print every printable ASCII character without using it
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

答:
Retina, 712 bytes, 2 DNPs

This was a collaborative effort with FryAmTheEggman.

There are several classes of solutions. For most characters from space to ^, we use a program of the following form:

```<code>
_
T`w`p</code>```

The character on the second line iterates through the ranges _0-9A-Za-z while the rest remains unchanged. This turns the empty input into that character and then replaces it with the printable ASCII character (represented by p) at the corresponding position. Each of these programs is 8 bytes long.

Within this range, there are only a few exceptions. Most importantly the digits can be shortened:

0: x (counts the number of xs in the empty input)

1:  (weehoo, empty program; counts the number of empty matches in the empty input)

2: now we turn the input into a single character, before counting empty strings:

```<code>
1

</code>```

3: same thing but we turn the input into two characters:

```<code>
11

</code>```

4: you get the idea...

```<code>
111

</code>```

5 - 9: plot twist... we use character repetition to avoid the second line getting any longer:

```<code>
4$*

</code>```

...

```<code>
8$*

</code>```

The other exception is that T is a DNP: we don't think it's possible to generate a non-digit character without it appearing in the source code if transliteration stages can't be used.

On to the remaining characters. To print _ we use a similar program as the general solution above:

```<code>
0
T`0`w</code>```

Making use of the fact that w starts with _.

Next, ` is the second DNP, because transliteration stages require those as well.

Then most of the lower-case letters are printed with something like this (which prints a):

```<code>
_
T`w`l</code>```

Again, the character on the second line increments through _0-9A-O. Here, we just need to watch out for l and w, which we can print with the following programs, respectively:

```<code>
P
T`p`w</code>```

```<code>
6
T`p`l</code>```

Finally, only {|}~ are left, which require 9 bytes each. Here, we use the transliteration stage to increment the character that precedes them. E.g. ~ can be printed with:

```<code>
1

</code>```0

Body:
Retina, 712 bytes, 2 DNPs

This was a collaborative effort with FryAmTheEggman.

There are several classes of solutions. For most characters from space to ^, we use a program of the following form:

_
T`w`p

The character on the second line iterates through the ranges _0-9A-Za-z while the rest remains unchanged. This turns the empty input into that character and then replaces it with the printable ASCII character (represented by p) at the corresponding position. Each of these programs is 8 bytes long.

Within this range, there are only a few exceptions. Most importantly the digits can be shortened:

0: x (counts the number of xs in the empty input)

1:  (weehoo, empty program; counts the number of empty matches in the empty input)

2: now we turn the input into a single character, before counting empty strings:

1

3: same thing but we turn the input into two characters:

11

4: you get the idea...

111

5 - 9: plot twist... we use character repetition to avoid the second line getting any longer:

4$*

...

8$*

The other exception is that T is a DNP: we don't think it's possible to generate a non-digit character without it appearing in the source code if transliteration stages can't be used.

On to the remaining characters. To print _ we use a similar program as the general solution above:

0
T`0`w

Making use of the fact that w starts with _.

Next, ` is the second DNP, because transliteration stages require those as well.

Then most of the lower-case letters are printed with something like this (which prints a):

_
T`w`l

Again, the character on the second line increments through _0-9A-O. Here, we just need to watch out for l and w, which we can print with the following programs, respectively:

P
T`p`w

6
T`p`l

Finally, only {|}~ are left, which require 9 bytes each. Here, we use the transliteration stage to increment the character that precedes them. E.g. ~ can be printed with:

}
T`_p`p


答:
BASH (sed + bc) 161

```<code>sed -re's/([1-6])(.*)\1(.*)\1/\100\2\3/g;s/([1-6])( .*)\1( .*)\1/\100\2\3/g;s/10/1/g; s/1/100/g;s/5( |$)/50 /g;s/[1-6][^0]//g;s/ +/+/g;s/(^\+|\+$)//g;s/^$/0/'|bc
</code>```

I wanted to do it all in sed, but addition is really hard...

Explanation:

Find a triplet, add 00 to the first number and remove the other

e.g. 1 2 1 3 1 4 -> 100 2 3 4

Repeat step 1 incase there are two triples

Replace 10 with 1 then 1 with 100

e.g. 100 -> 10 -> 1000 or 1 -> 1 -> 100

Replace each 5 not followed by 0 with 50

Remove any number that doesn't end in 0

Replace groups of spaces with +

Remove leading and trailing +s

If the string is empty, add a 0

Lastly pipe to bc to add everything up.

Title: Evaluate a Dice 10,000 roll

Body:
Introduction

Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.

Look here for the full rules.

Please note that the rules (especically the scoring) change from region to region since the game is widely known. We use the rules descibed below.

The Challenge

Given a list of six numbers from one to six representing a dice roll, output their score. The score is calculated in the follwing way:

Ones counts 100 points

Fives counts 50 points

Triplets count their number times 100 points. Three twos for example give 200 points. An exception are three ones which count 1000 points.

Six of the same number count like two triplets as described above. So six threes give 600 points. The same goes for the edge case with the ones: Six ones are 2,000 points.

One die can't be used more than once. If a die is part of a triplet, it does not count for other scorings. The fives in a triplet do not count 50 points in addition to the 500 points they give.

Triples are always counted first to maximize the score. So three fives are never counted as 150 points. Four fives are counted as one triplet and one ordinary five which then gives 550 points.

Notes

The input will always contain six numbers from one to six. You will not recieve invalid input.

The numbers can be in any order. You may not assume any specific ordering.

Rules

Input format is up to  you as long as it's not preprocessed.

Function or full program allowed.

Default rules for input/output.

Standard loopholes apply.

This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases

```
[1, 2, 3, 4, 5, 6] -> 150
[1, 1, 1, 2, 3, 5] -> 1050
[1, 1, 1, 1, 1, 1] -> 2000
[2, 2, 2, 2, 2, 2] -> 400
[6, 6, 1, 5, 5, 6] -> 800
[2, 3, 4, 6, 2, 4] -> 0
[1, 5, 1, 5, 1, 5] -> 1500
[5, 5, 5, 5, 2, 3] -> 550
[1, 1, 1, 1, 1, 5] -> 1250
[3, 3, 4, 4, 3, 4] -> 700
```

Body:
BASH (sed + bc) 161

sed -re's/([1-6])(.*)\1(.*)\1/\100\2\3/g;s/([1-6])( .*)\1( .*)\1/\100\2\3/g;s/10/1/g; s/1/100/g;s/5( |$)/50 /g;s/[1-6][^0]//g;s/ +/+/g;s/(^\+|\+$)//g;s/^$/0/'|bc

I wanted to do it all in sed, but addition is really hard...

Explanation:

Find a triplet, add 00 to the first number and remove the other

e.g. 1 2 1 3 1 4 -> 100 2 3 4

Repeat step 1 incase there are two triples

Replace 10 with 1 then 1 with 100

e.g. 100 -> 10 -> 1000 or 1 -> 1 -> 100

Replace each 5 not followed by 0 with 50

Remove any number that doesn't end in 0

Replace groups of spaces with +

Remove leading and trailing +s

If the string is empty, add a 0

Lastly pipe to bc to add everything up.


问:
Implement glob Matcher
Implement a function of pattern and string to be matched, return true if the pattern matches the WHOLE string, otherwise false.

Our glob pattern syntax is:

? matches any one character

+ matches one or more characters

* matches zero or more characters

\ escapes

Rules:

No eval, no converting into regular expression, no calling a system glob function.

I/O are not required: you can just write a function

Shortest wins

Examples:

```<code>glob('abc', 'abc') => true
glob('abc', 'abcdef') => false IMPORTANT!
glob('a??', 'aww') => true
glob('a*b', 'ab') => true
glob('a*b', 'agwijgwbgioeb') => true
glob('a*?', 'a') => false
glob('?*', 'def') => true
glob('5+', '5ggggg') => true
glob('+', '') => false
glob('a\*b', 'a*b') => true
</code>```

Here is a tip to get started: http://en.wikipedia.org/wiki/Backtracking

答:
D: 363 Characters

```<code>bool glob(S)(S s,S t){alias front f;alias popFront p;alias empty e;while(!e(s)&&!e(t)){switch(f(s)){case'+':if(e(t))return false;p(t);case'*':p(s);if(e(s))return true;if(f(s)!='+'&&f(s)!='*'){for(;!e(t);p(t)){if(f(s)==f(t)&&glob(s,t))return true;}}break;case'\\':p(s);if(e(s))return false;default:if(f(s)!=f(s))return false;case'?':p(s);p(t);}}return e(s)&&e(t);}
</code>```

More Legibly:

```<code>bool glob(S)(S s, S t)
{
    alias front f;
    alias popFront p;
    alias empty e;

    while(!e(s) && !e(t))
    {
        switch(f(s))
        {
            case '+':
                if(e(t))
                    return false;

                p(t);
            case '*':
                p(s);

                if(e(s))
                    return true;

                if(f(s) != '+' && f(s) != '*')
                {
                    for(; !e(t); p(t))
                    {
                        if(f(s) == f(t) && glob(s, t))
                            return true;
                    }
                }

                break;
            case '\\':
                p(s);

                if(e(s))
                    return false;
            default:
                if(f(s) != f(s))
                    return false;
            case '?':
                p(s);
                p(t);
        }
    }

    return e(s) && e(t);
}
</code>```

ContentLicense: CC BY-SA 2.5

Title: Implement glob Matcher

Body:
D: 363 Characters

bool glob(S)(S s,S t){alias front f;alias popFront p;alias empty e;while(!e(s)&&!e(t)){switch(f(s)){case'+':if(e(t))return false;p(t);case'*':p(s);if(e(s))return true;if(f(s)!='+'&&f(s)!='*'){for(;!e(t);p(t)){if(f(s)==f(t)&&glob(s,t))return true;}}break;case'\\':p(s);if(e(s))return false;default:if(f(s)!=f(s))return false;case'?':p(s);p(t);}}return e(s)&&e(t);}

More Legibly:

bool glob(S)(S s, S t)
{
    alias front f;
    alias popFront p;
    alias empty e;

    while(!e(s) && !e(t))
    {
        switch(f(s))
        {
            case '+':
                if(e(t))
                    return false;

                p(t);
            case '*':
                p(s);

                if(e(s))
                    return true;

                if(f(s) != '+' && f(s) != '*')
                {
                    for(; !e(t); p(t))
                    {
                        if(f(s) == f(t) && glob(s, t))
                            return true;
                    }
                }

                break;
            case '\\':
                p(s);

                if(e(s))
                    return false;
            default:
                if(f(s) != f(s))
                    return false;
            case '?':
                p(s);
                p(t);
        }
    }

    return e(s) && e(t);
}


问:
The coin catastrophe
In Golfenhagen, The people are allowed, and encouraged, to melt down old coins for scrap metal, if the smelter can make a profit off of it. There are 5 coins that make the Golfenhagen mint. The half-penny(0.5)(H), the penny(1)(P), the tea (5)(T), the flag (10)(F), and the driver (25)(D). Golfenhagen also mints bills, in the form of 100(O), 500(E), 1000(N), and 2500(Y). Recently, the price of metals has plumetted to an all time low, and so everybody is trying to give their coins away, as they are worth less than the bills.

A humble software engineer decides to write a program that will guarantee that those who pay with cash will always get at least 9 coins back on any purchase whose net difference is bigger than 3 cents.

Your challenge:

Take on the role of developer, and write a program that takes one input (the net difference of the money handed out and the purchase total) and outputs the correct change.

You must:

Make your program put out a nominal of 9 coins with any decimal, except where the difference is less than 5 cents (5).

Make your program output a diverse set of coins, all coins MUST be able to be outputted by your program. no giving change in exclusively in halfcents.

Use the dollar bills where applicable.

This is a golf, the shortest code wins

Examples:

301

  OODDDTTTTTP

This is a valid output. There are two dollars ("OO"), and 9 coins ("DDDTTTTTP ").

5693

  2Y1E1O2D3F2T3P

This is also valid output, as it specifies the currency type and quantities, and has 10 coins.

412

  OOOODPP

This is not valid output, as it only uses 3 coins.

20

  10P20H

This is not valid, see the second rule

Code example of a change counter for the least change possible. (as requested per cold golf)

package lookup;

public class Main {

    static void main(String[]s) {

        int changeincents = 53;
        int quartercount  =  0;
        int dimecount     =  0;
        int nickelcount   =  0;
        int pennycount    =  0;
        while(changeincents >= 25){//value of a quarter
            quartercount++;
            changeincents-=25;
        }
        while(changeincents >= 10){
            dimecount++;
            changeincents-=10;
        }
        while(changeincents >= 5){
            nickelcount++;
            changeincents-=5;
        }
        while(changeincents >= 1){
            pennycount++;
            changeincents--;
        }
    }
}
```

Good luck!

Title: The coin catastrophe

Body:
Haskell, <s>177</s> 165 bytes

Thanks to @Lynn.

f n|n>2504='Y':f(n-2500)|n>1004='N':f(n-1000)|n>504='E':f(n-500)|n>104='O':f(n-100)|n>29='D':f(n-25)|n>14='F':f(n-10)|n>9='T':f(n-5)|n>6='P':f(n-1)|0<1=[1..2*n]>>"H"

In a readable format:

f n
  | n > 2504 = "Y" ++ f(n-2500)
  | n > 1004 = "N" ++ f(n-1000)
  | n > 504 = "E" ++ f(n-500)
  | n > 104 = "O" ++ f(n-100)
  | n > 29 = "D" ++ f(n-25)
  | n > 14 = "F" ++ f(n-10)
  | n > 9 = "T" ++ f(n-5)
  | n > 6 = "P" ++ f(n-1)
  | 0 < 1 = replicate (2*n) 'H'

Just give out the biggest denomination which still leaves more than 5 cents to fill with halfcoins.


问:
Enterprise Quality Code Prime Sieve

Enterprise Quality Code!

TL;DR

Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen language only supports unary or other based output) separated by newlines (optional trailing linefeed).

You may post cracks at any time, but you must wait one hour after posting each initial bowled submission

Leading or trailing whitespace is not acceptable (except for the trailing newline)

An answer's score is the number of bytes in the answer. A user's score is the total number of bytes of all uncracked answers.

An answer gets cracked when another user posts an answer (in the same language) which is a permutation of any subset of the characters used in the original answer.

The user with the highest score will receive an accepted tick mark on his /her highest scoring post (although it doesnt really matter which specific post gets the tick)

The Inspiration for this challenge

At Pretty Good consultants there is a focus on writing "quality" verbose code that is sufficiently engineered. Your boss has decided to test you on your skills.

Consider the set of all programming languages in existence before the posting of this challenge. For this challenge there will technically be one individual "winner" in each language, however the boss will give a <s>promotion</s> accepted tick mark to only one answer based on your score.

Detailed Spec

The goal of this challenge is to receive an integer N strictly smaller than 2^8-1 and print the first N prime numbers (in less than 24 hours) separated by your platforms choice of new line (a trailing newline is optional). OEIS sequence A000040 in as many bytes as possible in as many languages as possible. However, note that others vying for the promotion will try to "help" you by golfing down your score. (Please note that your prime generation function should theoretically work for integer N inputs strictly smaller than 2^16-1 given enough time, the bounds for N have been reduced after realizing how slow some interpreters are (namely mine) hardcoding the list of primes is strictly forbidden)

Sample output for an input 11

```
2
3
5
7
11
13
17
19
23
29
31
```

How to participate

Pick any language X, but please avoid selecting a language which is just another version or derivative of another answer.
If there is no existing answer in language X than you will write a program (which must fit into a single post I.E it must be less than 30k characters) that solves this challenge.
The length in bytes of the source (in any reasonable preexisting textual encoding) will be added to your score. You must avoid using any unnecessary characters for reasons that will soon become apparent.

If language X already has been used to answer this question, then you must answer using any permutation of any proper subset of the characters used in the shortest answer (I.E take the shortest X answer and remove some (>=1) characters and optionally rearrange the resulting code). The previous holder of the shortest X answer will lose all of the bytes provided by his answer from his score, and the number of bytes of your submission will now be added to your score. The number of bytes golfed off gets "lost" forever.

Rules for Languages

You may only crack a submission by posting an answer in the same language (and version), but you are barred from posting an answer in language X if there exists a submission in a sufficiently similar language Y. Please do not abuse this rule posting an answer in a sufficiently similar language will receive disqualification.

Below is a leader board which removes answers with "cracked" (with any case) in their header.

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Title: Enterprise Quality Code Prime Sieve


答:
Java, 204 205 204 203 bytes cracked!

Crack of one of Rohan Jhunjhunwala's submissions.

```<code>class y{public static void main(String[]b){int n=2,l=870119,i,f,j;i=new java.util.Scanner(System.in).nextInt();while(i>0){f=0;for(j=1;j<l;j++){if(n%j==0){f++;}}if(f==2){System.out.println(n);i--;}n++;}}}
</code>```

The spec said it only needs to work up to the 2^16-1 = 65535th prime (821603).

We can remove the string x="z...z" and the loop to increment this value and set l to be a working value greater than or equal to 821603. In removing that we can also remove the initialisation of i, so we get ne numeric characters 0791819 to use. The smallest valid, working value for l is now 870119.

Test it on ideone

Title: Enterprise Quality Code Prime Sieve

Body:
Enterprise Quality Code!

TL;DR

Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen language only supports unary or other based output) separated by newlines (optional trailing linefeed).

You may post cracks at any time, but you must wait one hour after posting each initial bowled submission

Leading or trailing whitespace is not acceptable (except for the trailing newline)

An answer's score is the number of bytes in the answer. A user's score is the total number of bytes of all uncracked answers.

An answer gets cracked when another user posts an answer (in the same language) which is a permutation of any subset of the characters used in the original answer.

The user with the highest score will receive an accepted tick mark on his /her highest scoring post (although it doesnt really matter which specific post gets the tick)

The Inspiration for this challenge

At Pretty Good consultants there is a focus on writing "quality" verbose code that is sufficiently engineered. Your boss has decided to test you on your skills.

Consider the set of all programming languages in existence before the posting of this challenge. For this challenge there will technically be one individual "winner" in each language, however the boss will give a <s>promotion</s> accepted tick mark to only one answer based on your score.

Detailed Spec

The goal of this challenge is to receive an integer N strictly smaller than 2^8-1 and print the first N prime numbers (in less than 24 hours) separated by your platforms choice of new line (a trailing newline is optional). OEIS sequence A000040 in as many bytes as possible in as many languages as possible. However, note that others vying for the promotion will try to "help" you by golfing down your score. (Please note that your prime generation function should theoretically work for integer N inputs strictly smaller than 2^16-1 given enough time, the bounds for N have been reduced after realizing how slow some interpreters are (namely mine) hardcoding the list of primes is strictly forbidden)

Sample output for an input 11

```
2
3
5
7
11
13
17
19
23
29
31
```

How to participate

Pick any language X, but please avoid selecting a language which is just another version or derivative of another answer.
If there is no existing answer in language X than you will write a program (which must fit into a single post I.E it must be less than 30k characters) that solves this challenge.
The length in bytes of the source (in any reasonable preexisting textual encoding) will be added to your score. You must avoid using any unnecessary characters for reasons that will soon become apparent.

If language X already has been used to answer this question, then you must answer using any permutation of any proper subset of the characters used in the shortest answer (I.E take the shortest X answer and remove some (>=1) characters and optionally rearrange the resulting code). The previous holder of the shortest X answer will lose all of the bytes provided by his answer from his score, and the number of bytes of your submission will now be added to your score. The number of bytes golfed off gets "lost" forever.

Rules for Languages

You may only crack a submission by posting an answer in the same language (and version), but you are barred from posting an answer in language X if there exists a submission in a sufficiently similar language Y. Please do not abuse this rule posting an answer in a sufficiently similar language will receive disqualification.

Below is a leader board which removes answers with "cracked" (with any case) in their header.

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Java, 204 205 204 203 bytes cracked!

Crack of one of Rohan Jhunjhunwala's submissions.

class y{public static void main(String[]b){int n=2,l=870119,i,f,j;i=new java.util.Scanner(System.in).nextInt();while(i>0){f=0;for(j=1;j<l;j++){if(n%j==0){f++;}}if(f==2){System.out.println(n);i--;}n++;}}}

The spec said it only needs to work up to the 2^16-1 = 65535th prime (821603).

We can remove the string x="z...z" and the loop to increment this value and set l to be a working value greater than or equal to 821603. In removing that we can also remove the initialisation of i, so we get ne numeric characters 0791819 to use. The smallest valid, working value for l is now 870119.

Test it on ideone


答:
Reng, <s>564</s> 560 bytes, non-competing

Try them here!

Reng uses ISO-8859-1, and in this submission, it uses those characters.

```<code>Wo~
Xo~
Yo~
Zo~
6²o~
KH+o~
KI+o~
KJ+o~
K2*o~
KL+o~
KM+o~
43¹o~
44¹o~
45¹o~
46¹o~
47¹o~
n~
7²o~
1|~n+
51¹o~
2|~n+
41+n~
3|~n+
55¹o~
4|~n+
57¹o~
58¹o~
59¹o~
60¹o~
61¹o~
62¹o~
63¹o~
8²o~
65¹o~
66¹o~
67¹o~
68¹o~
69¹o~
70¹o~
71¹o~
72¹o~
73¹o~
74¹o~
75¹o~
76¹o~
77¹o~
78¹o~
79¹o~
80¹o~
9²o~
82¹o~
83¹o~
84¹o~
85¹o~
86¹o~
87¹o~
88¹o~
89¹o~
90¹o~
91¹o~
92¹o~
93¹o~
94¹o~
95¹o~
96¹o~
97¹o~
98¹o~
99¹o~
A0¹o~
A1¹o~
A2¹o~
A3¹o~
A4¹o~
A5¹o~
A6¹o~
A7¹o~
A8¹o~
A9¹o~
1A¹o~
B1¹:70g ~
B2¹o~
B3¹o~
B4¹o~
B5¹o~
B6¹o~
B7¹o~
B8¹o~
B9¹o~
C0¹o~
B²o~
C2¹o~
C3¹o~
C4¹o~
C5¹o~
C6¹:00go
</code>```

All of these are mostly writing out the hex code of the character (¹ is "manhattan addition", e.g. digit concatenation), but here are some highlights:

```<code>C6¹:00go
</code>```

This prints ~:

```<code>C6¹:00go
C6¹       push 126 (C = 12, 6 = 6, 12 +M 6 = 126)
   :      duplicate
    00g   place in first slot
       o  output tilde
</code>```

(modified code, it wraps around)

```<code>~6¹:00go
~         terminate the program
</code>```

This prints o:

```<code>B1¹:70g ~
B1¹        push 111 (B = 11, 1 = 1, B +M 1 = 111)
   :       duplicate
    70g    place at seventh character
       o   (this was just placed) - output
        ~  terminate
</code>```

Title: Print every printable ASCII character without using it

Body:
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

Body:
Reng, <s>564</s> 560 bytes, non-competing

Try them here!

Reng uses ISO-8859-1, and in this submission, it uses those characters.

Wo~
Xo~
Yo~
Zo~
6²o~
KH+o~
KI+o~
KJ+o~
K2*o~
KL+o~
KM+o~
43¹o~
44¹o~
45¹o~
46¹o~
47¹o~
n~
7²o~
1|~n+
51¹o~
2|~n+
41+n~
3|~n+
55¹o~
4|~n+
57¹o~
58¹o~
59¹o~
60¹o~
61¹o~
62¹o~
63¹o~
8²o~
65¹o~
66¹o~
67¹o~
68¹o~
69¹o~
70¹o~
71¹o~
72¹o~
73¹o~
74¹o~
75¹o~
76¹o~
77¹o~
78¹o~
79¹o~
80¹o~
9²o~
82¹o~
83¹o~
84¹o~
85¹o~
86¹o~
87¹o~
88¹o~
89¹o~
90¹o~
91¹o~
92¹o~
93¹o~
94¹o~
95¹o~
96¹o~
97¹o~
98¹o~
99¹o~
A0¹o~
A1¹o~
A2¹o~
A3¹o~
A4¹o~
A5¹o~
A6¹o~
A7¹o~
A8¹o~
A9¹o~
1A¹o~
B1¹:70g ~
B2¹o~
B3¹o~
B4¹o~
B5¹o~
B6¹o~
B7¹o~
B8¹o~
B9¹o~
C0¹o~
B²o~
C2¹o~
C3¹o~
C4¹o~
C5¹o~
C6¹:00go

All of these are mostly writing out the hex code of the character (¹ is "manhattan addition", e.g. digit concatenation), but here are some highlights:

C6¹:00go

This prints ~:

C6¹:00go
C6¹       push 126 (C = 12, 6 = 6, 12 +M 6 = 126)
   :      duplicate
    00g   place in first slot
       o  output tilde

(modified code, it wraps around)

~6¹:00go
~         terminate the program

This prints o:

B1¹:70g ~
B1¹        push 111 (B = 11, 1 = 1, B +M 1 = 111)
   :       duplicate
    70g    place at seventh character
       o   (this was just placed) - output
        ~  terminate


答:
Commodore 64 BASIC, 6 bytes

```<code>2?"♠"
</code>```

There's a non-printing character after the first quotation mark, with byte value 14.

How this works: The Commodore 64 has two character sets: "shifted mode" (which contains the full upper- and lower-case alphabet, and the startup "unshifted mode", which contains the upper-case alphabet and a selection of symbols.  The "spade" symbol in unshifted mode has the same byte value as uppercase "A" in shifted mode, so if you switch modes before printing out a "♠", you get the letter "A" instead.

The question now becomes: what's the most efficient way of switching modes?  The "approved" method is POKE 53272,23, but that's rather long for code golf.  There's a control character (byte value 14) that switches to shifted mode, but you can't type it in directly, and ?CHR$(14) is still rather long.  Further, both of these contain disallowed characters, and working around that would expand them quite a bit.

You can cut it down to a single byte, though, by combining it with the code to print out the "A".  The Commodore has no memory protection, so after typing in a proxy program (I used 2?"Q♠"), you can modify the in-memory representation to replace the "Q" with byte value 14.  For a freshly-started C64, POKE 2055,14 will do the job.

Title: The Letter A without A

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

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

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

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

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

Validity Checker

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

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

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

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

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

Body:
Commodore 64 BASIC, 6 bytes

2?"♠"

There's a non-printing character after the first quotation mark, with byte value 14.

How this works: The Commodore 64 has two character sets: "shifted mode" (which contains the full upper- and lower-case alphabet, and the startup "unshifted mode", which contains the upper-case alphabet and a selection of symbols.  The "spade" symbol in unshifted mode has the same byte value as uppercase "A" in shifted mode, so if you switch modes before printing out a "♠", you get the letter "A" instead.

The question now becomes: what's the most efficient way of switching modes?  The "approved" method is POKE 53272,23, but that's rather long for code golf.  There's a control character (byte value 14) that switches to shifted mode, but you can't type it in directly, and ?CHR$(14) is still rather long.  Further, both of these contain disallowed characters, and working around that would expand them quite a bit.

You can cut it down to a single byte, though, by combining it with the code to print out the "A".  The Commodore has no memory protection, so after typing in a proxy program (I used 2?"Q♠"), you can modify the in-memory representation to replace the "Q" with byte value 14.  For a freshly-started C64, POKE 2055,14 will do the job.


答:
Ruby, 25209 bytes

```require"[encoded data, 25153 characters]".size.*(1331).to_s 35
puts Prime.take gets.to_i
```

Demo at ideone. That's a string consisting of 25153 underscores and nothing else (25153*1331 base 35 is "mathn"), the site formatting might mess with it a bit.

Title: Enterprise Quality Code Prime Sieve

Body:
Ruby, 25209 bytes

require"[encoded data, 25153 characters]".size.*(1331).to_s 35
puts Prime.take gets.to_i

Demo at ideone. That's a string consisting of 25153 underscores and nothing else (25153*1331 base 35 is "mathn"), the site formatting might mess with it a bit.


问:
Staggered Starts
In races in which racers go around at least one turn of a curved track, the starting positions for each racer are staggered, so that each racer travels the same distance around the track (otherwise, the racer in the innermost lane would have a huge advantage).

Given the lengths of the major and minor axes (or semi-major and semi-minor, if you'd prefer) of an elliptical track and the number of lanes in the track, output the distances from the innermost lane's starting point that each lane should be staggered.

Specifications

Each lane is an ellipse with semi-major axes 5 units longer than the next-shortest lane. For simplicity, assume that the lanes have 0 width.

The innermost lane always starts at 0, and every other starting point is a positive integer greater than or equal to the previous starting point.

Input and output may be in any convenient and reasonable format.

The inputs will always be integers.

You must calculate the circumference of the track to within 0.01 units of the actual value.

Outputs are to be rounded down to the nearest integer (floored).

The finish line is the starting point for the innermost racer. There is only one lap in the race.

The lengths of the axes are measured using the innermost lane of the track.

Outputting the 0 for the innermost lane's offset is optional.

Test Cases

Format: a, b, n -> <list of offsets, excluding innermost lane>

```<code>20, 10, 5 -> 30, 61, 92, 124
5, 5, 2 -> 31
15, 40, 7 -> 29, 60, 91, 121, 152, 183
35, 40, 4 -> 31, 62, 94
</code>```

These test cases were generated with the following Python 3 script, which uses an approximation of the circumference of an ellipse devised by Ramanujan:

#!/usr/bin/env python3

import math

a = 35 # semi-major axis
b = 40 # semi-minor axis
n = 4  # number of lanes
w = 5  # spacing between lanes (constant)

h = lambda a,b:(a-b)**2/(a+b)**2
lane_lengths = [math.pi*(a+b+w*i*2)*(1+3*h(a+w*i,b+w*i)/(10+math.sqrt(4-3*h(a+w*i,b+w*i)))) for i in range(n)]

print("{}, {}, {} -> {}".format(a, b, n, ', '.join([str(int(x-lane_lengths[0])) for x in lane_lengths[1:]])))
```

The approximation used is:

Finally, here is a helpful diagram for understanding the calculations of the offsets:

答:
05AB1E, 43 bytes

```<code>UVFXY-nXY+WZn/3*©T4®-t+/>Z*žq*5DX+UY+V})¬-ï
</code>```

Explanation

```<code>UV                                           # X = a, Y = b
  F                                   }      # n times do
   XY-n                                      # (a-b)^2
       XY+W                                  # Z = (a + b)
             /                               # divide (a-b)^2
           Zn                                # by (a+b)^2
              3*                             # multiply by 3
                ©                            # C = 3h
                       /                     # 3h divided by
                 T                           # 10
                      +                      # +
                  4®-t                       # sqrt(4-3h)
                        >                    # increment
                         Z*žq*               # times (a + b)*pi
                              5DX+UY+V       # increase a and b by 5
                                       )     # wrap in list of circumferences
                                        ¬-   # divide by inner circumference
                                          ï  # floor
                                             # implicitly display
</code>```

Try it online!

Title: Staggered Starts

Body:
05AB1E, 43 bytes

UVFXY-nXY+WZn/3*©T4®-t+/>Z*žq*5DX+UY+V})¬-ï

Explanation

UV                                           # X = a, Y = b
  F                                   }      # n times do
   XY-n                                      # (a-b)^2
       XY+W                                  # Z = (a + b)
             /                               # divide (a-b)^2
           Zn                                # by (a+b)^2
              3*                             # multiply by 3
                ©                            # C = 3h
                       /                     # 3h divided by
                 T                           # 10
                      +                      # +
                  4®-t                       # sqrt(4-3h)
                        >                    # increment
                         Z*žq*               # times (a + b)*pi
                              5DX+UY+V       # increase a and b by 5
                                       )     # wrap in list of circumferences
                                        ¬-   # divide by inner circumference
                                          ï  # floor
                                             # implicitly display

Try it online!


Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
C, 60 bytes

i;main(j){for(;j<27;j*j^++i||puts("",j++))putchar(i%26+65);}


问:
Find the Factorial!
Create the shortest program or function that finds the factorial of a non-negative integer.

The factorial, represented with ! is defined as such

$$n!:=\begin{cases}1 & n=0\\n\cdot(n-1)!&n>0\end{cases}$$

In plain English the factorial of 0 is 1 and the factorial of n, where n is larger than 0 is n times the factorial of one less than n.

Your code should perform input and output using a standard methods.

Requirements:

Does not use any built-in libraries that can calculate the factorial (this includes any form of eval)

Can calculate factorials for numbers up to 125

Can calculate the factorial for the number 0 (equal to 1)

Completes in under a minute for numbers up to 125

The shortest submission wins, in the case of a tie the answer with the most votes at the time wins.

答:
Python (31 29 character)

```<code>f=lambda n:n and n*f(n-1)or 1
</code>```

28 characters

```<code>f=lambda n:+(n<2)or n*f(n-1)
</code>```

ContentLicense: CC BY-SA 4.0

Title: Find the Factorial!

Body:
Python (31 29 character)

f=lambda n:n and n*f(n-1)or 1

28 characters

f=lambda n:+(n<2)or n*f(n-1)


答:
Python 2 or 3, 123 122 121 116 109 108 104 102 100 97 bytes

Python 2, 97 bytes

lambda r:100*sum(c/3*((v<2)*9+v)+c%3*(v<2or(v==5)/2.)for v,c in enumerate(map(r.count,range(7))))
```
<p>Test cases are on <strong>ideone</strong></p>
<p><strong>Python 3, 97 bytes</strong></p>
<pre class="lang-python prettyprint-override"><code>lambda r:100*sum(c//3*((v<2)*9+v)+c%3*(v<2or(v==5)/2)for v,c in enumerate(map(r.count,range(7))))
</code>```

Title: Evaluate a Dice 10,000 roll

Body:
Python 2 or 3, 123 122 121 116 109 108 104 102 100 97 bytes

Python 2, 97 bytes

lambda r:100*sum(c/3*((v<2)*9+v)+c%3*(v<2or(v==5)/2.)for v,c in enumerate(map(r.count,range(7))))

Test cases are on ideone

Python 3, 97 bytes

lambda r:100*sum(c//3*((v<2)*9+v)+c%3*(v<2or(v==5)/2)for v,c in enumerate(map(r.count,range(7))))


问:
What base is this number in?
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

答:
Haskell, <s>55</s> 40 bytes

```<code>f=(\y->mod(y-8)39).Data.Char.ord.maximum
</code>```

Thanks @Dennis for his approach. (take that, @xnor ;))

Title: What base is this number in?

Body:
Haskell, <s>55</s> 40 bytes

f=(\y->mod(y-8)39).Data.Char.ord.maximum

Thanks @Dennis for his approach. (take that, @xnor ;))


答:
Python, 25 bytes

```<code>lambda x:int(max(x),36)+1
</code>```

Defines a lambda that takes the string x. Finds the largest digit in the string (sorted with letters above digits, by python's default), and converts to base 36. Adds 1, because 8 is not in base 8.

Title: What base is this number in?

Body:
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

Body:
Python, 25 bytes

lambda x:int(max(x),36)+1

Defines a lambda that takes the string x. Finds the largest digit in the string (sorted with letters above digits, by python's default), and converts to base 36. Adds 1, because 8 is not in base 8.


答:
Jelly, 4 bytes

```<code>ṀØBi
</code>```

Requires uppercase. Try it online! or verify all test cases.

How it works

```<code>ṀØBi  Main link. Arguments: s (string)

Ṁ     Yield the maximum of s.
 ØB   Yield "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
   i  Find the 1-based index of the maximum in that string.
</code>```

Title: What base is this number in?

Body:
Jelly, 4 bytes

ṀØBi

Requires uppercase. Try it online! or verify all test cases.

How it works

ṀØBi  Main link. Arguments: s (string)

Ṁ     Yield the maximum of s.
 ØB   Yield "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
   i  Find the 1-based index of the maximum in that string.


答:
Cheddar, <s>34</s> <s>29</s> 21 bytes

Saved 8 bytes thanks to Dennis!!!

```<code>s->(s.bytes.max-8)%39
</code>```

Uses lowercase letters

Try it online

Explanation

```<code>s -> (      // Input is `s`
  s.bytes    // Returns array of char codes
   .max      // Get maximum item in array
) % 39      // Modulus 39
</code>```

Title: What base is this number in?

Body:
Cheddar, <s>34</s> <s>29</s> 21 bytes

Saved 8 bytes thanks to Dennis!!!

s->(s.bytes.max-8)%39

Uses lowercase letters

Try it online

Explanation

s -> (      // Input is `s`
  s.bytes    // Returns array of char codes
   .max      // Get maximum item in array
) % 39      // Modulus 39


答:
Haskell, 34 bytes

f s=length['\t'..maximum s]`mod`39
```

<p>Uses the <code>mod(ord(c)-8,39)</code> idea from Dennis.</p>

<p><strong>41 bytes</strong></p>

<pre class="lang-haskell prettyprint-override"><code>g '0'=1
g 'W'=1
g x=1+g(pred x)
g.maximum
</code>```

45 bytes:

(`elemIndex`(['/'..'9']++['a'..'z'])).maximum
```

Outputs like Just 3.

Title: What base is this number in?

Body:
Haskell, 34 bytes

f s=length['\t'..maximum s]`mod`39

Uses the mod(ord(c)-8,39) idea from Dennis.

41 bytes

g '0'=1
g 'W'=1
g x=1+g(pred x)
g.maximum

45 bytes:

(`elemIndex`(['/'..'9']++['a'..'z'])).maximum

Outputs like Just 3.


答:
ASCII constrained x86 Machine Code for DOS, 3104 3101 2913 bytes

Well... It's shorter than Java, I guess...

32 30 bytes for almost all characters, for exceptions see below.

Most of the time it just follows the pattern:

Do some xor to get a pointer to the end.

sub from the last 2 words because the opcode for int is not in ASCII.

Get 2 into AH and the character into DL. Both are xored because the character itself can't appear in the program and 2 is not a printable ASCII character.

Print the character with int 21h

Exit with int 20h

Most of the time, if a character is disallowed, it can be replaced by either twiddling with the data a bit or switching to a different register.

It gets a bit more interesting when you suddenly find yourself unable to subtract or unable to push or pop the only register usable for calculations...

```<code>char  code
      hX'X5B&P[hT!^)7CC)7VX5t#PZ!C!B
!     hX'X5B&P[hS ^)7CC)7VX5r"PZ B A
"     hX'X5B&P[hS!^)7CC)7VX5q#PZ C B
#     hX'X5B&P[hS ^)7CC)7VX5p"PZ B A
$     hX'X5B&P[hS ^)7CC)7VX5w"PZ B A
%     hX'X5B&P[hS ^)7CC)7VX5v"PZ B A
&     hX#X5B"P[hS ^)7CC)7VX5u"PZ B A
'     hX#X5B"P[hS ^)7CC)7VX5t"PZ B A
(     hX'X5B&P[hS ^)7CC)7VX5{"PZ B A
)     hi'X5B&P[h!!X%BBHP^$!P_17C!?C17C!?hiBX5@@PZ2@2A
*     hX'X5B&P[hS ^)7CC)7VX5y"PZ B A
+     hX'X5B&P[hS ^)7CC)7VX5x"PZ B A
,     hX'X5B&P[hT ^)7CC)7VX5x"PZ!B!A
-     hX'X5B&P[hS ^)7CC)7VX5~"PZ B A
.     hX'X5B&P[hS ^)7CC)7VX5}"PZ B A
/     hX'X5B&P[hS ^)7CC)7VX5|"PZ B A
0     hX'X5B&P[hS ^)7CC)7VX5c"PZ B A
1     hX'X5B&P[hS ^)7CC)7VX5b"PZ B A
2     hX'X5B&P[hS ^)7CC)7VX5a"PZ B A
3     hX'X5B&P[hS ^)7CC)7VX5`"PZ B A
4     hX'X5B&P[hS ^)7CC)7VX5g"PZ B A
5     h;'X%[AP[h=S^)7CC)7VX%7"PZ _ ^
6     hX'X5B&P[hS ^)7CC)7VX5e"PZ B A
7     hX'X5B&P[hS _)?CC)?WX5d"PZ B A
8     hX'X5B&P[hS ^)7CC)7VX5k"PZ B A
9     hX'X5B&P[hS ^)7CC)7VX5j"PZ B A
:     hX'X5B&P[hS ^)7CC)7VX5i"PZ B A
;     hX'X5B&P[hS ^)7CC)7VX5h"PZ B A
<     hX'X5B&P[hS ^)7CC)7VX5o"PZ B A
=     hX'X5B&P[hS ^)7CC)7VX5n"PZ B A
>     hX'X5B&P[hS ^)7CC)7VX5m"PZ B A
?     hX'X5B&P[hS ^)7CC)7VX5l"PZ B A

@     hX'X5B&P[h` ^)7CC)7VX5 "PZ-B-A
A     hX'X5B&P[h`!^)7CC)7VX5!#PZ-C-B
B     h['X5A&P[h`"^)7CC)7VX5" PZ-D-C
C     hX'X5B&P_h` ^)5GG)5VX5#"PZ-B-A
D     hX'X5B&P[h` ^)7CC)7VX5$"PZ-B-A
E     hX'X5B&P[h` ^)7CC)7VX5%"PZ-B-A
F     hX'X5B&P[h` ^)7CC)7VX5&"PZ-B-A
G     hX'X5B&P[h` ^)7CC)7VX5'"PZ-B-A
H     hX'X5B&P[h` ^)7CC)7VX5("PZ-B-A
I     hX'X5B&P[h` ^)7CC)7VX5)"PZ-B-A
J     hX'X5B&P[h` ^)7CC)7VX5*"PZ-B-A
K     hX'X5B&P[h` ^)7CC)7VX5+"PZ-B-A
L     hX'X5B&P[h` ^)7CC)7VX5,"PZ-B-A
M     hX'X5B&P[h` ^)7CC)7VX5-"PZ-B-A
N     hX'X5B&P[h` ^)7CC)7VX5."PZ-B-A
O     hX'X5B&P[h` ^)7CC)7VX5/"PZ-B-A
P     hj'X5B&`[[[[[[[[h` ^)7CC)7VX50"`ZZZZZZZZ-B-A
Q     hX'X5B&P[h` ^)7CC)7VX51"PZ-B-A
R     hX'X5B&P[h` ^)7CC)7VX52"PZ-B-A
S     hX'X5B&P[h` ^)7CC)7VX53"PZ-B-A
T     hX'X5B&P[h` ^)7CC)7VX54"PZ-B-A
U     hX'X5B&P[h` ^)7CC)7VX55"PZ-B-A
V     hX'X5B&P[h` _)?CC)?WX56"PZ B A
W     hX'X5B&P[h` ^)7CC)7VX57"PZ-B-A
X     _TYhe'WWWQWWWa5B&P[hSS^)7CC)7CC5_C5 @PZ u t
Y     hX'X5B&P[h` ^)7CC)7VX59"PZ-B-A
Z     _WTYhzBX5 @Phe'WPWQWWWa5B&P[hSS^)7CC)7X u t
[     hX'X5B&P_h` ^)5GG)5VX5;"PZ-B-A
\     hX'X5B&P[h` ^)7CC)7VX5<"PZ-B-A
]     hX'X5B&P[h` ^)7CC)7VX5="PZ-B-A
^     hX'X5B&P[h` _)?CC)?WX5>"PZ-B-A
_     hX'X5B&P[h` ^)7CC)7VX5?"PZ-B-A

`     hX'X5B&P[hS ^)7CC)7VX53"PZ B A
a     hX'X5B&P[hS ^)7CC)7VX52"PZ B A
b     hX'X5B&P[hS ^)7CC)7VX51"PZ B A
c     hX'X5B&P[hS ^)7CC)7VX50"PZ B A
d     hX'X5B&P[hS ^)7CC)7VX57"PZ B A
e     hX'X5B&P[hS ^)7CC)7VX56"PZ B A
f     hX'X5B&P[hS ^)7CC)7VX55"PZ B A
g     hX'X5B&P[hS ^)7CC)7VX54"PZ B A
h     _WWX5b'5B&P[WX5S P^)7CC)7VX5;"PZ B A
i     hX'X5B&P[hS ^)7CC)7VX5:"PZ B A
j     hX'X5B&P[hS ^)7CC)7VX59"PZ B A
k     hX'X5B&P[hS ^)7CC)7VX58"PZ B A
l     hX'X5B&P[hS ^)7CC)7VX5?"PZ B A
m     hX'X5B&P[hS ^)7CC)7VX5>"PZ B A
n     hX'X5B&P[hS ^)7CC)7VX5="PZ B A
o     hX'X5B&P[hS ^)7CC)7VX5<"PZ B A
p     hX'X5B&P[hS ^)7CC)7VX5#"PZ B A
q     hX'X5B&P[hS ^)7CC)7VX5""PZ B A
r     hX'X5B&P[hS ^)7CC)7VX5!"PZ B A
s     hX'X5B&P[hS ^)7CC)7VX5 "PZ B A
t     hX'X5B&P[hS ^)7CC)7VX5'"PZ B A
u     hX'X5B&P[hS ^)7CC)7VX5&"PZ B A
v     hX'X5B&P[hS ^)7CC)7VX5%"PZ B A
w     hX'X5B&P[hS ^)7CC)7VX5$"PZ B A
x     hX'X5B&P[hS ^)7CC)7VX5+"PZ B A
y     hX'X5B&P[hS ^)7CC)7VX5*"PZ B A
z     hX'X5B&P[hS ^)7CC)7VX5)"PZ B A
{     hX'X5B&P[hS ^)7CC)7VX5("PZ B A
|     hX'X5B&P[hS ^)7CC)7VX5/"PZ B A
}     hX'X5B&P[hS ^)7CC)7VX5."PZ B A
~     hX'X5B&P[hS ^)7CC)7VX5-"PZ B A
</code>```

Body:
ASCII constrained x86 Machine Code for DOS, 3104 3101 2913 bytes

Well... It's shorter than Java, I guess...

32 30 bytes for almost all characters, for exceptions see below.

Most of the time it just follows the pattern:

Do some xor to get a pointer to the end.

sub from the last 2 words because the opcode for int is not in ASCII.

Get 2 into AH and the character into DL. Both are xored because the character itself can't appear in the program and 2 is not a printable ASCII character.

Print the character with int 21h

Exit with int 20h

Most of the time, if a character is disallowed, it can be replaced by either twiddling with the data a bit or switching to a different register.

It gets a bit more interesting when you suddenly find yourself unable to subtract or unable to push or pop the only register usable for calculations...

char  code
      hX'X5B&P[hT!^)7CC)7VX5t#PZ!C!B
!     hX'X5B&P[hS ^)7CC)7VX5r"PZ B A
"     hX'X5B&P[hS!^)7CC)7VX5q#PZ C B
#     hX'X5B&P[hS ^)7CC)7VX5p"PZ B A
$     hX'X5B&P[hS ^)7CC)7VX5w"PZ B A
%     hX'X5B&P[hS ^)7CC)7VX5v"PZ B A
&     hX#X5B"P[hS ^)7CC)7VX5u"PZ B A
'     hX#X5B"P[hS ^)7CC)7VX5t"PZ B A
(     hX'X5B&P[hS ^)7CC)7VX5{"PZ B A
)     hi'X5B&P[h!!X%BBHP^$!P_17C!?C17C!?hiBX5@@PZ2@2A
*     hX'X5B&P[hS ^)7CC)7VX5y"PZ B A
+     hX'X5B&P[hS ^)7CC)7VX5x"PZ B A
,     hX'X5B&P[hT ^)7CC)7VX5x"PZ!B!A
-     hX'X5B&P[hS ^)7CC)7VX5~"PZ B A
.     hX'X5B&P[hS ^)7CC)7VX5}"PZ B A
/     hX'X5B&P[hS ^)7CC)7VX5|"PZ B A
0     hX'X5B&P[hS ^)7CC)7VX5c"PZ B A
1     hX'X5B&P[hS ^)7CC)7VX5b"PZ B A
2     hX'X5B&P[hS ^)7CC)7VX5a"PZ B A
3     hX'X5B&P[hS ^)7CC)7VX5`"PZ B A
4     hX'X5B&P[hS ^)7CC)7VX5g"PZ B A
5     h;'X%[AP[h=S^)7CC)7VX%7"PZ _ ^
6     hX'X5B&P[hS ^)7CC)7VX5e"PZ B A
7     hX'X5B&P[hS _)?CC)?WX5d"PZ B A
8     hX'X5B&P[hS ^)7CC)7VX5k"PZ B A
9     hX'X5B&P[hS ^)7CC)7VX5j"PZ B A
:     hX'X5B&P[hS ^)7CC)7VX5i"PZ B A
;     hX'X5B&P[hS ^)7CC)7VX5h"PZ B A
<     hX'X5B&P[hS ^)7CC)7VX5o"PZ B A
=     hX'X5B&P[hS ^)7CC)7VX5n"PZ B A
>     hX'X5B&P[hS ^)7CC)7VX5m"PZ B A
?     hX'X5B&P[hS ^)7CC)7VX5l"PZ B A

@     hX'X5B&P[h` ^)7CC)7VX5 "PZ-B-A
A     hX'X5B&P[h`!^)7CC)7VX5!#PZ-C-B
B     h['X5A&P[h`"^)7CC)7VX5" PZ-D-C
C     hX'X5B&P_h` ^)5GG)5VX5#"PZ-B-A
D     hX'X5B&P[h` ^)7CC)7VX5$"PZ-B-A
E     hX'X5B&P[h` ^)7CC)7VX5%"PZ-B-A
F     hX'X5B&P[h` ^)7CC)7VX5&"PZ-B-A
G     hX'X5B&P[h` ^)7CC)7VX5'"PZ-B-A
H     hX'X5B&P[h` ^)7CC)7VX5("PZ-B-A
I     hX'X5B&P[h` ^)7CC)7VX5)"PZ-B-A
J     hX'X5B&P[h` ^)7CC)7VX5*"PZ-B-A
K     hX'X5B&P[h` ^)7CC)7VX5+"PZ-B-A
L     hX'X5B&P[h` ^)7CC)7VX5,"PZ-B-A
M     hX'X5B&P[h` ^)7CC)7VX5-"PZ-B-A
N     hX'X5B&P[h` ^)7CC)7VX5."PZ-B-A
O     hX'X5B&P[h` ^)7CC)7VX5/"PZ-B-A
P     hj'X5B&`[[[[[[[[h` ^)7CC)7VX50"`ZZZZZZZZ-B-A
Q     hX'X5B&P[h` ^)7CC)7VX51"PZ-B-A
R     hX'X5B&P[h` ^)7CC)7VX52"PZ-B-A
S     hX'X5B&P[h` ^)7CC)7VX53"PZ-B-A
T     hX'X5B&P[h` ^)7CC)7VX54"PZ-B-A
U     hX'X5B&P[h` ^)7CC)7VX55"PZ-B-A
V     hX'X5B&P[h` _)?CC)?WX56"PZ B A
W     hX'X5B&P[h` ^)7CC)7VX57"PZ-B-A
X     _TYhe'WWWQWWWa5B&P[hSS^)7CC)7CC5_C5 @PZ u t
Y     hX'X5B&P[h` ^)7CC)7VX59"PZ-B-A
Z     _WTYhzBX5 @Phe'WPWQWWWa5B&P[hSS^)7CC)7X u t
[     hX'X5B&P_h` ^)5GG)5VX5;"PZ-B-A
\     hX'X5B&P[h` ^)7CC)7VX5<"PZ-B-A
]     hX'X5B&P[h` ^)7CC)7VX5="PZ-B-A
^     hX'X5B&P[h` _)?CC)?WX5>"PZ-B-A
_     hX'X5B&P[h` ^)7CC)7VX5?"PZ-B-A

`     hX'X5B&P[hS ^)7CC)7VX53"PZ B A
a     hX'X5B&P[hS ^)7CC)7VX52"PZ B A
b     hX'X5B&P[hS ^)7CC)7VX51"PZ B A
c     hX'X5B&P[hS ^)7CC)7VX50"PZ B A
d     hX'X5B&P[hS ^)7CC)7VX57"PZ B A
e     hX'X5B&P[hS ^)7CC)7VX56"PZ B A
f     hX'X5B&P[hS ^)7CC)7VX55"PZ B A
g     hX'X5B&P[hS ^)7CC)7VX54"PZ B A
h     _WWX5b'5B&P[WX5S P^)7CC)7VX5;"PZ B A
i     hX'X5B&P[hS ^)7CC)7VX5:"PZ B A
j     hX'X5B&P[hS ^)7CC)7VX59"PZ B A
k     hX'X5B&P[hS ^)7CC)7VX58"PZ B A
l     hX'X5B&P[hS ^)7CC)7VX5?"PZ B A
m     hX'X5B&P[hS ^)7CC)7VX5>"PZ B A
n     hX'X5B&P[hS ^)7CC)7VX5="PZ B A
o     hX'X5B&P[hS ^)7CC)7VX5<"PZ B A
p     hX'X5B&P[hS ^)7CC)7VX5#"PZ B A
q     hX'X5B&P[hS ^)7CC)7VX5""PZ B A
r     hX'X5B&P[hS ^)7CC)7VX5!"PZ B A
s     hX'X5B&P[hS ^)7CC)7VX5 "PZ B A
t     hX'X5B&P[hS ^)7CC)7VX5'"PZ B A
u     hX'X5B&P[hS ^)7CC)7VX5&"PZ B A
v     hX'X5B&P[hS ^)7CC)7VX5%"PZ B A
w     hX'X5B&P[hS ^)7CC)7VX5$"PZ B A
x     hX'X5B&P[hS ^)7CC)7VX5+"PZ B A
y     hX'X5B&P[hS ^)7CC)7VX5*"PZ B A
z     hX'X5B&P[hS ^)7CC)7VX5)"PZ B A
{     hX'X5B&P[hS ^)7CC)7VX5("PZ B A
|     hX'X5B&P[hS ^)7CC)7VX5/"PZ B A
}     hX'X5B&P[hS ^)7CC)7VX5."PZ B A
~     hX'X5B&P[hS ^)7CC)7VX5-"PZ B A


答:
><>, 59 bytes

```<code><v01'5'&0
+>    :@@:@$-?!v$&:d2*%'A'+o1+&1
 ^0;?=}:{:+2oa~<
</code>```

This increments one item for each letter, another for how many letters in the current row, and checks that one to a constant to halt the program after the last line of 53 characters

Try it online

Title: Alphabet triangle strikes again

Body:
><>, 59 bytes

<v01'5'&0
+>    :@@:@$-?!v$&:d2*%'A'+o1+&1
 ^0;?=}:{:+2oa~<

This increments one item for each letter, another for how many letters in the current row, and checks that one to a constant to halt the program after the last line of 53 characters

Try it online


答:
Python, <s>27</s> 22 bytes

lambda s:(max(s)-8)%39
```

<p>This requires the input to be a bytestring (Python 3) or a bytearray (Python 2 and 3).</p>

<p><em>Thanks to @AleksiTorhamo for golfing off 5 bytes!</em></p>

<p>Test it on Ideone.</p>

<h3>How it works</h3>

<p>We begin by taking the maximum of the string. This the code points of letters are higher than the code points of digits, this maximal character is also the maximal base 36 digit.</p>

<p>The code point of <strong>'0' – '9'</strong> are <strong>48 – 57</strong>, so we must subtract <strong>48</strong> from their code points to compute the corresponding digits, or <strong>47</strong> to compute the lowest possible base. Similarly, the code points of the letters <strong>'a' – 'z'</strong> are <strong>97 – 122</strong>. Since <strong>'a'</strong> represents the digit with value <strong>10</strong>, we must subtract <strong>87</strong> from their code points to compute the corresponding digits, or <strong>86</strong> to compute the lowest possible base. One way to achieve this is as follows.</p>

<p>The difference between <strong>97</strong> and <strong>58</strong> (<strong>':'</strong>, the character after <strong>'9'</strong>) is <strong>39</strong>, so taking the code points modulo <strong>39</strong> can achieve the subtraction. Since <strong>48 % 39 = 9</strong>, and the desired result for the character <strong>'0'</strong> is <strong>1</strong>, we first subtract <strong>8</strong> before taking the result modulo <strong>39</strong>. Subtracting first is necessary since otherwise <strong>'u' % 39 = 117 % 39 = 0</strong>.</p>

<pre class="lang-python prettyprint-override"><code>c    n    n-8    (n-8)%39
0    48    40     1
1    49    41     2
2    50    42     3
3    51    43     4
4    52    44     5
5    53    45     6
6    54    46     7
7    55    47     8
8    56    48     9
9    57    49    10
a    97    89    11
b    98    90    12
c    99    91    13
d   100    92    14
e   101    93    15
f   102    94    16
g   103    95    17
h   104    96    18
i   105    97    19
j   106    98    20
k   107    99    21
l   108   100    22
m   109   101    23
n   110   102    24
o   111   103    25
p   112   104    26
q   113   105    27
r   114   106    28
s   115   107    29
t   116   108    30
u   117   109    31
v   118   110    32
w   119   111    33
x   120   112    34
y   121   113    35
z   122   114    36
</code>```

Title: What base is this number in?

Body:
Python, <s>27</s> 22 bytes

lambda s:(max(s)-8)%39

This requires the input to be a bytestring (Python 3) or a bytearray (Python 2 and 3).

Thanks to @AleksiTorhamo for golfing off 5 bytes!

Test it on Ideone.

How it works

We begin by taking the maximum of the string. This the code points of letters are higher than the code points of digits, this maximal character is also the maximal base 36 digit.

The code point of '0' – '9' are 48 – 57, so we must subtract 48 from their code points to compute the corresponding digits, or 47 to compute the lowest possible base. Similarly, the code points of the letters 'a' – 'z' are 97 – 122. Since 'a' represents the digit with value 10, we must subtract 87 from their code points to compute the corresponding digits, or 86 to compute the lowest possible base. One way to achieve this is as follows.

The difference between 97 and 58 (':', the character after '9') is 39, so taking the code points modulo 39 can achieve the subtraction. Since 48 % 39 = 9, and the desired result for the character '0' is 1, we first subtract 8 before taking the result modulo 39. Subtracting first is necessary since otherwise 'u' % 39 = 117 % 39 = 0.

c    n    n-8    (n-8)%39
0    48    40     1
1    49    41     2
2    50    42     3
3    51    43     4
4    52    44     5
5    53    45     6
6    54    46     7
7    55    47     8
8    56    48     9
9    57    49    10
a    97    89    11
b    98    90    12
c    99    91    13
d   100    92    14
e   101    93    15
f   102    94    16
g   103    95    17
h   104    96    18
i   105    97    19
j   106    98    20
k   107    99    21
l   108   100    22
m   109   101    23
n   110   102    24
o   111   103    25
p   112   104    26
q   113   105    27
r   114   106    28
s   115   107    29
t   116   108    30
u   117   109    31
v   118   110    32
w   119   111    33
x   120   112    34
y   121   113    35
z   122   114    36


问:
Encode an image inside of the source
The golf challenge is to encode and compress the following image inside a source file.

To do this you need to write 3 functions: red, green, and blue which accept x/y coordinates of the image and return the corresponding R/G/B pixel value between 0-255.

Here is the C/C++ test code:

```<code>#include <stdio.h>
#include "your_file"
int main() {
  int x, y;
  for(y = 0; y < 32; ++y)
  for(x = 0; x < 32; ++x)
    printf("%i %i %i\n", red(x, y), blue(x, y), green(x, y));
}
</code>```

And the output: http://pastebin.com/A770ckxL (you can use this to generate your image data)

Rules & details:

This is a golf

Only your code/file is golfed - the test code is separate

The character set used is ASCII, however control characters in strings may only be used if escaped (like '\n' and '\r', etc)

Everything must be contained inside the source - no file loading

Your output must match the example output. This means loseless compression.

Languages:

The problem was written with C/C++ in mind, but I'm removing those restrictions. With that said, I'll still recommend using them.

答:
Python 3 (589 characters)

```<code>import base64,zlib
red,blue,green=(lambda x,y,i=i:b'\xed\x984+R@j\xf9\x8cWv\xc3`4k\0\0\0\xbaGGzP\xcfvNNLaX'[zlib.decompress(base64.decodebytes(b'eJxtkgGSxSAIQxWN1vtfeEkEbf9sOmMdn0EEAZjZuFprxSCZpGlzrZUcL+5/jIbk+Phj0lr4MU58zEneUt8kiMlbQ63VwyfV0ZOq1cxxqyBvJJCRX3Cm5X7c+LJqQ63+j8N5kXkEIKeiXJl2jLP3/sPf6j257QSbwvmwy9ZD5ED6wd2GF+99J5WZ2S13h39aOetObrdO/A8f/3AdasbWrBEYnkVnzkhs0XpkA8YopUw9H/glEJw4ps49huuRgOzf8n6Iq85PCtneDxfhUCQ+F3JvdileT8FyxdfkCfhI+9yRCSAMlHxt+HLX3pd8+/0mh0MT9fPF8Xg6EeB52sc+WQlyxgA3XJycfi+D84X9GNCUKZ+E/JGjyqqbYJtZpo1ZhsN5ybJxPbXlluSlJMcf++8TIA=='))[32*y+x]*3+i]for i in(0,1,2))
</code>```

Test code

```<code>for y in range(32):
    for x in range(32):
        print(red(x,y), blue(x,y), green(x,y))
</code>```

Based on solution from Dillon Cower

Title: Encode an image inside of the source

Body:
Python 3 (589 characters)

import base64,zlib
red,blue,green=(lambda x,y,i=i:b'\xed\x984+R@j\xf9\x8cWv\xc3`4k\0\0\0\xbaGGzP\xcfvNNLaX'[zlib.decompress(base64.decodebytes(b'eJxtkgGSxSAIQxWN1vtfeEkEbf9sOmMdn0EEAZjZuFprxSCZpGlzrZUcL+5/jIbk+Phj0lr4MU58zEneUt8kiMlbQ63VwyfV0ZOq1cxxqyBvJJCRX3Cm5X7c+LJqQ63+j8N5kXkEIKeiXJl2jLP3/sPf6j257QSbwvmwy9ZD5ED6wd2GF+99J5WZ2S13h39aOetObrdO/A8f/3AdasbWrBEYnkVnzkhs0XpkA8YopUw9H/glEJw4ps49huuRgOzf8n6Iq85PCtneDxfhUCQ+F3JvdileT8FyxdfkCfhI+9yRCSAMlHxt+HLX3pd8+/0mh0MT9fPF8Xg6EeB52sc+WQlyxgA3XJycfi+D84X9GNCUKZ+E/JGjyqqbYJtZpo1ZhsN5ybJxPbXlluSlJMcf++8TIA=='))[32*y+x]*3+i]for i in(0,1,2))

Test code

for y in range(32):
    for x in range(32):
        print(red(x,y), blue(x,y), green(x,y))

Based on solution from Dillon Cower


问:
Print the alphabet four times
The program must print the alphabet four times: first in the normal alphabetical order, second in the order of a qwerty keyboard, third in the order of a dvorak keyboard, and lastly in reverse alphabetical order. The output should resemble this:

```<code>abcdefghijklmnopqrstuvwxyz
qwertyuiopasdfghjklzxcvbnm
pyfgcrlaoeuidhtnsqjkxbmwvz
zyxwvutsrqponmlkjihgfedcba
</code>```

The output is not case-sensitive, and you can add or omit newlines or spaces wherever you wish.

The catch: the program must be less than 104 characters, or, in other words, smaller than the length of the alphabet times four.

I will accept the answer with the shortest code, unless I see something really clever or interesting that I am more impressed with.

EDIT: I will accept the shortest answer on Wednesday, 4/27/2011.

EDIT2: And the winner is (as usual) Golfscript in 64 chars! Second place, which is behind by only three chars, is also in Golfscript, with 67 chars, followed by Bash in third place with 72 chars.

But there were a few others I wanted to mention, such as this one, which, depending on your definition, only used 52 "characters", and this one where he wrote it in a language he created.

There were a few people who broke an unwritten rule and did not qualify, but I will mention them just for their way of thinking without the box.

答:
Jelly, 36 bytes

```<code>Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U
</code>```

Try it online!

Explanation:

```<code>Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U    |
Øa;                                     | alphabet
   Øq;                                  | list with all rows of the qwerty keyboard
      “pyfgcrlaoeuidhtnsqjkxbmwvz”;     | string
                                   U    | reverse
</code>```

Title: Print the alphabet four times

Body:
Jelly, 36 bytes

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U

Try it online!

Explanation:

Øa;Øq;“pyfgcrlaoeuidhtnsqjkxbmwvz”;U    |
Øa;                                     | alphabet
   Øq;                                  | list with all rows of the qwerty keyboard
      “pyfgcrlaoeuidhtnsqjkxbmwvz”;     | string
                                   U    | reverse


答:
Julia, 22 bytes

!s=(maximum(s)-'')%39
```

There's a BS character (0x08) between the quotes. Try it online!

Title: What base is this number in?

Body:
Julia, 22 bytes

!s=(maximum(s)-'')%39

There's a BS character (0x08) between the quotes. Try it online!


答:
Bash, <s>166</s> 133 bytes

```<code>a=2
while((l<$1));do if((b[a]))
then((c=b[a]));else((c=a,l++));echo $a;fi;((d=a+c))
while((b[d]));do((d+=c));done
((b[d]=c,a++));done
</code>```

(no trailing newline)

Pass primes count as $1

Title: Enterprise Quality Code Prime Sieve

Body:
Enterprise Quality Code!

TL;DR

Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen language only supports unary or other based output) separated by newlines (optional trailing linefeed).

You may post cracks at any time, but you must wait one hour after posting each initial bowled submission

Leading or trailing whitespace is not acceptable (except for the trailing newline)

An answer's score is the number of bytes in the answer. A user's score is the total number of bytes of all uncracked answers.

An answer gets cracked when another user posts an answer (in the same language) which is a permutation of any subset of the characters used in the original answer.

The user with the highest score will receive an accepted tick mark on his /her highest scoring post (although it doesnt really matter which specific post gets the tick)

The Inspiration for this challenge

At Pretty Good consultants there is a focus on writing "quality" verbose code that is sufficiently engineered. Your boss has decided to test you on your skills.

Consider the set of all programming languages in existence before the posting of this challenge. For this challenge there will technically be one individual "winner" in each language, however the boss will give a <s>promotion</s> accepted tick mark to only one answer based on your score.

Detailed Spec

The goal of this challenge is to receive an integer N strictly smaller than 2^8-1 and print the first N prime numbers (in less than 24 hours) separated by your platforms choice of new line (a trailing newline is optional). OEIS sequence A000040 in as many bytes as possible in as many languages as possible. However, note that others vying for the promotion will try to "help" you by golfing down your score. (Please note that your prime generation function should theoretically work for integer N inputs strictly smaller than 2^16-1 given enough time, the bounds for N have been reduced after realizing how slow some interpreters are (namely mine) hardcoding the list of primes is strictly forbidden)

Sample output for an input 11

```
2
3
5
7
11
13
17
19
23
29
31
```

How to participate

Pick any language X, but please avoid selecting a language which is just another version or derivative of another answer.
If there is no existing answer in language X than you will write a program (which must fit into a single post I.E it must be less than 30k characters) that solves this challenge.
The length in bytes of the source (in any reasonable preexisting textual encoding) will be added to your score. You must avoid using any unnecessary characters for reasons that will soon become apparent.

If language X already has been used to answer this question, then you must answer using any permutation of any proper subset of the characters used in the shortest answer (I.E take the shortest X answer and remove some (>=1) characters and optionally rearrange the resulting code). The previous holder of the shortest X answer will lose all of the bytes provided by his answer from his score, and the number of bytes of your submission will now be added to your score. The number of bytes golfed off gets "lost" forever.

Rules for Languages

You may only crack a submission by posting an answer in the same language (and version), but you are barred from posting an answer in language X if there exists a submission in a sufficiently similar language Y. Please do not abuse this rule posting an answer in a sufficiently similar language will receive disqualification.

Below is a leader board which removes answers with "cracked" (with any case) in their header.

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Bash, <s>166</s> 133 bytes

a=2
while((l<$1));do if((b[a]))
then((c=b[a]));else((c=a,l++));echo $a;fi;((d=a+c))
while((b[d]));do((d+=c));done
((b[d]=c,a++));done

(no trailing newline)

Pass primes count as $1


答:
JavaScript, <s>57</s> <s>50</s> 48 bytes

7 bytes saved thnks to @kamaroso97
2 bytes saved thanks to @Neil

```<code>n=>Math.max(...[...n].map(a=>parseInt(a,36))+1)
</code>```

Original answer:

```<code>n=>n.split``.map(a=>parseInt(a,36)).sort((a,b)=>b-a)[0]+1
</code>```

Title: What base is this number in?

Body:
JavaScript, <s>57</s> <s>50</s> 48 bytes

7 bytes saved thnks to @kamaroso97
2 bytes saved thanks to @Neil

n=>Math.max(...[...n].map(a=>parseInt(a,36))+1)

Original answer:

n=>n.split``.map(a=>parseInt(a,36)).sort((a,b)=>b-a)[0]+1