答:
JavaScript, 31 characters

```<code>function f(){alert(f+"f()")}f()
</code>```

Is this seriously the shortest JavaScript quine here?

Title: Golf you a quine for great good!

Body:
Using your language of choice, golf a quine.

A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't considered a legit quine either.

No error quines -- there is already a separate challenge for error quines.

Points for:

Smallest code (in bytes)

Most obfuscated/obscure solution

Using esoteric/obscure languages

Successfully using languages that are difficult to golf in

The following Stack Snippet can be used to get a quick view of the current score in each language, and thus to know which languages have existing answers and what sort of target you have to beat:

var QUESTION_ID=69;
var OVERRIDE_USER=98;

var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(index){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}
function commentUrl(index,answers){return"https://api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}
function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=!1;comment_page=1;getComments()}})}
function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)
answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}
getAnswers();var SCORE_REG=(function(){var headerTag=String.raw `h\d`
var score=String.raw `\-?\d+\.?\d*`
var normalText=String.raw `[^\n<>]*`
var strikethrough=String.raw `<s>${normalText}</s>|<strike>${normalText}</strike>|<del>${normalText}</del>`
var noDigitText=String.raw `[^\n\d<>]*`
var htmlTag=String.raw `<[^\n<>]+>`
return new RegExp(String.raw `<${headerTag}>`+String.raw `\s*([^\n,]*[^\s,]),.*?`+String.raw `(${score})`+String.raw `(?=`+String.raw `${noDigitText}`+String.raw `(?:(?:${strikethrough}|${htmlTag})${noDigitText})*`+String.raw `</${headerTag}>`+String.raw `)`)})();var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}
function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))
body='
'+c.body.replace(OVERRIDE_REG,'')+'
'});var match=body.match(SCORE_REG);if(match)
valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,})});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)
lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery(''+a.language+'').text().toLowerCase();languages[lang]=languages[lang]||{lang:a.language,user:a.user,size:a.size,link:a.link,uniq:lang}});var langs=[];for(var lang in languages)
if(languages.hasOwnProperty(lang))
langs.push(languages[lang]);langs.sort(function(a,b){if(a.uniq>b.uniq)return 1;if(a.uniq<b.uniq)return-1;return 0});for(var i=0;i<langs.length;++i)
{var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

  <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654">

Winners by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

 ```

Body:
JavaScript, 31 characters

function f(){alert(f+"f()")}f()

Is this seriously the shortest JavaScript quine here?


问:
A Fractional Year
My PPCG holiday is over :D

Intro

Fractional time is the year + (the value (minute of year) / number of minutes in the year).

Example calculation

You should assume that February always has 28 days and the year is always 365 days long.

Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstly, you find how many minutes were in 2013: 525600 minutes. Let's call this x.

Next, you want to find out how many minutes there have been since the start of 2013. A few quick calculations will tell you that the answer is 88894 minutes:

There have been 61 days since the start of the year, which times 1440 (number of minutes in a day) equals 87840 minutes. In 17 hours are 1020 minutes (17*60). Now, we can add 87840, 1020 and 34 minutes to equal 88894 minutes.

Let's call this y.

Finally, you divide y by x and add the year, resulting in 2013.16912 (to 5 decimal places).

Input

The date and time will be given as a single string. The string will be in the following format:

```<code>YYYY-MM-DD hh:mm
</code>```

The time will always be in 24 hour format and the year will always be in the range 1900-2050 inclusive.

Examples

```<code>Input:  2016-08-06 23:48
Output: 2016.59723

Input:  2013-03-03 17:34
Output: 2013.16912

Input:  1914-11-11 11:11
Output: 1914.86155
</code>```

If you are going for the bounty, either ping me in the comments or in The Nineteenth Byte.

Challenge

Calculate the given date and time as a fractional year.

Give all output to five decimal places (you may round in anyway you wish: flooring, ceiling, or true rounding). Shortest code wins.

Bounty

I am offering a 100 rep bounty for the shortest program which also accepts the date in fractional year format and returns the time in YYYY-MM-DD hh:mm format. In essence, your program (or function) has to act in the following way:

```<code>f('1914-11-11 11:11') => 1914.86155
f('1914.86155')       => 1914-11-11 11:11
</code>```

t-clausen.dk - 154 bytes

Neil - 183 bytes

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
TSQL, 63 bytes

This is a shorter version than my original answer, because my initial answer included calculation for leap year.

```<code>DECLARE @ VARCHAR(16) ='1914-11-11 11:11'

PRINT LEFT(YEAR(@)+DATEDIFF(mi,0,STUFF(@,1,4,1900))/525600.,10)
</code>```

Fiddle

The following sql can handle both input types

TSQL, 154 bytes

```<code>DECLARE @ VARCHAR(16) ='1914-11-11 11:11'--can be replaced with '1914.86155'

PRINT IIF(isdate(@)=1,LEFT(YEAR(@)+DATEDIFF(mi,0,STUFF(@,1,4,1900))/525600.,10),LEFT(@,4)+RIGHT(CONVERT(CHAR(16),DATEADD(mi,1*RIGHT(@,5)*5.256,0),20),12))
</code>```

Combined Fiddle 1

Combined Fiddle 2

ContentLicense: CC BY-SA 3.0

Title: A Fractional Year

Body:
TSQL, 63 bytes

This is a shorter version than my original answer, because my initial answer included calculation for leap year.

DECLARE @ VARCHAR(16) ='1914-11-11 11:11'

PRINT LEFT(YEAR(@)+DATEDIFF(mi,0,STUFF(@,1,4,1900))/525600.,10)

Fiddle

The following sql can handle both input types

TSQL, 154 bytes

DECLARE @ VARCHAR(16) ='1914-11-11 11:11'--can be replaced with '1914.86155'

PRINT IIF(isdate(@)=1,LEFT(YEAR(@)+DATEDIFF(mi,0,STUFF(@,1,4,1900))/525600.,10),LEFT(@,4)+RIGHT(CONVERT(CHAR(16),DATEADD(mi,1*RIGHT(@,5)*5.256,0),20),12))

Combined Fiddle 1

Combined Fiddle 2

ContentLicense: CC BY-SA 4.0


问:
Can you outgolf me? (Robbers section)

Robbers section

The cops section can be found here.

Challenge

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

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

You could outgolf the cop by doing the following:

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

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

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

Post this with the following header:

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

For example:

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

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

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

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

Rules

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

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

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

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

Note

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

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

答:
05AB1E, <s>13</s> 12 bytes, Adnan

```<code>µ•vÉ•DNìÙ{Q½
</code>```

Try it online

Title: Can you outgolf me? (Robbers section)

Body:
05AB1E, <s>13</s> 12 bytes, Adnan

µ•vÉ•DNìÙ{Q½

Try it online


答:
PowerShell v3+, 131 bytes

```<code>$t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear-1)*1440+$t.TimeOfDay.TotalMinutes-$a)/525600+$t.Year)
</code>```

Takes input $args[0] and converts it with Get-Date to store into .NET [datetime] format, stores into $t. Calculates whether February 29th exists, and sets $a so we subtract out that date's worth of minutes (if present).

Then we use the -format operator with a fixed-string specification of 5 decimal digits to run through the calculation. Uses built-ins to calculate the .DayOfYear and the .TotalMinutes of the given input, subtract $a if it's a leap year, divide by 525600 minutes total, and add on the input .Year.

Will complain (verbosely) to STDERR if February 29th doesn't exist (see examples below), but since STDERR is ignored by default, we don't worry about that. Also, note that PowerShell does banker's rounding by default.

Examples

```<code>PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '2016-08-06 23:48'
2016.59724

PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '2013-03-03 17:34'
Get-Date : Cannot bind parameter 'Date'. Cannot convert value "2-29-2013" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At C:\Tools\Scripts\golfing\fractional-year.ps1:7 char:36
+   $t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear- ...
+                                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetDateCommand

2013.16913

PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '1914-11-11 11:11'
Get-Date : Cannot bind parameter 'Date'. Cannot convert value "2-29-1914" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At C:\Tools\Scripts\golfing\fractional-year.ps1:7 char:36
+   $t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear- ...
+                                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetDateCommand

1914.86155
</code>```

Alternately, with leap years, 119 bytes

```<code>"{0:F5}"-f((($t=date $args[0]).DayOfYear-1+$t.TimeOfDay.TotalMinutes/1440)/(date "12-31-$($t.year)").DayOfYear+$t.Year)
</code>```

If we follow calendar settings, we can shave off a dozen bytes because we won't need to account for $a in the original code above. This allows us to move $t into the expression itself, and we'll explicitly calculate the .DayOfYear for December 31st. Otherwise, follows the same methodology.

Title: A Fractional Year

Body:
My PPCG holiday is over :D

Intro

Fractional time is the year + (the value (minute of year) / number of minutes in the year).

Example calculation

You should assume that February always has 28 days and the year is always 365 days long.

Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstly, you find how many minutes were in 2013: 525600 minutes. Let's call this x.

Next, you want to find out how many minutes there have been since the start of 2013. A few quick calculations will tell you that the answer is 88894 minutes:

There have been 61 days since the start of the year, which times 1440 (number of minutes in a day) equals 87840 minutes. In 17 hours are 1020 minutes (17*60). Now, we can add 87840, 1020 and 34 minutes to equal 88894 minutes.

Let's call this y.

Finally, you divide y by x and add the year, resulting in 2013.16912 (to 5 decimal places).

Input

The date and time will be given as a single string. The string will be in the following format:

```<code>YYYY-MM-DD hh:mm
</code>```

The time will always be in 24 hour format and the year will always be in the range 1900-2050 inclusive.

Examples

```<code>Input:  2016-08-06 23:48
Output: 2016.59723

Input:  2013-03-03 17:34
Output: 2013.16912

Input:  1914-11-11 11:11
Output: 1914.86155
</code>```

If you are going for the bounty, either ping me in the comments or in The Nineteenth Byte.

Challenge

Calculate the given date and time as a fractional year.

Give all output to five decimal places (you may round in anyway you wish: flooring, ceiling, or true rounding). Shortest code wins.

Bounty

I am offering a 100 rep bounty for the shortest program which also accepts the date in fractional year format and returns the time in YYYY-MM-DD hh:mm format. In essence, your program (or function) has to act in the following way:

```<code>f('1914-11-11 11:11') => 1914.86155
f('1914.86155')       => 1914-11-11 11:11
</code>```

t-clausen.dk - 154 bytes

Neil - 183 bytes

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
PowerShell v3+, 131 bytes

$t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear-1)*1440+$t.TimeOfDay.TotalMinutes-$a)/525600+$t.Year)

Takes input $args[0] and converts it with Get-Date to store into .NET [datetime] format, stores into $t. Calculates whether February 29th exists, and sets $a so we subtract out that date's worth of minutes (if present).

Then we use the -format operator with a fixed-string specification of 5 decimal digits to run through the calculation. Uses built-ins to calculate the .DayOfYear and the .TotalMinutes of the given input, subtract $a if it's a leap year, divide by 525600 minutes total, and add on the input .Year.

Will complain (verbosely) to STDERR if February 29th doesn't exist (see examples below), but since STDERR is ignored by default, we don't worry about that. Also, note that PowerShell does banker's rounding by default.

Examples

PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '2016-08-06 23:48'
2016.59724

PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '2013-03-03 17:34'
Get-Date : Cannot bind parameter 'Date'. Cannot convert value "2-29-2013" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At C:\Tools\Scripts\golfing\fractional-year.ps1:7 char:36
+   $t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear- ...
+                                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetDateCommand

2013.16913

PS C:\Tools\Scripts\golfing> .\fractional-year.ps1 '1914-11-11 11:11'
Get-Date : Cannot bind parameter 'Date'. Cannot convert value "2-29-1914" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At C:\Tools\Scripts\golfing\fractional-year.ps1:7 char:36
+   $t=date $args[0];$a=1440*!!(date "2-29-$($t.year)");"{0:F5}"-f((($t.DayOfYear- ...
+                                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetDateCommand

1914.86155

Alternately, with leap years, 119 bytes

"{0:F5}"-f((($t=date $args[0]).DayOfYear-1+$t.TimeOfDay.TotalMinutes/1440)/(date "12-31-$($t.year)").DayOfYear+$t.Year)

If we follow calendar settings, we can shave off a dozen bytes because we won't need to account for $a in the original code above. This allows us to move $t into the expression itself, and we'll explicitly calculate the .DayOfYear for December 31st. Otherwise, follows the same methodology.


问:
Stock Time Machine

Stock Time Machine

You've gained access to a dataset, tomorrowStocks, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past opening. Each index contains the price of the stock at that time.

```<code>// Assume the stock market opens at 9:30AM EDT
// tomorrowStocks[] contains the prices of your target stock.
// If the stock is $22 @ 10:30AM EDT
tomorrowStocks[60] == 22
</code>```

Output

Your task is to determine the best possible outcome of 1 purchase and 1 sale of 1 stock from the given dataset.

Gotchas

You must buy and sell exactly 1 stock.

You may not buy and sell in the same time slot.

You must buy before you sell.

Test Data

```<code>[1,2,3,4,5]    # 4
[1,99,2,105]   # 104
[99,1,99,100]  # 99
[99,1,1,2,1,3] # 2
[5,4,3,3,1]    # 0
[5,4,3,1]      # -1
[5,2,1]        # -1
[5,4,1]        # -1
[55,45,20,1]   # -10
[5,1]          # -4
[10,7,5,1]     # -2
[7]            # Invalid input -- assume size >= 2
</code>```

This is a code-golf; submit the shortest answer in your favorite language!

答:
ruby, 52 bytes

```<code>->a{b=[];(x=a.pop;b+=a.map{|v|x-v})while a[0];b.max}
</code>```

pops possible sell prices and look at all of the previous to find profit. Then gets max profit.

Title: Stock Time Machine

Body:
ruby, 52 bytes

->a{b=[];(x=a.pop;b+=a.map{|v|x-v})while a[0];b.max}

pops possible sell prices and look at all of the previous to find profit. Then gets max profit.


问:
Print a 10 by 10 grid of asterisks

Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

答:
Vitsy, 13 bytes

I'm late to the party. :c

```<code>a\[aa\['*']Z]
</code>```

Try it online!

Title: Print a 10 by 10 grid of asterisks

Body:
Vitsy, 13 bytes

I'm late to the party. :c

a\[aa\['*']Z]

Try it online!


问:
Convert xxd output to shellcode
Taking some output from xxd and turning it into usable shellcode by hand is no fun, so your job is to automate the process.

Rules

Your submission can be a function, lambda, script, or any reasonable equivalent of those. You may print the result, or if your submission is a function/lambda then you may also return it.

You program must take three arguments, the first being a string containing the output of xxd, ran with no arguments other than a filename, like this: xxd some_file. Here's an example of what the the first argument will look like:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Your need to take that middle section containing the bytes (the first 8 columns after the :) and turn it into shellcode by removing any whitespace, then putting a \x before each byte.

Here's what the output should be for the input above (ignoring any other arguments):

\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59

You can assume the first argument will always be a valid xxd output, ran with no arguments other than the filename.

Your output should also be a string where the backslashes are literal backslashes, not used as escape characters. So when I say "\x65", I'm not talking about the byte 0x65, or even the letter "A". In code, it would be the string "\x65".

The second argument specifies where in the xxd output the shellcode should start, and the third specifies where it should end. If the third argument is -1, it will end at the end of xxd output. The second and third argument will also always be non negative, except for when the third is -1

Here are some test cases:

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: 7, Argument 3: e (these are both strings representing hexadecimal numbers)

Output: \xc9\xcd\x80\xeb\x16\x5b\x31\xc0

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: 0, Argument 3: 2e

Output: \x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: a, Argument 3: -1

Output: \xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59

The code with the least bytes wins. The winner will be announced in seven days, on August 15, 2016 (but submissions after then are still appreciated).

Update

Congrats to @Adnan to winning the challenge!

答:
PowerShell v2+, <s>175</s> <s>157</s> <s>142</s> <s>133</s> 129 bytes

```<code>param($a,$b,$c)'\x'+(($z=$a-split"`n"|%{$_[10..48]-ne32-join''-split'(..)'-ne''})["0x$b"..(("0x$c",$z.count)[$c-eq-1])]-join'\x')
</code>```

Takes input $a, $b, $c, with $a as either a literal newline-separated string, or with the PowerShell `n character separating the lines. We set helper string $z as the heavily processed $a as follows --

First we -split on newlines, then, for each line |%{...}, we slice the middle section [10..48], use the -ne32 to remove spaces, -join it back together into one long string, -split it on every two characters (keeping the two characters), and -ne'' to remove the empty elements. This results in an array of two-element strings, like ('31','c0','b0'...).

We then slice into that array based on $b cast with the hexadecimal operator up to the value of $c. We need to use a pseudo-ternary here that accounts for whether $c is -1 or not. If it is, we choose the .count (i.e., the end element) of $z. Otherwise, we just prepend the 0x hexadecimal operator with $c in a string. Note that this is zero-indexed.

That array slice has its elements -joined together with a literal \x to form one string. That's prepended with another literal \x and the result is left on the pipeline. Printing is implicit.

Example

```<code>PS C:\Tools\Scripts\golfing> .\xxd-output.ps1 "00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY" a -1
\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59
</code>```

Title: Convert xxd output to shellcode

Body:
PowerShell v2+, <s>175</s> <s>157</s> <s>142</s> <s>133</s> 129 bytes

param($a,$b,$c)'\x'+(($z=$a-split"`n"|%{$_[10..48]-ne32-join''-split'(..)'-ne''})["0x$b"..(("0x$c",$z.count)[$c-eq-1])]-join'\x')

Takes input $a, $b, $c, with $a as either a literal newline-separated string, or with the PowerShell `n character separating the lines. We set helper string $z as the heavily processed $a as follows --

First we -split on newlines, then, for each line |%{...}, we slice the middle section [10..48], use the -ne32 to remove spaces, -join it back together into one long string, -split it on every two characters (keeping the two characters), and -ne'' to remove the empty elements. This results in an array of two-element strings, like ('31','c0','b0'...).

We then slice into that array based on $b cast with the hexadecimal operator up to the value of $c. We need to use a pseudo-ternary here that accounts for whether $c is -1 or not. If it is, we choose the .count (i.e., the end element) of $z. Otherwise, we just prepend the 0x hexadecimal operator with $c in a string. Note that this is zero-indexed.

That array slice has its elements -joined together with a literal \x to form one string. That's prepended with another literal \x and the result is left on the pipeline. Printing is implicit.

Example

PS C:\Tools\Scripts\golfing> .\xxd-output.ps1 "00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY" a -1
\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59


答:
Ruby: <s>90</s> <s>89</s> <s>87</s> <s>79</s> 63 bytes

-2 bytes thanks to @addison

-8 bytes thanks to @PiersMainwaring

->s,x,y{'\x'+s.scan(/(?<=.{9})\w\w(?=.* )/)[x.hex..y.hex]*'\x'}
```

See the tests on repl.it: https://repl.it/Cknc/5

Title: Convert xxd output to shellcode

Body:
Taking some output from xxd and turning it into usable shellcode by hand is no fun, so your job is to automate the process.

Rules

Your submission can be a function, lambda, script, or any reasonable equivalent of those. You may print the result, or if your submission is a function/lambda then you may also return it.

You program must take three arguments, the first being a string containing the output of xxd, ran with no arguments other than a filename, like this: xxd some_file. Here's an example of what the the first argument will look like:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Your need to take that middle section containing the bytes (the first 8 columns after the :) and turn it into shellcode by removing any whitespace, then putting a \x before each byte.

Here's what the output should be for the input above (ignoring any other arguments):

\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59

You can assume the first argument will always be a valid xxd output, ran with no arguments other than the filename.

Your output should also be a string where the backslashes are literal backslashes, not used as escape characters. So when I say "\x65", I'm not talking about the byte 0x65, or even the letter "A". In code, it would be the string "\x65".

The second argument specifies where in the xxd output the shellcode should start, and the third specifies where it should end. If the third argument is -1, it will end at the end of xxd output. The second and third argument will also always be non negative, except for when the third is -1

Here are some test cases:

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: 7, Argument 3: e (these are both strings representing hexadecimal numbers)

Output: \xc9\xcd\x80\xeb\x16\x5b\x31\xc0

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: 0, Argument 3: 2e

Output: \x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e

Argument 1:

```<code>00000000: 31c0 b046 31db 31c9 cd80 eb16 5b31 c088  1..F1.1.....[1..
00000010: 4307 895b 0889 430c b00b 8d4b 088d 530c  C..[..C....K..S.
00000020: cd80 e8e5 ffff ff2f 6269 6e2f 7368 4e58  ......./bin/shNX
00000030: 5858 5859 5959 59                        XXXYYYY
</code>```

Argument 2: a, Argument 3: -1

Output: \xeb\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x4e\x58\x58\x58\x58\x59\x59\x59\x59

The code with the least bytes wins. The winner will be announced in seven days, on August 15, 2016 (but submissions after then are still appreciated).

Update

Congrats to @Adnan to winning the challenge!

Body:
Ruby: <s>90</s> <s>89</s> <s>87</s> <s>79</s> 63 bytes

-2 bytes thanks to @addison

-8 bytes thanks to @PiersMainwaring

->s,x,y{'\x'+s.scan(/(?<=.{9})\w\w(?=.* )/)[x.hex..y.hex]*'\x'}

See the tests on repl.it: https://repl.it/Cknc/5


答:
Bash + coreutils + xxd, <s>73</s> <s>71</s> 69 bytes

printf \\x%s `xxd -r|xxd -p -s0x$1 -l$[(e=1+0x$2)?e-0x$1:-1]|fold -2`
```

Expects the hexdump on STDIN and start/end as command-line arguments.

This prints some warnings to STDERR, which is allowed by default.

Title: Convert xxd output to shellcode

Body:
Bash + coreutils + xxd, <s>73</s> <s>71</s> 69 bytes

printf \\x%s `xxd -r|xxd -p -s0x$1 -l$[(e=1+0x$2)?e-0x$1:-1]|fold -2`

Expects the hexdump on STDIN and start/end as command-line arguments.

This prints some warnings to STDERR, which is allowed by default.


答:
Perl, 114 bytes

```<code>($_,$a,$b)=@ARGV;s/^.*:|\S*$|\s//gm;@_=(m/../g);for(@_){s/^/\\x/}$"='';say substr"@_",4*$a,$b!=-1?4*($a+$b):2<<20;
</code>```

Arguments given on the command line as a quoted string followed by two numbers. The numbers are taken in decimal (I know hex was used in the examples but it wasn't specified in the post)

Technically only works on inputs with up to 2^21 bytes since perl's substring method is silly

Title: Convert xxd output to shellcode

Body:
Perl, 114 bytes

($_,$a,$b)=@ARGV;s/^.*:|\S*$|\s//gm;@_=(m/../g);for(@_){s/^/\\x/}$"='';say substr"@_",4*$a,$b!=-1?4*($a+$b):2<<20;

Arguments given on the command line as a quoted string followed by two numbers. The numbers are taken in decimal (I know hex was used in the examples but it wasn't specified in the post)

Technically only works on inputs with up to 2^21 bytes since perl's substring method is silly


问:
METAscii Code Golf
Introduction

Here at code colf SE, we appear to love meta-problems. Here, I've tried to compose a meta-problem that's an interesting, not-straightforward challenge.

Challenge

The answer code is allowed to read its own source code, but not allowed to use external resources.

All characters should be 5-lines tall. Characters used in the ascii representation are also not important, though they must be visible. Each visible character in the output will count as one byte, regardless of cheaty byte-values. Spaces used in the code are necessary, and may be only one byte wide if desired.

Lowest Byte Count of the output wins. Output must exist and include at least 1 visible byte.

Example Input and Output

Input:

For an example code:

```<code>print theanswer
</code>```

One possible answer is:

Output:

```<code>PPPP  RRRR  III N   N TTTTTT  TTTTTT H  H EEEE   AA  N   N  SSS  W     W EEEE RRRR
P   P R   R  I  NN  N   TT      TT   H  H E     A  A NN  N S     W     W E    R   R
PPPP  RRRR   I  N N N   TT      TT   HHHH EEE   AAAA N N N  SSS  W  W  W EEE  RRRR
P     R R    I  N  NN   TT      TT   H  H E     A  A N  NN     S  W W W  E    R R
P     R  RR III N   N   TT      TT   H  H EEEE  A  A N   N SSSS    W W   EEEE R  RR
</code>```

The alphabet used should consist of the following patterns, the characters used are not important:
:

```<code> AA  BBBB   CCC DDD  EEEE FFFF  GGG  H  H III     J K  K L    M   M N   N  OOO  PPPP   QQQ   RRRR   SSS  TTTTTT U   U V     V W     W X   X Y   Y ZZZZZ
A  A B   B C    D  D E    F    G     H  H  I      J K K  L    MM MM NN  N O   O P   P Q   Q  R   R S       TT   U   U V     V W     W  X X   Y Y     Z
AAAA BBBB  C    D  D EEE  FFF  G  GG HHHH  I      J KK   L    M M M N N N O   O PPPP  Q   Q  RRRR   SSS    TT   U   U  V   V  W  W  W   X     Y     Z
A  A B   B C    D  D E    F    G   G H  H  I  J   J K K  L    M   M N  NN O   O P     Q  Q   R R       S   TT   U   U   V V    W W W   X X    Y    Z
A  A BBBB   CCC DDD  EEEE F     GGG  H  H III  JJJ  K  K LLLL M   M N   N  OOO  P      QQ Q  R  RR SSSS    TT    UUU     V      W W   X   X   Y   ZZZZZ

 11   22  333  4  4 5555   6   77777  888   9999  000       //!!!  @@@   # #  %   %%  ^^   &&    ((  ))
111  2  2    3 4  4 5     6       7  8   8 9   9 0  00     // !!! @   @ #####    %%  ^  ^ &  &  ((    ))
 11    2   33  4444 555  6666    7    888   9999 0 0 0    //  !!! @  @@  # #    %%         &&& &((    ))
 11   2      3    4    5 6   6   7   8   8    9  00  0   //       @     #####  %%         & & & ((    ))
11l1 2222 333     4 555   666    7    888    9    000   //    !!!  @@@   # #  %%   %       &&&&  ((  ))   ____
</code>```

For other characters, the equivalent produced by this generator using the 'Alphabet' font will be acceptable.   If the output generated by the tool is more than 5 characters tall, use the central 5 characters for output.

Edit - I've allowed the program to read its own source code to possibly open this question up to interesting answers.

答:
Perl 5, 266

34721 bytes code, 177815 total bytes of output, 266 bytes of which are non-whitespace.

eval'                                                                                '=~s' +\t'chr length$&'ger```

<p>Based on the scoring confirmed by @Thomas Cleberg, something like this is likely optimal, but feels a little cheaty. This encodes a program that prints the desired output as space and tab characters, which are replaced with the result of running <code>ord</code> on the length of each run (spaces, terminated by a tab). To cater for this in the output, each tab is represented with two spaces (over the five lines) and all spaces are shown as described above.</p>

<p>TIO limits the output to 128KiB so you can't see it all there, but if you run this program locally, it should work as expected. Something like:</p>

<pre class="lang-sh prettyprint-override"><code>perl -M5.010 metascii-code-golf.pl > metascii-code-golf.txt
</code>```

and view metascii-code-golf.txt in a text editor with word-wrap disabled.

Try it online!

Title: METAscii Code Golf

Body:
Perl 5, 266

34721 bytes code, 177815 total bytes of output, 266 bytes of which are non-whitespace.

eval'                                                                                '=~s' +\t'chr length$&'ger

Based on the scoring confirmed by @Thomas Cleberg, something like this is likely optimal, but feels a little cheaty. This encodes a program that prints the desired output as space and tab characters, which are replaced with the result of running ord on the length of each run (spaces, terminated by a tab). To cater for this in the output, each tab is represented with two spaces (over the five lines) and all spaces are shown as described above.

TIO limits the output to 128KiB so you can't see it all there, but if you run this program locally, it should work as expected. Something like:

perl -M5.010 metascii-code-golf.pl > metascii-code-golf.txt

and view metascii-code-golf.txt in a text editor with word-wrap disabled.

<a href="https://tio.run/##7Z1BTsNADEXXvkUWiCwQqCy65AjcgA1CUYsUtVVbseTohDNQEdvfft1OYns8tseeH09P03neLsv09T6Pg/vP5BncytjKqXpl1s2IWEqrjB7POev1LSaTXkVsxDL7oehkGXc3lhokMfO@EdJSWKzFG7naZu8f7aBI8kcVmNtPtXKoJNJokYmoiaCpT5ME6O9yeD3jo1NLodd29RFbDESonvy3OVNwFZAmnVnnj6scNkTlCTkWLsNk876c7qsPpGuwSYnAYiiWJBFsS2drAXdKVsBrQSvKmVWSMzu@h8pBk93z//lkoOEDemhwkTzsaBEA60VxZYkBlcJTAKSOshj9ThjS87WtHPX5qLe1dHTi4DQxjzaIOl3Ahqp0@Gyr3yZFY45UWZzZ4YFa4sQofP4BcEMmcoscdMjESiTiYwR40i3qE7d1aIFsFm0i0dQVrS94TovTkLrtLVg1S4J1dI1rBeXowBGUQ6zYbXnDVsq5VSm9dGsCQIf6cqh0m9SjQuDKJGbD5EM9o@aasw4WWmJWHL83owUEwLjW8kOSccbDrJK/WGlVu@SNh0qIBZkkVe76XgGkFOciTa66SZIKg84EBCLaOOKfAsspGJTJjKiJ8m61PsxzX1QTz9LkpLG0a25OBmIu75i25bmysUBbs/Hl@zIOD2/X8WN/HubpsLvu7@7H3XRelp/j6fp5PFyWx9ft0@Z58ws" rel="nofollow noreferrer" title="Perl 5 – Try It Online">Try it online!


问:
Place a stone on an empty Go board
See also: Make a move on a Go board.

Task

Go is a board game where two players (Black and White) place stones on the intersections of grid lines on a 19×19 board. Black moves first — for example, on D4:

In this challenge, you must take a Go board coordinate like D4 as input, and output an ASCII representation of a board with the first move played at the given point.

Note that there is no column I. This is, historically, to reduce confusion with J and L.

This output consists of 19 lines, each containing 19 characters. The point with the stone on it is marked O. Empty points on the board are shown as ., except for the nine star points (at D4, D10, D16, K4, K10, K16, Q4, Q10, and Q16), which are marked *.

For example, given F5 as an input, your answer’s output must be:

```<code>...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
.....O.............
...*.....*.....*...
...................
...................
...................
</code>```

And given Q16 as input, your output must be:

```<code>...................
...................
...................
...*.....*.....O...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
</code>```

Rules

You may write a function that takes the coordinate as an argument, or a program that reads the coordinate from the command line or from STDIN.

You may choose to accept input either in lower-case or upper-case, but your answer doesn’t need to handle both.

The input is always a single string like a1 or T19, never a string + number or two strings.

If you write a full program, your answer must be printed to STDOUT as a string, optionally followed by a trailing newline. If your answer is a function, you may print to STDOUT, or return a string, or return an array/list of strings (rows), or return a two-dimensional array or nested list of characters.

This is code-golf. The shortest answer in bytes wins.

Title: Place a stone on an empty Go board

Body:
Ruby, <s>130</s> <s>128</s> 121 + 3 (-n flag) = 124 bytes

Switched -p to -n because puts b is one byte shorter than $_=b*$/

~/(.)(.+)/
b=(1..19).map{?.*19}
(a=3,9,15).map{|i|a.map{|j|b[i][j]=?*}}
b[19-$2.to_i][([*?A..?T]-[?I]).index$1]=?o
puts b


答:
C, <s>212</s> <s>195</s> <s>193</s> <s>181</s> <s>171</s> <s>132</s> <s>103</s> 98 bytes

Saved 1 byte thanks to @FryAmTheEggman, 5 bytes thanks to @orlp

Call f() with the position to play (must be capitalized), and it prints out the resulting board.

```<code>i;f(char*p){for(i=380;i--;)putchar(i%20?i^20*atoi(p+1)+64-*p+(*p>72)?i%6^4|i/20%6^3?46:42:79:10);}
</code>```

Try it on ideone.

Title: Place a stone on an empty Go board

Body:
See also: Make a move on a Go board.

Task

Go is a board game where two players (Black and White) place stones on the intersections of grid lines on a 19×19 board. Black moves first — for example, on D4:

In this challenge, you must take a Go board coordinate like D4 as input, and output an ASCII representation of a board with the first move played at the given point.

Note that there is no column I. This is, historically, to reduce confusion with J and L.

This output consists of 19 lines, each containing 19 characters. The point with the stone on it is marked O. Empty points on the board are shown as ., except for the nine star points (at D4, D10, D16, K4, K10, K16, Q4, Q10, and Q16), which are marked *.

For example, given F5 as an input, your answer’s output must be:

```<code>...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
.....O.............
...*.....*.....*...
...................
...................
...................
</code>```

And given Q16 as input, your output must be:

```<code>...................
...................
...................
...*.....*.....O...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
...................
...................
...*.....*.....*...
...................
...................
...................
</code>```

Rules

You may write a function that takes the coordinate as an argument, or a program that reads the coordinate from the command line or from STDIN.

You may choose to accept input either in lower-case or upper-case, but your answer doesn’t need to handle both.

The input is always a single string like a1 or T19, never a string + number or two strings.

If you write a full program, your answer must be printed to STDOUT as a string, optionally followed by a trailing newline. If your answer is a function, you may print to STDOUT, or return a string, or return an array/list of strings (rows), or return a two-dimensional array or nested list of characters.

This is code-golf. The shortest answer in bytes wins.

Body:
C, <s>212</s> <s>195</s> <s>193</s> <s>181</s> <s>171</s> <s>132</s> <s>103</s> 98 bytes

Saved 1 byte thanks to @FryAmTheEggman, 5 bytes thanks to @orlp

Call f() with the position to play (must be capitalized), and it prints out the resulting board.

i;f(char*p){for(i=380;i--;)putchar(i%20?i^20*atoi(p+1)+64-*p+(*p>72)?i%6^4|i/20%6^3?46:42:79:10);}

Try it on ideone.


答:
PHP 46 bytes

```<code><?php
for($i=-2;++$i<9;)echo "**********\n";?>
</code>```

I think this don't needs explanation.

Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

Body:
PHP 46 bytes

<?php
for($i=-2;++$i<9;)echo "**********\n";?>

I think this don't needs explanation.


答:
C (gcc), 132 128 109

```<code>i;m;f(char*s){for(i=380;i--;putchar(m?m^84-*s+(*s>73)|(i/20+1)^atoi(s+1)?m%6^4|i/20%6^3?46:42:79:10))m=i%20;}
</code>```

Ideone

A function that prints the board to STDOUT. Requires the letter coordinate to be capital. Printing in one loop seems to be slightly shorter than the previous nested loop approach.

Title: Place a stone on an empty Go board

Body:
C (gcc), 132 128 109

i;m;f(char*s){for(i=380;i--;putchar(m?m^84-*s+(*s>73)|(i/20+1)^atoi(s+1)?m%6^4|i/20%6^3?46:42:79:10))m=i%20;}

Ideone

A function that prints the board to STDOUT. Requires the letter coordinate to be capital. Printing in one loop seems to be slightly shorter than the previous nested loop approach.


问:
Can you outgolf me? (Cops section)

Cops section

The robbers section can be found here.

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

Challenge

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

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

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

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

Computes A005843, (offset = 0).

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

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

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

Computes A005843, (offset = 0).

Offset

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

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

More information can be found here.

Scoring

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

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

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

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

Rules

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

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

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

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

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

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

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

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

答:
Python (3.4.3), 77 bytes, score = 0.7272 (56/77) cracked

```<code>import math;lambda x: 1 if x==0 else (0 if ((math.sqrt(1+8*x)-1)/2)%1 else 1)
</code>```

Computes A010054, offset = 0

Title: Can you outgolf me? (Cops section)

Body:
Python (3.4.3), 77 bytes, score = 0.7272 (56/77) cracked

import math;lambda x: 1 if x==0 else (0 if ((math.sqrt(1+8*x)-1)/2)%1 else 1)

Computes A010054, offset = 0


答:
Python, <s>148</s> <s>145</s> <s>136</s> <s>130</s> <s>121</s> <s>119</s> 116 Bytes

-3 Bytes thanks to @RootTwo

```<code>lambda x,r=range(19):[[".*o"[[i%6==j%6==3,2][j==ord(x[0])-(x>"I")-65and-~i==int(x[1:])]]for j in r]for i in r[::-1]]
</code>```

anonymous lambda function, takes input of the form "A1" (big letters) and outputs a list of lists of chars (len==1 strings in Python)

Title: Place a stone on an empty Go board

Body:
Python, <s>148</s> <s>145</s> <s>136</s> <s>130</s> <s>121</s> <s>119</s> 116 Bytes

-3 Bytes thanks to @RootTwo

lambda x,r=range(19):[[".*o"[[i%6==j%6==3,2][j==ord(x[0])-(x>"I")-65and-~i==int(x[1:])]]for j in r]for i in r[::-1]]

anonymous lambda function, takes input of the form "A1" (big letters) and outputs a list of lists of chars (len==1 strings in Python)


Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

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

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

You could outgolf the cop by doing the following:

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

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

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

Post this with the following header:

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

For example:

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

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

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

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

Rules

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

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

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

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

Note

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

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
Python 3, <s>77</s> 40 bytes, Joe

g=lambda n,c=1:+(n==0 or n>0<g(n-c,c+1))


答:
MATL, 33 bytes

```<code>'*O.'19: 6\4=&*Hj1&)Uw64-t8>-&(P)
</code>```

Try it online!

Explanation

```<code>'*O.'    % Push string with needed characters. Will be indexed into
19:      % Push numeric vector [1 2 ... 19]
6\4=     % 1 for values that equal 4 mod 6, 0 for the rest
&*       % Multiply by transposed version of itself with broadcast. This gives
         % the 19×19 board with 0 instead of '.' and 1 instead of '*'
H        % Push 2. This will correspond to 'O' (stone)
j        % Input string, such as 'Q16'
1&)      % Split into its first char ('Q') and then the rest ('16')
U        % Convert to number (16)
w        % Swap, to move 'Q' to top
64-      % Subtract 64. Thus 'A' gives 1, 'B' gives 2 etc
t8>-     % Duplicate. Subtract 1 if it exceeds 8. This corrects for missing 'I'
&(       % Fill a 2 at coordinates given by the number and the letter
P        % Flip upside down, because matrix coordinates start up, not down
)        % Index the string '*O.' with the 19×19 array containing 0,1,2.
         % Implicitly display
</code>```

Title: Place a stone on an empty Go board

Body:
MATL, 33 bytes

'*O.'19: 6\4=&*Hj1&)Uw64-t8>-&(P)

Try it online!

Explanation

'*O.'    % Push string with needed characters. Will be indexed into
19:      % Push numeric vector [1 2 ... 19]
6\4=     % 1 for values that equal 4 mod 6, 0 for the rest
&*       % Multiply by transposed version of itself with broadcast. This gives
         % the 19×19 board with 0 instead of '.' and 1 instead of '*'
H        % Push 2. This will correspond to 'O' (stone)
j        % Input string, such as 'Q16'
1&)      % Split into its first char ('Q') and then the rest ('16')
U        % Convert to number (16)
w        % Swap, to move 'Q' to top
64-      % Subtract 64. Thus 'A' gives 1, 'B' gives 2 etc
t8>-     % Duplicate. Subtract 1 if it exceeds 8. This corrects for missing 'I'
&(       % Fill a 2 at coordinates given by the number and the letter
P        % Flip upside down, because matrix coordinates start up, not down
)        % Index the string '*O.' with the 19×19 array containing 0,1,2.
         % Implicitly display


答:
MATLAB, 135 bytes

A first attempt, nothing clever, just to see how much better others can do:

```<code>function go(a)
b=repmat('.',19);
b(4:6:end,4:6:end)='*';
a=sscanf(a,'%c%d');
a(1)=a(1)-64;
if a(1)>8
a(1)=a(1)-1;
end
b(20-a(2),a(1))='0'
</code>```

Usage:

```<code>go('T19')
</code>```

Title: Place a stone on an empty Go board

Body:
MATLAB, 135 bytes

A first attempt, nothing clever, just to see how much better others can do:

function go(a)
b=repmat('.',19);
b(4:6:end,4:6:end)='*';
a=sscanf(a,'%c%d');
a(1)=a(1)-64;
if a(1)>8
a(1)=a(1)-1;
end
b(20-a(2),a(1))='0'

Usage:

go('T19')


问:
Write a VIC cipher decoder
You've received a coded message from your ally that you know is encoded with the VIC cipher. As you know that the VIC cipher is notoriously convoluted, you want to write a program that will decode the VIC cipher but is small enough to hide from the enemy if you are captured, and thus uses as few bytes as possible.

Your instructions are as follows:

The information you have

The encoded message. For this example, we'll use the message we encrypted in the "VIC cipher encoder" challenge: 71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641 70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521

A keyword with the most common letters of your chosen alphabet.

A key phrase, such a quote or song lyric

A date (or another number that is six digits or more)

A personal agent number

In practice, these last four should be agreed upon beforehand by the sender and the recipient, including whether the agent number of the sender or the recipient is used in encoding.

What you and your ally agreed to use in your encoding is the following: the keyword SENATORI, the key phrase "The first principle is that you must not fool yourself — and you are the easiest person to fool.", and the date 3172016, and the recipient's agent number, 9.

Summary of steps

Derive the intermediate keys for use in the following steps and extract the message identifier from the encoded message.

Construct and apply the second (disrupted) transposition table in reverse.

Construct and apply the first transposition table in reverse.

Construct and apply the straddling checkerboard in reverse.

Finalize the decoding removing nulls and by starting the message at the "message begin" mark.

Submechanisms

Two more things to explain before we get into the meat of the matter: the processes of chain addition and sequentializing.

Chain addition, also known as a lagged Fibonacci generator, works by taking a starting digit sequence, adding the first two digits without adding and appending the result to the end. For example:

```<code>79081
7 + 9 = 6

790816
9 + 0 = 9

7908169
0 + 8 = 8

79081698
8 + 1 = 9

790816989
1 + 6 = 7

7908169897
... and so on
</code>```

Sequentializing is essentially taking a sequence of letters or digits and labeling them by their alphabetical/numerical order. Duplicates are labelled left to right. For example:

```<code>E X A M P L E
    0         A
1   0       2 Es
1   0     3 2 L
1   0 4   3 2 M
1   0 4 5 3 2 P
1 6 0 4 5 3 2 X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      1              2                    0s
      1              2                 3  1
      1           4  2                 3  2
5  6  1           4  2                 3  3s
5  6  1        7  4  2  8        9     3  4s
5  6  1 10     7  4  2  8    11  9     3  5s
5  6  1 10     7  4  2  8 12 11  9     3  7
5  6  1 10 12  7  4  2  8 12 11  9 14  3  8s
</code>```

I use zero-indexing here, but index however you like.

1. Intermediate Keys

Firstly, you need to retrieve the message identifier M from the message. The last digit of the date 3172016 is 6, so you know that the message identifier was placed sixth from the last in the message.

```<code>The encoded message =
  71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
  70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521
Message id = 47921
</code>```

Split the first 20 letters of the key phrase into two groups of 10 and sequentialize each individually, which we will call S1 and S2.

```<code>    THEFIRSTPR
S1: 8201357946

    INCIPLEIST
S2: 2603751489
</code>```

Subtract, without borrowing, the first five digits of the key date 3172016 from M:

```<code>M      47921
date - 31720
     = 16201
</code>```

Chain add the result until you have ten digits:

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

Add these digits to S1, without carrying, to obtain G:

```<code>     1620178218
S1 + 8201357946
G  = 9821425154
</code>```

Above S2, write the sequence 0123456789. Locate each digit of G in the sequence 0123456789 and replace it with the digit directly below it in S2. The result is T.

```<code>   0123456789
S2 2603751489

G  9821425154
T  9806705657
</code>```

Use chain addition to expand T by 50 digits. These digits, in five rows of ten, form the U block.

```<code>T  9806705657
U  7863751124
   5490262369
   9392885958
   2210634430
   4316978734
</code>```

The last two non-equal digits of the U block are individually added to the agent's personal number to give the widths of the two transpositions, p and q.

```<code>9 + 3 = 12  (p, first transposition width)
9 + 4 = 13  (q, second transposition width)
</code>```

Sequentialize T and use this sequence to copy off the columns of the U block, from top to bottom, into a new row of digits, V.

```<code>E X A M P L E
    0         A
1   0       2 Es
1   0     3 2 L
1   0 4   3 2 M
1   0 4 5 3 2 P
1 6 0 4 5 3 2 X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      1              2                    0s
      1              2                 3  1
      1           4  2                 3  2
5  6  1           4  2                 3  3s
5  6  1        7  4  2  8        9     3  4s
5  6  1 10     7  4  2  8    11  9     3  5s
5  6  1 10     7  4  2  8 12 11  9     3  7
5  6  1 10 12  7  4  2  8 12 11  9 14  3  8s
</code>```0

Sequentialize the first p digits to get the key for the first transposition K1, and the following q digits for the key for the second K2.

```<code>E X A M P L E
    0         A
1   0       2 Es
1   0     3 2 L
1   0 4   3 2 M
1   0 4 5 3 2 P
1 6 0 4 5 3 2 X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      1              2                    0s
      1              2                 3  1
      1           4  2                 3  2
5  6  1           4  2                 3  3s
5  6  1        7  4  2  8        9     3  4s
5  6  1 10     7  4  2  8    11  9     3  5s
5  6  1 10     7  4  2  8 12 11  9     3  7
5  6  1 10 12  7  4  2  8 12 11  9 14  3  8s
</code>```1

Finally, sequentialize the final row of the U block to get C, the column headers for the straddling checkerboard:

```<code>E X A M P L E
    0         A
1   0       2 Es
1   0     3 2 L
1   0 4   3 2 M
1   0 4 5 3 2 P
1 6 0 4 5 3 2 X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      1              2                    0s
      1              2                 3  1
      1           4  2                 3  2
5  6  1           4  2                 3  3s
5  6  1        7  4  2  8        9     3  4s
5  6  1 10     7  4  2  8    11  9     3  5s
5  6  1 10     7  4  2  8 12 11  9     3  7
5  6  1 10 12  7  4  2  8 12 11  9 14  3  8s
</code>```2

2. Reverse the Second Transposition

We fill a transposition table with the message by columns in order of the column headings, K2. The message has 110 digits in 13 columns, leaves 8 full rows and six digits in a final row.

```<code>71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521

starts off with

K2   8  7 12  2 10  9  4  5  6  0  3  1 11

              8                 7     4
              6                 1     2
              1                 4     7
              9                 3     1
              0                 1     1
              4                 1     9
              1                 4     2
              8                 8     5
              5

resulting in

K2   8  7 12  2 10  9  4  5  6  0  3  1 11

     0  6  0  8  2  6  4  2  8  7  2  4  9
     2  4  6  6  7  4  5  8  0  1  2  2  4
     5  1  4  1  1  5  4  2  2  4  6  7  9
     2  7  2  9  2  2  9  6  1  3  1  1  4
     4  0  1  0  8  2  9  1  8  1  4  1  4
     4  1  4  4  3  4  2  3  9  1  1  9  4
     8  4  5  1  2  3  4  3  3  4  4  2  3
     2  0  2  8  2  9  3  4  8  8  7  5  8
     0  4  1  5  6  8
</code>```

Taking the rows one at a time, and stopping at the disrupted parts

```<code>K2   8  7 12  2 10  9  4  5  6  0  3  1 11

                                7  2  4  9  stop at 0
                                   2  2  4
                                      7  9
                                         4
                                            go all the way down until you run out of row
     4  1  4  4  3  4  2  3  9  1  1  9  4
     8  4  5  1  2  3  4  3  3  4  4  2  3
     2  0  2  8  2  9  3  4  8  8  7  5  8
     0  4  1  5  6  8

Result so far: 060826428 2466745801 51411542246 272922961311 4010829181414
</code>```

The continue to avoid disrupted bits until the end...

```<code>K2   8  7 12  2 10  9  4  5  6  0  3  1 11

                                7  2  4  9  stop at 0
                                   2  2  4
                                      7  9
                                         4
                                            go all the way down until you run out of row
                                      9  4  restart until 1
                                         3

              5  6  8                       restart until 2

Result so far: 060826428 2466745801 51411542246 272922961311 4010829181414
41443423911 845123433442 2028293488758 041
</code>```

Then grab the rest:

```<code>Result: 060826428 2466745801 51411542246 272922961311 4010829181414
41443423911 845123433442 2028293488758 041 7249 224 79 4 94 3 568
</code>```

3. Reverse the First Transposition

As before, create the transposition table by filling in columns in order of the column headings, K1. With 110 digits and 12 columns, we have 9 full rows and 2 digits in a final row.

```<code>K1   6 10 11  0  1  5  7  9  4  8  2  3

              0
              6
              0
              8
              2
              6
              2
              4
              8

resulting in

K1   6 10 11  0  1  5  7  9  4  8  2  3

     4  0  7  0  2  0  1  2  9  3  1  2
     4  4  9  6  4  8  1  9  6  3  5  4
     1  1  4  0  6  2  8  3  1  4  1  6
     4  7  9  8  6  9  4  4  3  4  4  2
     4  2  4  2  7  1  5  8  1  2  1  7
     3  4  3  6  4  8  1  8  1  2  1  2
     4  9  5  4  5  1  2  7  4  0  5  9
     2  2  6  2  8  4  3  5  0  2  4  2
     3  2  8  8  0  1  4  8  1  8  2  2
     9  4
</code>```

Reading of the rows in order, with no disruptions this time, we obtain:

```<code>407020129312 449648196354 114062831416 479869443442 424271581217
343648181212 495451274059 226284350242 328801481822 94
</code>```

4. Reversing the Straddling Checkerboard

The heading for the checkerboard is C = 3105968724. We fill in the first row with the keyword SENATORI and the rest of the alphabet is filled in as follows:

```<code>  3 1 0 5 9 6 8 7 2 4
  S E N A T O R I
2 B D G J L P U W Y .
4 C F H K M Q V X Z #
</code>```

To decode we simply look up the each number in the checkerboard as we read them. First, 4 must be a row heading, so we move to 40 which is H. 7 is I. 0 is N. 2 is a row heading, so we move to 20 which is G. Continuing in this way, we reveal the original message:

```<code>The encoded message =
  71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
  70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521
Message id = 47921
</code>```0

The question mark at the end is from the final 4. As this is a row heading, there should be another number after this, but this is end of the message. Thus, we conclude that this is a null, and discard it.

```<code>The encoded message =
  71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
  70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521
Message id = 47921
</code>```1

5. Finalize the Decryption

The program does not need to reinsert spaces and punctuation, but if there is a set convention for where the message originally began (here we used ..), cycle through the message until the message beginning is at the beginning.

The final decrypted message is:

```<code>The encoded message =
  71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
  70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521
Message id = 47921
</code>```2

Notes for this challenge:

You are given a minimum of five inputs: the message, the letter keyword, the key phrase, the date, and a personal number.

You may assume all inputs are valid, with the correct number of digits and letters (5-digit message identifier, at least 20 digits for the key phrase, and so on). You may assume that the keyword and key phrase have already had all punctuation and spaces removed except for those that you allow in your version, and that numbers are denoted with number signs correctly.

The encoded message should be either a string of space-separated five-digit groups, a list of five-digit integers, one long string without spaces, or something similar.

I used zero-indexing and 0123456789 in my example. You may use 1-indexing and 1234567890, or some other system in your answer, as long as you specify what you used.

As always, if the problem is unclear, please let me know. Good luck and good golfing!

答:
Python 3, 1446 bytes

This is even longer than my encoder. Golfing suggestions very welcome.

As this is a counter to my encoder, this also uses the uppercase Latin alphabet with additional characters . and #. The decoder also uses 0-indexing and 0123456789 when converting g to t.

I=int;L=list;E=len;R=range;B=str;J=''.join
def H(s,e):
 for i in R(e-E(s)):s+=chr(48+(ord(s[i])+ord(s[i+1]))%32%10)
 return s
def Q(s):
 r=[0]*E(s);s=L(s);a=R(E(s))
 for z in a:b=min(a,key=lambda i:s[i]);r[b]=z;s[b]="~"
 return r
def T(x,k):
 u=E(x);v=E(k);g=R(v);c=[x[i::v]for i in g];s=[0]*v
 for f in g:s[k[f]]=c[f]
 return J(s)
def U(x,k,d=0):
 c=[];w=[];u=E(x);v=E(k);g=R(v);n=u//v+1;l=u%v or v;e=0
 for j in g:c+=[[]]
 for j in g:i=k.index(j);c[i]+=L(x[e:e+n-(i>=l)]);e+=n-(i>=l)
 for z in R(n):
  w+=[[]]
  for j in c:w[z]+=j[z:z+1]
 if d:
  u=[];r=y=0;i=k.index(y)
  while r<n:
   u+=w[r][:i];w[r]=w[r][i:];i+=1;r+=1
   if i>v:y=(y+1)%v;i=k.index(y)
  for j in w:u+=j
  return J(u)
 else:return J(J(i)for i in w)
def C(m,s,w):
 t={s[-2:]:".",s[-1]*2:"#"};x=64;r='';j=z=n=0;e=-1;h=''
 while x<90:
  x+=1;v=chr(x)
  if v in w:t[s[w.index(v)]]=v
  else:t[s[z-2]+s[j]]=v;j+=z;z=(z+1)%2
 for j in R(E(m)):
  if(e>=0)*(j<e+2):continue
  else:e=-1
  if n:e=m.index(s[-1]*2,j+1);r+=m[j:e]+"#";n=0
  else:
   k=m[j]
   if h:r+=t[h+k];n=t[h+k]=="#";h=''
   elif k in s[:-2]:r+=t[k]
   else:h=k
 b=r.index("..")+2
 return r[b:]+r[:b]
def D(m,w,P,d,A):j=-I(d[-1]);m=m.split();M=m[j];m=J(m[:j]+m[j+1:]);t=J(B(Q(P[10:20])[I(J(B((I(H(J(B((I(M[i])-I(d[i]))%10)for i in R(5)),10)[i])+Q(P[:10])[i])%10)for i in R(10))[i])])for i in R(10));u=H(t,60)[10:];p=A+I(u[-2]);v=T(u,Q(t));return C(U(U(m,Q(v[p:p+A+I(u[-1])]),1),Q(v[:p])),J(B(i)for i in Q(u[40:])),w)
```

<p><strong>Ungolfing:</strong></p>

<pre class="lang-python prettyprint-override"><code>def chain_add(seq, end):
    for i in range(end - len(seq)):
        seq += chr(48+(ord(seq[i])+ord(seq[i+1]))%32%10)
    return seq

def sequent(seq):
    res = [0]*len(seq);seq=list(seq)
    for z in range(len(seq)):
        b = min(range(len(seq)),key=lambda i:seq[i])
        res[b] = z
        seq[b] = "~"
    return res

def transpose(text, keys):
    columns = ['']*len(keys)
    for t in range(len(text)):
        columns[t%len(keys)] += text[t]
    res = [0]*len(keys)
    for index in range(len(keys)):
        res[keys[index]] = columns[index]
    return''.join(res)

def untranspose(text, keys, disrupt=False):
    columns = []
    for j in range(len(keys)):
        columns += [[]]
    num_rows, len_last = divmod(len(text),len(keys))
    num_rows += 1
    if len_last == 0:
        len_last = len(keys)
    text_index = 0
    for j in range(len(keys)):
        ind = keys.index(j)
        columns[ind] += list(text[text_index:text_index+num_rows-(ind>=len_last)])
        text_index += num_rows-(ind>=len_last)
    rows = []
    for k in range(num_rows):
        rows += [[]]
        for j in columns:
            rows[k] += j[k:k+1]
    if disrupt:
        undisrupt = []
        current_row = 0
        stop_key = 0
        stop_index = keys.index(stop_key)
        while current_row < num_rows:
            undisrupt += rows[current_row][:stop_index]
            rows[current_row] = rows[current_row][stop_index:]
            stop_index += 1
            current_row += 1
            if stop_index > len(keys):
                stop_key = (stop_key + 1) % len(keys)
                stop_index = keys.index(stop_key)
        for i in rows:
            undisrupt += i
        return ''.join(undisrupt)
    else:
        return ''.join(''.join(i) for i in rows)

def uncheckerboard(message, seq, word):
    trans = {seq[-2:]:".", seq[-1]*2:"#"};x=64;res='';j=z=0
    while x<90:
        x += 1
        v = chr(x)
        if v in word:
            trans[seq[word.index(v)]] = v
        else:
            trans[seq[z-2] + seq[j]] = v
            j += z
            z = (z+1) % 2
    num = False
    end = -1
    h = ''
    for j in range(len(message)):
        if end>=0 and j<end+2:
            continue
        else:
            end = -1
        if num:
            end = message.index(seq[-1]*2,j+1)
            res += message[j:end]+"#"
            num = 0
        else:
            k = message[j]
            if h:
                res += trans[h+k]
                if trans[h+k] == "#":
                    num = 1
                h = ''
            elif k in seq[:-2]:
                res += trans[k]
            else:
                h = k
    begin = res.index("..") + 2
    return res[begin:] + res[:begin]

def decode(message, keyword, phrase, date, agent):
    mkey = -int(date[-1])
    message = message.split()
    m_id = message[mkey]
    message = ''.join(message[:mkey] + message[mkey+1:])

    s1 = sequent(phrase[:10])
    s2 = sequent(phrase[10:20])
    b = ''.join(str((int(m_id[i])-int(date[i]))%10) for i in range(5))
    a = chain_add(b, 10)
    g = ''.join(str((int(a[i])+int(s1[i]))%10) for i in range(10))
    t = ''.join(str(s2[int(g[i])]) for i in range(10))
    u = chain_add(t,60)[10:]
    p = agent+int(u[-2])
    q = agent+int(u[-1])
    seqT = sequent(t)
    v = transpose(u,seqT)
    k1 = sequent(v[:p])
    k2 = sequent(v[p:p+q])
    c = ''.join(str(i)for i in sequent(u[40:]))
    z = untranspose(message,k2,1)
    y = untranspose(z,k1)
    x = uncheckerboard(y,c,keyword)
    return x
</code>```

Title: Write a VIC cipher decoder

Body:
Python 3, 1446 bytes

This is even longer than my encoder. Golfing suggestions very welcome.

As this is a counter to my encoder, this also uses the uppercase Latin alphabet with additional characters . and #. The decoder also uses 0-indexing and 0123456789 when converting g to t.

I=int;L=list;E=len;R=range;B=str;J=''.join
def H(s,e):
 for i in R(e-E(s)):s+=chr(48+(ord(s[i])+ord(s[i+1]))%32%10)
 return s
def Q(s):
 r=[0]*E(s);s=L(s);a=R(E(s))
 for z in a:b=min(a,key=lambda i:s[i]);r[b]=z;s[b]="~"
 return r
def T(x,k):
 u=E(x);v=E(k);g=R(v);c=[x[i::v]for i in g];s=[0]*v
 for f in g:s[k[f]]=c[f]
 return J(s)
def U(x,k,d=0):
 c=[];w=[];u=E(x);v=E(k);g=R(v);n=u//v+1;l=u%v or v;e=0
 for j in g:c+=[[]]
 for j in g:i=k.index(j);c[i]+=L(x[e:e+n-(i>=l)]);e+=n-(i>=l)
 for z in R(n):
  w+=[[]]
  for j in c:w[z]+=j[z:z+1]
 if d:
  u=[];r=y=0;i=k.index(y)
  while r<n:
   u+=w[r][:i];w[r]=w[r][i:];i+=1;r+=1
   if i>v:y=(y+1)%v;i=k.index(y)
  for j in w:u+=j
  return J(u)
 else:return J(J(i)for i in w)
def C(m,s,w):
 t={s[-2:]:".",s[-1]*2:"#"};x=64;r='';j=z=n=0;e=-1;h=''
 while x<90:
  x+=1;v=chr(x)
  if v in w:t[s[w.index(v)]]=v
  else:t[s[z-2]+s[j]]=v;j+=z;z=(z+1)%2
 for j in R(E(m)):
  if(e>=0)*(j<e+2):continue
  else:e=-1
  if n:e=m.index(s[-1]*2,j+1);r+=m[j:e]+"#";n=0
  else:
   k=m[j]
   if h:r+=t[h+k];n=t[h+k]=="#";h=''
   elif k in s[:-2]:r+=t[k]
   else:h=k
 b=r.index("..")+2
 return r[b:]+r[:b]
def D(m,w,P,d,A):j=-I(d[-1]);m=m.split();M=m[j];m=J(m[:j]+m[j+1:]);t=J(B(Q(P[10:20])[I(J(B((I(H(J(B((I(M[i])-I(d[i]))%10)for i in R(5)),10)[i])+Q(P[:10])[i])%10)for i in R(10))[i])])for i in R(10));u=H(t,60)[10:];p=A+I(u[-2]);v=T(u,Q(t));return C(U(U(m,Q(v[p:p+A+I(u[-1])]),1),Q(v[:p])),J(B(i)for i in Q(u[40:])),w)

Ungolfing:

def chain_add(seq, end):
    for i in range(end - len(seq)):
        seq += chr(48+(ord(seq[i])+ord(seq[i+1]))%32%10)
    return seq

def sequent(seq):
    res = [0]*len(seq);seq=list(seq)
    for z in range(len(seq)):
        b = min(range(len(seq)),key=lambda i:seq[i])
        res[b] = z
        seq[b] = "~"
    return res

def transpose(text, keys):
    columns = ['']*len(keys)
    for t in range(len(text)):
        columns[t%len(keys)] += text[t]
    res = [0]*len(keys)
    for index in range(len(keys)):
        res[keys[index]] = columns[index]
    return''.join(res)

def untranspose(text, keys, disrupt=False):
    columns = []
    for j in range(len(keys)):
        columns += [[]]
    num_rows, len_last = divmod(len(text),len(keys))
    num_rows += 1
    if len_last == 0:
        len_last = len(keys)
    text_index = 0
    for j in range(len(keys)):
        ind = keys.index(j)
        columns[ind] += list(text[text_index:text_index+num_rows-(ind>=len_last)])
        text_index += num_rows-(ind>=len_last)
    rows = []
    for k in range(num_rows):
        rows += [[]]
        for j in columns:
            rows[k] += j[k:k+1]
    if disrupt:
        undisrupt = []
        current_row = 0
        stop_key = 0
        stop_index = keys.index(stop_key)
        while current_row < num_rows:
            undisrupt += rows[current_row][:stop_index]
            rows[current_row] = rows[current_row][stop_index:]
            stop_index += 1
            current_row += 1
            if stop_index > len(keys):
                stop_key = (stop_key + 1) % len(keys)
                stop_index = keys.index(stop_key)
        for i in rows:
            undisrupt += i
        return ''.join(undisrupt)
    else:
        return ''.join(''.join(i) for i in rows)

def uncheckerboard(message, seq, word):
    trans = {seq[-2:]:".", seq[-1]*2:"#"};x=64;res='';j=z=0
    while x<90:
        x += 1
        v = chr(x)
        if v in word:
            trans[seq[word.index(v)]] = v
        else:
            trans[seq[z-2] + seq[j]] = v
            j += z
            z = (z+1) % 2
    num = False
    end = -1
    h = ''
    for j in range(len(message)):
        if end>=0 and j<end+2:
            continue
        else:
            end = -1
        if num:
            end = message.index(seq[-1]*2,j+1)
            res += message[j:end]+"#"
            num = 0
        else:
            k = message[j]
            if h:
                res += trans[h+k]
                if trans[h+k] == "#":
                    num = 1
                h = ''
            elif k in seq[:-2]:
                res += trans[k]
            else:
                h = k
    begin = res.index("..") + 2
    return res[begin:] + res[:begin]

def decode(message, keyword, phrase, date, agent):
    mkey = -int(date[-1])
    message = message.split()
    m_id = message[mkey]
    message = ''.join(message[:mkey] + message[mkey+1:])

    s1 = sequent(phrase[:10])
    s2 = sequent(phrase[10:20])
    b = ''.join(str((int(m_id[i])-int(date[i]))%10) for i in range(5))
    a = chain_add(b, 10)
    g = ''.join(str((int(a[i])+int(s1[i]))%10) for i in range(10))
    t = ''.join(str(s2[int(g[i])]) for i in range(10))
    u = chain_add(t,60)[10:]
    p = agent+int(u[-2])
    q = agent+int(u[-1])
    seqT = sequent(t)
    v = transpose(u,seqT)
    k1 = sequent(v[:p])
    k2 = sequent(v[p:p+q])
    c = ''.join(str(i)for i in sequent(u[40:]))
    z = untranspose(message,k2,1)
    y = untranspose(z,k1)
    x = uncheckerboard(y,c,keyword)
    return x


答:
Batch, <s>322</s> <s>310</s> 308 bytes

```<code>@echo off
set/pi=
set/aa=0,b=1,c=2,d=3,e=4,f=5,g=6,h=7,j=8,k=9,l=10,m=11,n=12,o=13,p=14,q=15,r=16,s=17,t=18,x=%i:~1%-1,y=%i:~,1%,z=y+1
for /l %%r in (18,-1,0)do call:l %%r
exit/b
:l
set s=...*.....*.....*...
call set t=%%s:~%1,1%%
if %x%==%1 call set s=%%s:~,%y%%%o%%s:~%z%%%
call echo %%s:.*=.%t%%%
</code>```

Explanation: Starts by prompting for the stone on stdin. Then, sets variables for each possible column, so that it can evaluate the first character of the stone as a variable to get the y coordinate. Subtracts 1 from the x coordinate because it's 1-indexed and we want 0-indexed and also computes z=y+1 as it will need that later. Then, loops r from 18 down to 0 for each row. Takes the string ...*.....*.....*... and extracts the character at the rth position for later. On the xth row, the yth character is replaced with an o. Finally, the .*s are replaced with a . plus the previously extracted character; this is a no-op on rows 4, 10 and 16 but this is the shortest way to achieve that. (I have to use .* because replacing * is apparently illegal in Batch.)

Title: Place a stone on an empty Go board

Body:
Batch, <s>322</s> <s>310</s> 308 bytes

@echo off
set/pi=
set/aa=0,b=1,c=2,d=3,e=4,f=5,g=6,h=7,j=8,k=9,l=10,m=11,n=12,o=13,p=14,q=15,r=16,s=17,t=18,x=%i:~1%-1,y=%i:~,1%,z=y+1
for /l %%r in (18,-1,0)do call:l %%r
exit/b
:l
set s=...*.....*.....*...
call set t=%%s:~%1,1%%
if %x%==%1 call set s=%%s:~,%y%%%o%%s:~%z%%%
call echo %%s:.*=.%t%%%

Explanation: Starts by prompting for the stone on stdin. Then, sets variables for each possible column, so that it can evaluate the first character of the stone as a variable to get the y coordinate. Subtracts 1 from the x coordinate because it's 1-indexed and we want 0-indexed and also computes z=y+1 as it will need that later. Then, loops r from 18 down to 0 for each row. Takes the string ...*.....*.....*... and extracts the character at the rth position for later. On the xth row, the yth character is replaced with an o. Finally, the .*s are replaced with a . plus the previously extracted character; this is a no-op on rows 4, 10 and 16 but this is the shortest way to achieve that. (I have to use .* because replacing * is apparently illegal in Batch.)


问:
Snakes all around

Challenge

The challenge is simple: print a snake.

You will get the length of the snake as input.

A snake of length 2 looks like this:

```<code>==(:)-
</code>```

A snake of length 7 looks like this:

```<code>=======(:)-
</code>```

In other words, the length of a snake is how many equal signs are before the head.

Usage

Let's say I made a C++ implementation and compiled it to ./getsnake.

I could run it like so:

```<code>$ ./getsnake 10
==========(:)-
</code>```

Clarifications

Standard loopholes are disallowed.

You can get input and output in any acceptable way.

You can assume all inputs given are positive integers.

You may write a function instead of a regular program.

答:
Python, 23 bytes

```<code>print'='*input()+'(:)-'
</code>```

Title: Snakes all around

Body:
Python, 23 bytes

print'='*input()+'(:)-'


问:
Tips for golfing in Haskell
What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one tip per answer.

If you are new to golfing in Haskell, please have a look at the Guide to Golfing Rules in Haskell. There is also a dedicated Haskell chat room: Of Monads and Men.

答:
Use , instead of && in guards

Multiple conditions in a guard that all have to hold can be combined with , instead of &&.

```<code>f a b | a/=5 && b/=7 = ...
f a b | a/=5 ,  b/=7 = ...
</code>```

Title: Tips for golfing in Haskell

Body:
Use , instead of && in guards

Multiple conditions in a guard that all have to hold can be combined with , instead of &&.

f a b | a/=5 && b/=7 = ...
f a b | a/=5 ,  b/=7 = ...


答:
Mumps, 26 Bytes.

```<code>F J=0:1:9 W "**********",!
</code>```

As loops are fairly efficient (space-wise) in Mumps, I thought I'd see if the loop within a loop was shorter, but it was not; weighing in at 31 bytes:

```<code>F I=0:1:9{F J=0:1:9{W "*"} W !}
</code>```

The braces are allowable loop delimiters in the InterSystems Cache version of Mumps that I use; at times they may save a byte or two golfing, but mostly they're just handy to have nested loops in a one-line routine.

Title: Print a 10 by 10 grid of asterisks

Body:
Mumps, 26 Bytes.

F J=0:1:9 W "**********",!

As loops are fairly efficient (space-wise) in Mumps, I thought I'd see if the loop within a loop was shorter, but it was not; weighing in at 31 bytes:

F I=0:1:9{F J=0:1:9{W "*"} W !}

The braces are allowable loop delimiters in the InterSystems Cache version of Mumps that I use; at times they may save a byte or two golfing, but mostly they're just handy to have nested loops in a one-line routine.


问:
Determine if a number is divisible by 13 (without using 13 itself)
Your challenge, should you choose to accept it, is to create a function or a program that outputs "yes" if a given number is divisible by 13 and outputs "no" if it isn't.

Rules:

 - You're not allowed to use the number 13 anywhere.

 - No cop-out synonyms for 13 either (like using 15 - 2).

 - Bonus points will be awarded for not using modulus, additional bonus for not using division.

Scoring:

 - Your score will be the number of bytes in your code (whitespace not included) multiplied by your bonus.

 - If you didn't use modulus, that bonus is 0.90; if you didn't use division, that bonus is 0.90.

 - If you didn't use either, that bonus is 0.80.

 - The lower your score, the better.

The input will always be an integer greater than 0 and less than 2^32.

Your output should be a simple "yes" or "no".

Clarifications:

 - Using some roundabout method of generating the number 13 for use is acceptable.  Simple arithmetic synonyms like (10 + 3) are not allowed.

 - The function or program must literally output "yes" or "no" for if the given number is divisible by 13.

 - As always, clever solutions are recommended, but not required.

答:
Befunge, 27 non-whitespace bytes * 0.9 = 24.3

```<code>"_v#%\*4"#&<@,,<"no
  >"sey",      ^
</code>```

Multiplies the input by 4, then checks whether the result is divisible by 52. The 4 and the 52 both come from the 4 literal in the code, which is used for its ASCII value of 52 when read from left to right, then as the number 4 when read from right to left after the < reverses direction.

Body:
Befunge, 27 non-whitespace bytes * 0.9 = 24.3

"_v#%\*4"#&<@,,<"no
  >"sey",      ^

Multiplies the input by 4, then checks whether the result is divisible by 52. The 4 and the 52 both come from the 4 literal in the code, which is used for its ASCII value of 52 when read from left to right, then as the number 4 when read from right to left after the < reverses direction.


答:
MarioLANG, 87 bytes, score = 0.839 (73/87), cracked

```<code>;
)-)+(< >>
-)===" ""====
>>+([!)( >-(+(
"====#[(("== [
!-) - <!!![)<<)
#======###====:
</code>```

Computes A000217, the triangular numbers. Offset 0.

Try it online!

Short Solution:

Since the crack took only 1 byte off, I'll share my solution in 73 bytes, which uses a different algorithm altogether:

```<code>;   +)-<
-   (=="
+)-<(
(=="+
> [!>)[!(
"==#===#[
!    -  <))
#=========:
</code>```

Try it online!

The first program lays out all the numbers from n to 1 along the tape, then adds up all numbers until it comes across a 0-value cell. It does this by copying each cell into the two adjacent cells, decrementing the right copy, and repeating the process on it until it reaches 0. During this process, the tape looks like this (for n=5):

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

... and so on. Then it moves left, summing the cells until it reaches a cell with 0.

The second program only works with three cells of the tape. Until the first cell reaches 0, it does the following:

Move the value of the first cell to the second cell.

Decrement the second cell to 0, adding its own value to the first and third cells.

Decrement the first cell.

After the first cell reaches 0, the third cell will contain n + (n-1) + (n-2) + ... + 2 + 1.

Title: Can you outgolf me? (Cops section)

Body:
Cops section

The robbers section can be found here.

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

Challenge

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

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

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

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

Computes A005843, (offset = 0).

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

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

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

Computes A005843, (offset = 0).

Offset

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

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

More information can be found here.

Scoring

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

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

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

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

Rules

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

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

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

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

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

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

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

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

Body:
MarioLANG, 87 bytes, score = 0.839 (73/87), cracked

;
)-)+(< >>
-)===" ""====
>>+([!)( >-(+(
"====#[(("== [
!-) - <!!![)<<)
#======###====:

Computes A000217, the triangular numbers. Offset 0.

Try it online!

Short Solution:

Since the crack took only 1 byte off, I'll share my solution in 73 bytes, which uses a different algorithm altogether:

;   +)-<
-   (=="
+)-<(
(=="+
> [!>)[!(
"==#===#[
!    -  <))
#=========:

Try it online!

The first program lays out all the numbers from n to 1 along the tape, then adds up all numbers until it comes across a 0-value cell. It does this by copying each cell into the two adjacent cells, decrementing the right copy, and repeating the process on it until it reaches 0. During this process, the tape looks like this (for n=5):

0 0 5 0 0 0 0
0 5 0 5 0 0 0
0 5 0 4 0 0 0
0 5 4 0 4 0 0
0 5 4 0 3 0 0
0 5 4 3 0 3 0
0 5 4 3 0 2 0
0 5 4 3 2 0 2

... and so on. Then it moves left, summing the cells until it reaches a cell with 0.

The second program only works with three cells of the tape. Until the first cell reaches 0, it does the following:

Move the value of the first cell to the second cell.

Decrement the second cell to 0, adding its own value to the first and third cells.

Decrement the first cell.

After the first cell reaches 0, the third cell will contain n + (n-1) + (n-2) + ... + 2 + 1.