答:
IBM/Lotus Notes Formula, 125 bytes

```<code>p:=0;@For(n:=0;n<=a;n:=n+1;b:=8*n;p:=p+@Power(16;-n)*(4/(b+1)-2/(b+4)-1/(b+5)-1/(b+6));o:=o:@Left(@Text(p);n+@If(n=0;1;2)));o
</code>```

Formula in a computed field with another field called "a" for input.

Basically a port of the algorithm from the Python answer from @shebang. Calculates up to 15 digits after which it truncates due to a limitation of the language (see output). Had to waste 12 bytes with the @If statement at the end just to get rid of the . after the 3 at the start :-/

Ungolfed

```<code>p:=0;
@For(n:=0; n<=a; n:=n+1;
 b:=8*n;
 p:=p+@Power(16;-n)*(4/(b+1)-2/(b+4)-1/(b+5)-1/(b+6));
 o:=o:@Left(@Text(p);n+@If(n=0;1;2))
 );
o
</code>```

Title: Bailey–Borwein–Plouffe Iterations

Body:
Bailey–Borwein–Plouffe Iterations

We've seen a few pi challenges on PPCG, but none that specifically dictate the algorithm you should be using. I'd like to see implementations of the Bailey–Borwein–Plouffe algorithm in any language up to iteration n. The formula is as follows:

Your algorithm should output each iteration up to n, showing intermediate sums as well as the final result to form a "piangle". You may also use the reduced polynomial form of the algorithm shown on the wikipedia page. An example run for n=50 is shown below:

```<code>3
3.1
3.14
3.141
3.1415
3.14159
3.141592
3.1415926
3.14159265
3.141592653
3.1415926535
3.14159265358
3.141592653589
3.1415926535897
3.14159265358979
3.141592653589793
3.1415926535897932
3.14159265358979323
3.141592653589793238
3.1415926535897932384
3.14159265358979323846
3.141592653589793238462
3.1415926535897932384626
3.14159265358979323846264
3.141592653589793238462643
3.1415926535897932384626433
3.14159265358979323846264338
3.141592653589793238462643383
3.1415926535897932384626433832
3.14159265358979323846264338327
3.141592653589793238462643383279
3.1415926535897932384626433832795
3.14159265358979323846264338327950
3.141592653589793238462643383279502
3.1415926535897932384626433832795028
3.14159265358979323846264338327950288
3.141592653589793238462643383279502884
3.1415926535897932384626433832795028841
3.14159265358979323846264338327950288419
3.141592653589793238462643383279502884197
3.1415926535897932384626433832795028841971
3.14159265358979323846264338327950288419716
3.141592653589793238462643383279502884197169
3.1415926535897932384626433832795028841971693
3.14159265358979323846264338327950288419716939
3.141592653589793238462643383279502884197169399
3.1415926535897932384626433832795028841971693993
3.14159265358979323846264338327950288419716939937
3.141592653589793238462643383279502884197169399375
3.1415926535897932384626433832795028841971693993751
3.14159265358979323846264338327950288419716939937510
</code>```

The precision of each iteration should equal the n that is passed to the algorithm, that is to say that each iteration should calculate pi up to the passed n for all k.

Rules:

Built-ins are not allowed, nor is pi, you must use the formula.

You must support n up to a maximum that your language allows in terms of the calculation of 16^n. If the input is causing an arithmetic overflow during calculation after x<n executions because your language only supports decimals up to 2^32-1, this is fine. Any other assumptions on n are not fine.

You MUST provide an explanation of how you got the output if it is not obvious. For instance, if you're posting in a Golfing language a break-down is 100% required. This is to ensure you're using the algorithm that is specified.

Standard loop-holes are disallowed.

This is code-golf, lowest byte count wins here.

Reference Code (Code used to Generate Example):

```<code>public static void main(String[] args) {
    (0..50).each {
        n->
        def x=(0..n).collect {
            j->
            def k=new BigDecimal(j)
            def s={it.setScale(n)}
            def a=s(1.0g).divide(s(16.0g)**s(k))
            def b=s(4.0g)/(s(8.0g)*s(k)+s(1.0g))
            def c=s(2.0g)/(s(8.0g)*s(k)+s(4.0g))
            def d=s(1.0g)/(s(8.0g)*s(k)+s(5.0g))
            def e=s(1.0g)/(s(8.0g)*s(k)+s(6.0g))
            def f=a*(b-c-d-e)
        }.sum()
        println(n + "\t" + x.setScale(n, BigDecimal.ROUND_DOWN))
    }
}
</code>```

This implementation caps out at n=255, you may cap out at less or more.

This implementation was done in Groovy.

Body:
IBM/Lotus Notes Formula, 125 bytes

p:=0;@For(n:=0;n<=a;n:=n+1;b:=8*n;p:=p+@Power(16;-n)*(4/(b+1)-2/(b+4)-1/(b+5)-1/(b+6));o:=o:@Left(@Text(p);n+@If(n=0;1;2)));o

Formula in a computed field with another field called "a" for input.

Basically a port of the algorithm from the Python answer from @shebang. Calculates up to 15 digits after which it truncates due to a limitation of the language (see output). Had to waste 12 bytes with the @If statement at the end just to get rid of the . after the 3 at the start :-/

Ungolfed

p:=0;
@For(n:=0; n<=a; n:=n+1;
 b:=8*n;
 p:=p+@Power(16;-n)*(4/(b+1)-2/(b+4)-1/(b+5)-1/(b+6));
 o:=o:@Left(@Text(p);n+@If(n=0;1;2))
 );
o


问:
Simplificate an array

Input

An array that can contain arrays or positive, consecutive, ascending integers. The arrays can have any number of arrays inside of them, and so on and so forth. No arrays will be empty.

Output

This array simplificated

How to simplificate an array

We will use the array, [1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]] as our example.

First, we check how deep the values are nested. Here are the depths and the numbers at those depths:

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

We construct the output array by taking the numbers in the original array, grouping them by how deep they are nested, and then nesting the groups at depths of the original depths of their  elements. Arrange the numbers in ascending order and ascending depth.

So, our output is [1, [2, 3, 9], [[4, 7]], [[[5, 6]]], [[[[[8]]]]]]

Examples

```<code>[1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]] -> [1, [2, 3, 9], [[4, 7]], [[[5, 6]]], [[[[[8]]]]]]
[[[1]], [2, [3]], 4, [5, [6, [7, [8], [9, [[10]]]]]]] -> [4, [2, 5], [[1, 3, 6]], [[[7]]], [[[[8, 9]]]], [[[[[[10]]]]]]]
[1] -> [1]
[1, [2], [[3]], [[[4]]], [[[[5]]]]] -> [1, [2], [[3]], [[[4]]], [[[[5]]]]]
[1, [[[[2], 3]]], [[4]]] -> [1, [[4]], [[[3]]], [[[[2]]]]]
</code>```

答:
Haskell, <s>124</s> 123 bytes

```<code>data L=I Int|R[L]
d#R l=((d+1)#)=<<l
d#i=[(d::Int,i)]
[]!_=[]
l!1=l
l!d=[R$l!(d-1)]
h l=R$do d<-[1..];[i|(e,i)<-0#l,d==e]!d
</code>```

As Haskell doesn't support mixed lists (integers and list of integers) by default, I define a custom list type L. Usage example:

```<code>*Main> h (R[I 1, R[I 2, I 3], R[ R[I 4]], R[ R[ R[I 5, I 6], I 7, R[R[R[I 8]]]], I 9]])
R [I 1,R [I 2,I 3,I 9],R [R [I 4,I 7]],R [R [R [I 5,I 6]]],R [R [R [R [R [I 8]]]]]]
</code>```

Note: it takes some time to run, because it loops through all positive Ints (32 or 64bit) to look for a nest level that deep. Also: the custom list type cannot be printed by default, so if you want to see the result as in the example above, you need to add deriving Show to the data declaration (-> data L=I Int|R[L] deriving Show). Because it's not needed for returning a L-list from a function, I don't count the bytes.

How it works:

```<code>data L=I Int|R[L]               -- custom list type L, which is either an Int
                                -- (-> I Int) or a list of some L (-> R [L])

d#R l=((d+1)#)=<<l              -- # makes a list of (depth, I-number) pairs from
d#i=[(d::Int,i)]                -- a given L-list, e.g.
                                -- 0 # (R[I 1,R[I 2,I 3],I 4]) -> [(1,I 4),(2,I 2),(2,I 3),(1,I 4)]
                                -- the type annotation ::Int makes sure that all
                                -- depths are bounded. Without it, Haskell
                                -- would use arbitrary large numbers of type
                                -- ::Integer and the program won't finish

[]!_=[]                         -- ! wraps a list of Is with (d-1) additional
l!1=l                           --  R constructors
l!d=[R$l!(d-1)]

h l=                            -- main function, takes a L-list
      do d<-[1..]               -- for each nest level d make
        [i|(e,i)<-0#l,d==e]     -- a list of all I where the depth is d
                           !!d  -- and wrap it again with d-1 Rs
     R$                         -- wrap with a final R
</code>```

Edit @BlackCap saved a byte by switching from >>= to do notation. Thanks!

ContentLicense: CC BY-SA 4.0

Title: Simplificate an array

Body:
Haskell, <s>124</s> 123 bytes

data L=I Int|R[L]
d#R l=((d+1)#)=<<l
d#i=[(d::Int,i)]
[]!_=[]
l!1=l
l!d=[R$l!(d-1)]
h l=R$do d<-[1..];[i|(e,i)<-0#l,d==e]!d

As Haskell doesn't support mixed lists (integers and list of integers) by default, I define a custom list type L. Usage example:

*Main> h (R[I 1, R[I 2, I 3], R[ R[I 4]], R[ R[ R[I 5, I 6], I 7, R[R[R[I 8]]]], I 9]])
R [I 1,R [I 2,I 3,I 9],R [R [I 4,I 7]],R [R [R [I 5,I 6]]],R [R [R [R [R [I 8]]]]]]

Note: it takes some time to run, because it loops through all positive Ints (32 or 64bit) to look for a nest level that deep. Also: the custom list type cannot be printed by default, so if you want to see the result as in the example above, you need to add deriving Show to the data declaration (-> data L=I Int|R[L] deriving Show). Because it's not needed for returning a L-list from a function, I don't count the bytes.

How it works:

data L=I Int|R[L]               -- custom list type L, which is either an Int
                                -- (-> I Int) or a list of some L (-> R [L])

d#R l=((d+1)#)=<<l              -- # makes a list of (depth, I-number) pairs from
d#i=[(d::Int,i)]                -- a given L-list, e.g.
                                -- 0 # (R[I 1,R[I 2,I 3],I 4]) -> [(1,I 4),(2,I 2),(2,I 3),(1,I 4)]
                                -- the type annotation ::Int makes sure that all
                                -- depths are bounded. Without it, Haskell
                                -- would use arbitrary large numbers of type
                                -- ::Integer and the program won't finish

[]!_=[]                         -- ! wraps a list of Is with (d-1) additional
l!1=l                           --  R constructors
l!d=[R$l!(d-1)]

h l=                            -- main function, takes a L-list
      do d<-[1..]               -- for each nest level d make
        [i|(e,i)<-0#l,d==e]     -- a list of all I where the depth is d
                           !!d  -- and wrap it again with d-1 Rs
     R$                         -- wrap with a final R

Edit @BlackCap saved a byte by switching from >>= to do notation. Thanks!

ContentLicense: CC BY-SA 3.0


问:
Print the digital root
This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

```<code>1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Factor, 24

Smart, mathy answer.

```<code>[ neg bitnot 9 mod 1 + ]
</code>```

63 for dumb iterative solution:

```<code>[ [ dup 9 > ] [ number>string >array [ 48 - ] map sum ] while ]
</code>```

Title: Print the digital root

Body:
Factor, 24

Smart, mathy answer.

[ neg bitnot 9 mod 1 + ]

63 for dumb iterative solution:

[ [ dup 9 > ] [ number>string >array [ 48 - ] map sum ] while ]


Title: Simplificate an array

Body:
Input

An array that can contain arrays or positive, consecutive, ascending integers. The arrays can have any number of arrays inside of them, and so on and so forth. No arrays will be empty.

Output

This array simplificated

How to simplificate an array

We will use the array, [1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]] as our example.

First, we check how deep the values are nested. Here are the depths and the numbers at those depths:

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

We construct the output array by taking the numbers in the original array, grouping them by how deep they are nested, and then nesting the groups at depths of the original depths of their  elements. Arrange the numbers in ascending order and ascending depth.

So, our output is [1, [2, 3, 9], [[4, 7]], [[[5, 6]]], [[[[[8]]]]]]

Examples

```<code>[1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]] -> [1, [2, 3, 9], [[4, 7]], [[[5, 6]]], [[[[[8]]]]]]
[[[1]], [2, [3]], 4, [5, [6, [7, [8], [9, [[10]]]]]]] -> [4, [2, 5], [[1, 3, 6]], [[[7]]], [[[[8, 9]]]], [[[[[[10]]]]]]]
[1] -> [1]
[1, [2], [[3]], [[[4]]], [[[[5]]]]] -> [1, [2], [[3]], [[[4]]], [[[[5]]]]]
[1, [[[[2], 3]]], [[4]]] -> [1, [[4]], [[[3]]], [[[[2]]]]]
</code>```

Body:
JavaScript (ES6), <s>127</s> <s>137</s> 134 bytes

Takes an array as input and returns a string.

f=(a,l=[],d=0,o='')=>`[${a.map(x=>x[0]?f(x,l,d+1,o+'['):l[d]=(l[d]?l[d]+',':o)+x),l.map((s,d)=>x+s+']'.repeat(d,x=','),x='').join``}]`

Test cases

f=(a,l=[],d=0,o='')=>`[${a.map(x=>x[0]?f(x,l,d+1,o+'['):l[d]=(l[d]?l[d]+',':o)+x),l.map((s,d)=>x+s+']'.repeat(d,x=','),x='').join``}]`

console.log(f([1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]]));
console.log(f([[[1]], [2, [3]], 4, [5, [6, [7, [8], [9, [[10]]]]]]]));
console.log(f([1]));
console.log(f([1, [2], [[3]], [[[4]]], [[[[5]]]]]));
console.log(f([1, [[[[2], 3]]], [[4]]]));


问:
This isn't rocket science
Write a program or function that takes in a single-line string. You can assume it only contains printable ASCII. Print or return a string of an ASCII art rocket such as

```<code>  |
 /_\
 |E|
 |a|
 |r|
 |t|
 |h|
 |_|
/___\
 VvV
</code>```

with the input string written from top to bottom on the fuselage. In this case the input was Earth. The height of the rocket (including flames) is always the length of the string plus five.

Each line in the output may have up to two trailing spaces and there may be a single optional trailing newline. The shortest code in bytes wins.

More Examples:

```<code>[empty string]

  |
 /_\
 |_|
/___\
 VvV

a

  |
 /_\
 |a|
 |_|
/___\
 VvV

|0

  |
 /_\
 |||
 |0|
 |_|
/___\
 VvV

\/\

  |
 /_\
 |\|
 |/|
 |\|
 |_|
/___\
 VvV

 _ _ [note trailing space]

  |
 /_\
 | |
 |_|
 | |
 |_|
 | |
 |_|
/___\
 VvV

    [4 spaces]

  |
 /_\
 | |
 | |
 | |
 | |
 |_|
/___\
 VvV

SPACEY

  |
 /_\
 |S|
 |P|
 |A|
 |C|
 |E|
 |Y|
 |_|
/___\
 VvV
</code>```

Leaderboard

var QUESTION_ID=91182,OVERRIDE_USER=26997;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

```

Title: This isn't rocket science

Body:
Dart, 80 bytes

g(s)=>'  |\n /_\\\n${s.split('').map((s)=>' |$s|\n').join()} |_|\n/___\\\n VvV';

Running it through

main()=>print(g("Jasper"));

Gives:

  |
 /_\
 |J|
 |a|
 |s|
 |p|
 |e|
 |r|
 |_|
/___\
 VvV


问:
Golf you a quine for great good!
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}}

 ```

答:
Rust, 173 158 152 144 137 102 bytes

Tuples plus Rust's debug printing mechanism ( {:?} in a format string ) let me cut it down 30+ characters!

fn main(){let t=("fn main(){let t=", ";print!(\"{}{:?}{}\",t.0,t,t.1)}");print!("{}{:?}{}",t.0,t,t.1)}
```

<p>Pretty-printed. It's so small there's little left to explain!</p>

<pre class="lang-rs prettyprint-override"><code>fn main() {
    // The space after the comma is necessary, because that's how
    // debug-print formats tuples
    let t=("fn main(){let t=", ";print!(\"{}{:?}{}\",t.0,t,t.1)}");
    print!("{}{:?}{}",t.0,t,t.1)
}
</code>```

Title: Golf you a quine for great good!

Body:
Rust, 173 158 152 144 137 102 bytes

Tuples plus Rust's debug printing mechanism ( {:?} in a format string ) let me cut it down 30+ characters!

fn main(){let t=("fn main(){let t=", ";print!(\"{}{:?}{}\",t.0,t,t.1)}");print!("{}{:?}{}",t.0,t,t.1)}

Pretty-printed. It's so small there's little left to explain!

fn main() {
    // The space after the comma is necessary, because that's how
    // debug-print formats tuples
    let t=("fn main(){let t=", ";print!(\"{}{:?}{}\",t.0,t,t.1)}");
    print!("{}{:?}{}",t.0,t,t.1)
}


答:
Pyth, <s>19</s> 16 bytes

```<code>W=Qsf!&sITp+TdQk
</code>```

Try it online. Test suite.

Note the leading space. Outputs levels on rows like the Perl answer.

Explanation

Implicit input in Q.

filter items T of Q on:

Check if sum is Identity on T.

If it was (it was a number), print T plus a space +…d.

If it wasn't (it was an array), keep it.

sum the items. This removes a layer of arrays from each item. If none are left, yields 0.

Assign = the result to Q.

While the result is nonempty, print the empty string k and a newline.

Title: Simplificate an array

Body:
Pyth, <s>19</s> 16 bytes

W=Qsf!&sITp+TdQk

<a href="http://pyth.herokuapp.com/?code=W%3DQsf!%26sITp%2BTdQk&input=%5B1%2C+%5B2%2C+3%5D%2C+%5B%5B4%5D%5D%2C+%5B%5B%5B5%2C+6%5D%2C+7%2C+%5B%5B%5B8%5D%5D%5D%5D%2C+9%5D%5D&test_suite_input=%5B1%2C+%5B2%2C+3%5D%2C+%5B%5B4%5D%5D%2C+%5B%5B%5B5%2C+6%5D%2C+7%2C+%5B%5B%5B8%5D%5D%5D%5D%2C+9%5D%5D%0A%5B%5B%5B1%5D%5D%2C+%5B2%2C+%5B3%5D%5D%2C+4%2C+%5B5%2C+%5B6%2C+%5B7%2C+%5B8%5D%2C+%5B9%2C+%5B%5B10%5D%5D%5D%5D%5D%5D%5D%0A%5B1%5D%0A%5B1%2C+%5B2%5D%2C+%5B%5B3%5D%5D%2C+%5B%5B%5B4%5D%5D%5D%2C+%5B%5B%5B%5B5%5D%5D%5D%5D%5D%0A%5B1%2C+%5B%5B%5B%5B2%5D%2C+3%5D%5D%5D%2C+%5B%5B4%5D%5D%5D&debug=0" rel="nofollow">Try it online. <a href="http://pyth.herokuapp.com/?code=W%3DQsf!%26sITp%2BTdQk&input=%5B1%2C+%5B2%2C+3%5D%2C+%5B%5B4%5D%5D%2C+%5B%5B%5B5%2C+6%5D%2C+7%2C+%5B%5B%5B8%5D%5D%5D%5D%2C+9%5D%5D&test_suite=1&test_suite_input=%5B1%2C+%5B2%2C+3%5D%2C+%5B%5B4%5D%5D%2C+%5B%5B%5B5%2C+6%5D%2C+7%2C+%5B%5B%5B8%5D%5D%5D%5D%2C+9%5D%5D%0A%5B%5B%5B1%5D%5D%2C+%5B2%2C+%5B3%5D%5D%2C+4%2C+%5B5%2C+%5B6%2C+%5B7%2C+%5B8%5D%2C+%5B9%2C+%5B%5B10%5D%5D%5D%5D%5D%5D%5D%0A%5B1%5D%0A%5B1%2C+%5B2%5D%2C+%5B%5B3%5D%5D%2C+%5B%5B%5B4%5D%5D%5D%2C+%5B%5B%5B%5B5%5D%5D%5D%5D%5D%0A%5B1%2C+%5B%5B%5B%5B2%5D%2C+3%5D%5D%5D%2C+%5B%5B4%5D%5D%5D&debug=0" rel="nofollow">Test suite.

Note the leading space. Outputs levels on rows like the Perl answer.

Explanation

Implicit input in Q.

filter items T of Q on:

Check if sum is Identity on T.

If it was (it was a number), print T plus a space +…d.

If it wasn't (it was an array), keep it.

sum the items. This removes a layer of arrays from each item. If none are left, yields 0.

Assign = the result to Q.

While the result is nonempty, print the empty string k and a newline.


问:
Generate a modulo rosace

The cool stuff

The following rosace can help calculate numbers modulo 7.

In order to do that, you must start at 0 and turn clockwise a number of steps given by the first digit. Then, for each successive digit, follow the arrow and then turn clockwise the number of steps given by that digit.

Here is how you proceed for number 294:

You start at circle 0.

You turn clockwise the number of steps given by the first digit (which is a 2, you end up at 2).

You follow the arrow there (you end up at 6).

You turn clockwise the number of steps given by the second digit (which is a 9, you end up at 1).

You follow the arrow there (you end up at 3).

You turn clockwise the number of steps given by the third number (which is 4, you end up at 0).

294 mod 7 = 0 (meaning 294 is multiple of 7).

(Video explanation if you still didn't get it)

The goal

Figure out how that works (I know but I won't tell you).

Create a program that takes a number n in parameter and that generates a rosace for mod n.

The rosace can be displayed by any means you want (ASCII, generate PNG, generate SVG, ...) as long as it could be used by a 8 years old child (so no list of rules, I want a picture)!

You can use strait lines, even if it's a bit less clear than what I made for the example, but you must show clearly the numbers that point to themselves with some kind of tail-biting arrow.

Test cases

(I only give the links between the numbers, feel free to edit my question once your program sucessfully generates them)

mod 2:

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

mod 3:

```<code>0 -> 0
1 -> 1
2 -> 2
</code>```

mod 4:

```<code>0 -> 0
1 -> 2
2 -> 0
3 -> 2
</code>```

mod 5:

```<code>0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 0
</code>```

mod 6:

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

mod 7:

```<code>0 -> 0
1 -> 3
2 -> 6
3 -> 2
4 -> 5
5 -> 1
6 -> 4
</code>```

mod 8:

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

mod 9:

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

mod 10:

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

Rules

This is code-golf, shortest code in bytes wins.

As usual, loopholes and cheats are forbidden.

Title: Generate a modulo rosace

Body:
Batch, 394 bytes

@echo off
set/an=%1-1
set s=
for /l %%j in (0,1,%n%)do call:h %%j
echo %s%
for /l %%i in (0,1,%n%)do call:r %%i %1
exit/b
:h
set "s=%s%^>%1^>"
exit/b
:r
set/ar=%1*10%%%2
set s=
for /l %%j in (0,1,%n%)do call:l %%j %1
echo %s%
exit/b
:l
if %1==%r% set "s=%s%^>%1^<"&exit/b
if %2 geq %1 if %1 geq %r% set "s=%s%^<%1%^<"&exit/b
if %2 leq %1 if %1 leq %r% goto h
set "s=%s% %1 "

Escaping in Batch is ugly at the best of times. Example output for 7:

>0>>1>>2>>3>>4>>5>>6>
>0< 1  2  3  4  5  6
 0 >1>>2>>3< 4  5  6
 0  1 >2>>3>>4>>5>>6<
 0  1 >2<<3< 4  5  6
 0  1  2  3 >4>>5< 6
 0 >1<<2<<3<<4<<5< 6
 0  1  2  3 >4<<5<<6<


问:
monthconcatenation
The goal is to output the number of the months given as input in a compact concatenated form which is still parsable if one knows the construction rules:

If either:

January is followed by January, February, November or December; or

November is followed by January or February

There must be a separator placed between.

Otherwise there should be no separator.

As such the output may be parsed. For example:

March, April and September -> 349

January, January and February -> 1-1-2

January, January and December -> 1-1-12

January, November and February -> 1-11-2

November, January and February -> 11-1-2

November and December -> 1112

Thus any run of ones is either a run of Novembers, a run of Novembers followed by a December, a run of Novembers followed by an October, or a January followed by an October. This may be parsed by looking to the right of such runs as the resulting string is read from left to right.

Input

A list of months numbers ([1-12]) in any format you want (list, JSON, separated by one or more characters, entered one by one by user, …).

the same month can be present more than once.

Output

The compact concatenated form described above. If a separator is needed, you can freely choose one.

Output examples for January, February and March (1-2-3):

1-23 (chosen for the test cases below)

1 23

1/23

1,23

...

Test cases

```<code>[1]       => 1
[1, 2]    => 1-2
[2, 1]    => 21
[12]      => 12
[1, 11]   => 1-11
[11, 1]   => 11-1
[1, 1, 1] => 1-1-1
[2, 11]   => 211
[11, 2]   => 11-2
[1, 2, 3] => 1-23
[11, 11]  => 1111
[1,1,11,1,12,1,11,11,12]     => 1-1-11-1-121-111112
[10,11,12,11,11,10,1,10,1,1] => 1011121111101101-1
[2,12,12,2,1,12,12,1,1,2,12,12,2,11,2,12,1] => 2121221-12121-1-21212211-2121
</code>```

Rules

As usual, this is code-golf, shortest answer in bytes wins.

Standard loopholes are forbidden.

答:
Python 2.7 96 bytes

Try it out here!

Huge thanks to Jonathan Allan for shortening the answer.

golfed:

```<code>b,o=input(),""
for a,n in zip(b,b[1:]):o+=`a`+"-"*(a%10==1and a+n in(2,3,12,13))
print o+`b[-1]`
</code>```

Explanation:

runs through the input, checks if the current item is a special case and if so handles it, otherwise just concatenates the input, prints the output string.

ungolfed:

```<code>input = [2,12,12,2,1,12,12,1,1,2,12,12,2,11,2,12,1]
output = ""
for i in range(len(input) - 1):
    next = input[i + 1]
    item = input[i]
    if item == 1 and (next == 1 or next == 2 or next == 11 or next == 12) or item == 11 and (next == 1 or next == 2):
        output += str(item) + "-"
    else:
        output += str(item)

output += str(input[-1])

print output
</code>```

Title: monthconcatenation

Body:
Python 2.7 96 bytes

Try it out here!

Huge thanks to Jonathan Allan for shortening the answer.

golfed:

b,o=input(),""
for a,n in zip(b,b[1:]):o+=`a`+"-"*(a%10==1and a+n in(2,3,12,13))
print o+`b[-1]`

Explanation:

runs through the input, checks if the current item is a special case and if so handles it, otherwise just concatenates the input, prints the output string.

ungolfed:

input = [2,12,12,2,1,12,12,1,1,2,12,12,2,11,2,12,1]
output = ""
for i in range(len(input) - 1):
    next = input[i + 1]
    item = input[i]
    if item == 1 and (next == 1 or next == 2 or next == 11 or next == 12) or item == 11 and (next == 1 or next == 2):
        output += str(item) + "-"
    else:
        output += str(item)

output += str(input[-1])

print output


问:
Tips for golfing in Java

Are there any useful shortcuts that can be used in Java?

As shown below, import already adds at least 17 characters to a program.

import java.io.*;
```

I understand that the simple solution would be to use another language, but it seems to be a real challenge to shorten Java programs.

Tips should be specific to Java: if they're applicable to most C-like languages, they belong in the more general list of tips.

答:
Using ... (varags) as parameter

In some cases it's shorter to use a Java varargs as parameter instead of loose ones.

For example:

// Example input/output: 5, 4, 3 -> 60000
int calculateVolumeInLiters(int width, int height, int depth){
  return width * height * depth * 1000;
}
```

<p>Would be golfed by most to this:</p>

<pre class="lang-java prettyprint-override"><code>int c(int w,int h,int d){return w*h*d*1000;} // 44 bytes
</code>```

But can be golfed an additional byte to this:

int c(int...a){return a[0]*a[1]*a[2]*1000;}  // 43 bytes
```

<p>Note that all three integers are only accessed once in the method itself. Since <code>int</code> is pretty short it is only beneficial if you use them each only once inside the method, and have three or more of them as parameter.</p>

<p>With longer parameters this is usually more useful though. For example, this was my original answer for this challenge (calculate occurances of input character in input string):</p>

<pre class="lang-java prettyprint-override"><code>// Example input/output: tttggloyoi, t -> 3

int c(String a,char b){return a.replaceAll("[^"+b+"]","").length();} // 68 bytes
</code>```

And I was recommended to golf it to this:

int c(String a,char b){return a.split(b+"").length-1;}               // 54 bytes
```

<p>But I ended up golfing it to this using <code>...</code>:</p>

<pre class="lang-java prettyprint-override"><code>int c(String...a){return a[0].split(a[1]).length-1;}                 // 52 bytes
</code>```

NOTE: If the question/challenge asks for a flexible input, the ... can be shortened to [] of course. If the question/challenge specifically asks for, let's say, three String inputs and disallows an String-array containing three values, you can use String... instead of String a,String b,String c.

Title: Tips for golfing in Java

Body:
Using ... (varags) as parameter

In some cases it's shorter to use a Java varargs as parameter instead of loose ones.

For example:

// Example input/output: 5, 4, 3 -> 60000
int calculateVolumeInLiters(int width, int height, int depth){
  return width * height * depth * 1000;
}

Would be golfed by most to this:

int c(int w,int h,int d){return w*h*d*1000;} // 44 bytes

But can be golfed an additional byte to this:

int c(int...a){return a[0]*a[1]*a[2]*1000;}  // 43 bytes

Note that all three integers are only accessed once in the method itself. Since int is pretty short it is only beneficial if you use them each only once inside the method, and have three or more of them as parameter.

With longer parameters this is usually more useful though. For example, this was my original answer for this challenge (calculate occurances of input character in input string):

// Example input/output: tttggloyoi, t -> 3

int c(String a,char b){return a.replaceAll("[^"+b+"]","").length();} // 68 bytes

And I was recommended to golf it to this:

int c(String a,char b){return a.split(b+"").length-1;}               // 54 bytes

But I ended up golfing it to this using ...:

int c(String...a){return a[0].split(a[1]).length-1;}                 // 52 bytes

NOTE: If the question/challenge asks for a flexible input, the ... can be shortened to [] of course. If the question/challenge specifically asks for, let's say, three String inputs and disallows an String-array containing three values, you can use String... instead of String a,String b,String c.


答:
Dart, 185 bytes

```<code>main(){var c=new String.fromCharCode(34);var l=["main(){var c=new String.fromCharCode(34);var l=[","];print(l[0]+c+l[0]+c+','+c+l[1]+c+l[1]);}"];print(l[0]+c+l[0]+c+','+c+l[1]+c+l[1]);}
</code>```

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:
Dart, 185 bytes

main(){var c=new String.fromCharCode(34);var l=["main(){var c=new String.fromCharCode(34);var l=[","];print(l[0]+c+l[0]+c+','+c+l[1]+c+l[1]);}"];print(l[0]+c+l[0]+c+','+c+l[1]+c+l[1]);}


答:
Jelly, 8 bytes

```<code>fFṄḟ@;/ß
</code>```

Output is one level per line, with empty lines for levels without elements. Try it online!

How it works

```<code>fFṄḟ@;/ß  Main link. Argument: A (array)

 F        Flat; yield all integers (at any level) in A.
f         Filter; intersect A with the integers, yielding those at level 0.
  Ṅ       Print the filtered array and a linefeed. Yields the filtered array.
     ;/   Reduce by concatenation.
          This decreases the levels of all integers at positive levels by 1.
   ḟ@     Swapped filter-false; remove the integers at level 0 in A from the array
          with decreased levels.
       ß  Recursively call the main link on the result.
          The program stops once A is empty, since ;/ will result in an error.
</code>```

Title: Simplificate an array

Body:
Jelly, 8 bytes

fFṄḟ@;/ß

Output is one level per line, with empty lines for levels without elements. Try it online!

How it works

fFṄḟ@;/ß  Main link. Argument: A (array)

 F        Flat; yield all integers (at any level) in A.
f         Filter; intersect A with the integers, yielding those at level 0.
  Ṅ       Print the filtered array and a linefeed. Yields the filtered array.
     ;/   Reduce by concatenation.
          This decreases the levels of all integers at positive levels by 1.
   ḟ@     Swapped filter-false; remove the integers at level 0 in A from the array
          with decreased levels.
       ß  Recursively call the main link on the result.
          The program stops once A is empty, since ;/ will result in an error.


答:
Python 2, 294 bytes

```<code>n=input()
r,R="",range(n)
for i in R:r+=["   ","__ "][10*i%n==i]
r+="\n"
for i in R:r+=["   ","|/ "][10*i%n==i]
print r
print">>".join(map(str,R))
for i in R:
    o,r=10*i%n,""
    for j in R:
        r+="|"
        if i<=j<o:r+=">>"
        elif i>j>=o:r+="<<"
        else:r+="  "
    print r
</code>```

Prints the diagram in this format:

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

I don't know if this format is okay, therefore I'll leave this answer as invalid for the time being. Yay, it's valid!

Try it on repl.it!

Title: Generate a modulo rosace

Body:
The cool stuff

The following rosace can help calculate numbers modulo 7.

In order to do that, you must start at 0 and turn clockwise a number of steps given by the first digit. Then, for each successive digit, follow the arrow and then turn clockwise the number of steps given by that digit.

Here is how you proceed for number 294:

You start at circle 0.

You turn clockwise the number of steps given by the first digit (which is a 2, you end up at 2).

You follow the arrow there (you end up at 6).

You turn clockwise the number of steps given by the second digit (which is a 9, you end up at 1).

You follow the arrow there (you end up at 3).

You turn clockwise the number of steps given by the third number (which is 4, you end up at 0).

294 mod 7 = 0 (meaning 294 is multiple of 7).

(Video explanation if you still didn't get it)

The goal

Figure out how that works (I know but I won't tell you).

Create a program that takes a number n in parameter and that generates a rosace for mod n.

The rosace can be displayed by any means you want (ASCII, generate PNG, generate SVG, ...) as long as it could be used by a 8 years old child (so no list of rules, I want a picture)!

You can use strait lines, even if it's a bit less clear than what I made for the example, but you must show clearly the numbers that point to themselves with some kind of tail-biting arrow.

Test cases

(I only give the links between the numbers, feel free to edit my question once your program sucessfully generates them)

mod 2:

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

mod 3:

```<code>0 -> 0
1 -> 1
2 -> 2
</code>```

mod 4:

```<code>0 -> 0
1 -> 2
2 -> 0
3 -> 2
</code>```

mod 5:

```<code>0 -> 0
1 -> 0
2 -> 0
3 -> 0
4 -> 0
</code>```

mod 6:

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

mod 7:

```<code>0 -> 0
1 -> 3
2 -> 6
3 -> 2
4 -> 5
5 -> 1
6 -> 4
</code>```

mod 8:

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

mod 9:

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

mod 10:

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

Rules

This is code-golf, shortest code in bytes wins.

As usual, loopholes and cheats are forbidden.

Body:
Python 2, 294 bytes

n=input()
r,R="",range(n)
for i in R:r+=["   ","__ "][10*i%n==i]
r+="\n"
for i in R:r+=["   ","|/ "][10*i%n==i]
print r
print">>".join(map(str,R))
for i in R:
    o,r=10*i%n,""
    for j in R:
        r+="|"
        if i<=j<o:r+=">>"
        elif i>j>=o:r+="<<"
        else:r+="  "
    print r

Prints the diagram in this format:

__
|/
0>>1>>2>>3>>4>>5>>6
|  |  |  |  |  |  |
|  |>>|>>|  |  |  |
|  |  |>>|>>|>>|>>|
|  |  |<<|  |  |  |
|  |  |  |  |>>|  |
|  |<<|<<|<<|<<|  |
|  |  |  |  |<<|<<|

I don't know if this format is okay, therefore I'll leave this answer as invalid for the time being. Yay, it's valid!

Try it on repl.it!


问:
"Hello, World!"
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

  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(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) 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;
  display: block !important;
}

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Seed, <s>6016</s> <s>4234</s> 4203 bytes

```<code>20 [encoded data, 4200 characters]
</code>```

Try it online!
The resulting Befunge-98 program (based on this) is

```<code>"9!dlroW ,olleH"ck,@
</code>```

Try it online!

Title: "Hello, World!"


问:
What's the Binary Time?

What's the Binary Time?

Everybody knows what the normal time is. It's up there in the top-right (or wherever you put it) of your screen. But a question people rarely seem to ask themselves is this: What's the binary time?

Binary Time

Binary Time (True Binary Time) works by first reading the most significant bit (MSB) of the number. If that number is 0, the time expressed is before noon. If that number is 1, the time expressed is after noon. The next bit splits the half of the day the first bit expressed into two more equal halves, this time of 6 hours. The following bit splits into 3 hours, the next 90 minutes, and so on. Times like 12:00:00, where it seems it should be neither, become 1.

I can only understand this strange system of timing, so I need a program to convert to that for me. But as binary numbers are Base-2, and 2 is a small number, your program must be as short as possible.

Requirements

Your program should take a time (as 24-hour-time) as input and output the corresponding binary time number.

The output number should have 16-bit precision (the number should be 16 digits long).

You cannot use a builtin that does all of that conversion for you.

You should floor if it needs to be rounded.

Rules

Standard loopholes are forbidden.

Your program should not write anything to STDERR.

Test Cases

00:00:00 ==> 0000000000000000

12:00:00 ==> 1000000000000000

01:30:00 ==> 0001000000000000

10:33:06 ==> 0111000010001101

09:57:30 ==> 0110101000111000

06:00:00 ==> 0100000000000000

18:00:00 ==> 1100000000000000

Scoring

To win, as I mentioned earlier, you must have the least bytes.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

  });

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Title: What's the Binary Time?

Body:
C, 91 bytes

f(h,m,s,n,i){i=0;n=(s+m*60+h*3600)*512/675;while(i<16)printf((n&32768)?"1":"0"),n<<=1,i++;}


问:
The Rule of Thumb for Title Capitalization
According to this site a general rule recommended by The U.S. Government Printing Office Style Manual is

Capitalize all words in titles of publications and documents, except
  a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and
  nor.

This might not be true as I'm unable to find such a recommendation in the Style Manual, but let's use this rule anyway.

The Challenge

Given an input string consisting of lower case words delimited by spaces, output the capitalization of the string according to the following rules

The first and last word is capitalized.

All other words are capitalized, except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.

The input string will contain at least one word and each word contains at least one letter and only characters from a to z.

This is a code golf challenge, so try to use as few bytes as possible in the language of your choice. You may write a full program or a function to accomplish the task.

Testcases

```<code>"the rule of thumb for title capitalization" -> "The Rule of Thumb for Title Capitalization"
"programming puzzles and code golf" -> "Programming Puzzles and Code Golf"
"the many uses of the letter a" -> "The Many Uses of the Letter A"
"title" -> "Title"
"and and and" -> "And and And"
"a an and as at but by for in nor of on or the to up" -> "A an and as at but by for in nor of on or the to Up"
"on computable numbers with an application to the entscheidungsproblem" -> "On Computable Numbers With an Application to the Entscheidungsproblem"
</code>```

答:
PHP, <s>109</s> 142 bytes

```<code><?=preg_replace_callback("# (A[snt]?|And|[FN]or|Up|By|But|The|To|In|O[rnf])(?= )#",function($m){return strtolower($m[0]);},ucwords($argv[1]));
</code>```

A merger of user59178´s and mbomb007´s answer.

uppercases the first letter of every word, then lowercases all words from the list surrounded by spaces.

Unfortunately, the callback has to operate on the complete set; this costs 29 bytes.

Body:
PHP, <s>109</s> 142 bytes

<?=preg_replace_callback("# (A[snt]?|And|[FN]or|Up|By|But|The|To|In|O[rnf])(?= )#",function($m){return strtolower($m[0]);},ucwords($argv[1]));

A merger of user59178´s and mbomb007´s answer.

uppercases the first letter of every word, then lowercases all words from the list surrounded by spaces.

Unfortunately, the callback has to operate on the complete set; this costs 29 bytes.


答:
Jelly, 20 bytes

```<code>%⁵=1a+e“£¤€Æ‘⁶ẋ⁸,⁹µ/
</code>```

TryItOnline! or run all test cases

How?

```<code>%⁵=1a+e“£¤€Æ‘⁶ẋ⁸,⁹µ/ - Main link: the list
                   / - reduce
                  µ  - monadic chain separation
%⁵                   - left item mod 10
  =1                 - equal to 1? (Jan or Nov)
    a                - and
     +               - left item plus right item
      e              - is in
       “£¤€Æ‘        - jelly code page index list:  [2,3,12,13]
                           now True (1) for any of:
                               [1,1], [1,2], [1,11], [1,12], [11,1], or [11,2]
             ⁶       - literal space (the separator being used)
              ẋ      - repeated that many times
               ⁸     - left argument
                ,    - pair
                 ⁹   - right argument
</code>```

Title: monthconcatenation

Body:
The goal is to output the number of the months given as input in a compact concatenated form which is still parsable if one knows the construction rules:

If either:

January is followed by January, February, November or December; or

November is followed by January or February

There must be a separator placed between.

Otherwise there should be no separator.

As such the output may be parsed. For example:

March, April and September -> 349

January, January and February -> 1-1-2

January, January and December -> 1-1-12

January, November and February -> 1-11-2

November, January and February -> 11-1-2

November and December -> 1112

Thus any run of ones is either a run of Novembers, a run of Novembers followed by a December, a run of Novembers followed by an October, or a January followed by an October. This may be parsed by looking to the right of such runs as the resulting string is read from left to right.

Input

A list of months numbers ([1-12]) in any format you want (list, JSON, separated by one or more characters, entered one by one by user, …).

the same month can be present more than once.

Output

The compact concatenated form described above. If a separator is needed, you can freely choose one.

Output examples for January, February and March (1-2-3):

1-23 (chosen for the test cases below)

1 23

1/23

1,23

...

Test cases

```<code>[1]       => 1
[1, 2]    => 1-2
[2, 1]    => 21
[12]      => 12
[1, 11]   => 1-11
[11, 1]   => 11-1
[1, 1, 1] => 1-1-1
[2, 11]   => 211
[11, 2]   => 11-2
[1, 2, 3] => 1-23
[11, 11]  => 1111
[1,1,11,1,12,1,11,11,12]     => 1-1-11-1-121-111112
[10,11,12,11,11,10,1,10,1,1] => 1011121111101101-1
[2,12,12,2,1,12,12,1,1,2,12,12,2,11,2,12,1] => 2121221-12121-1-21212211-2121
</code>```

Rules

As usual, this is code-golf, shortest answer in bytes wins.

Standard loopholes are forbidden.

Body:
Jelly, 20 bytes

%⁵=1a+e“£¤€Æ‘⁶ẋ⁸,⁹µ/

TryItOnline! or run all test cases

How?

%⁵=1a+e“£¤€Æ‘⁶ẋ⁸,⁹µ/ - Main link: the list
                   / - reduce
                  µ  - monadic chain separation
%⁵                   - left item mod 10
  =1                 - equal to 1? (Jan or Nov)
    a                - and
     +               - left item plus right item
      e              - is in
       “£¤€Æ‘        - jelly code page index list:  [2,3,12,13]
                           now True (1) for any of:
                               [1,1], [1,2], [1,11], [1,12], [11,1], or [11,2]
             ⁶       - literal space (the separator being used)
              ẋ      - repeated that many times
               ⁸     - left argument
                ,    - pair
                 ⁹   - right argument


问:
The Last Monday
Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday?

Input

A positive integer in any convenient format representing a year, 10000 > y > 0.

The input can be padded with zeros (e.g., 0025 for year 25) if
required.

Output

A list of the months of that year where the last day of the month is a Monday.

This can be as month names (e.g., January, March, October), or shortnames (Jan, Mar, Oct), or numbers (1, 3, 10), as separate lines or a list or delimited, etc., just so long as it's unambiguous to the reader.

The output format must be consistent:

For all years input (meaning, you can't output month names for some inputs, and month numbers for other inputs)

As well as consistent per output (meaning, you can't output 1 for January in the same output as Jul for July)

Basically, pick one format and stick to it.

Rules

Assume the Gregorian calendar for input/output, even down to y = 1.

Leap years must be properly accounted for (as a reminder: every year divisible by 4, except not years divisible by 100, unless also divisible by 400 -- 1700, 1800, 1900 all weren't leap years, but 2000 was).

You may use any built-ins or other date calculation tools you like.

Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>   1 --> Apr, Dec
 297 --> May
1776 --> Sep
2000 --> Jan, Jul
2016 --> Feb, Oct
3385 --> Jan, Feb, Oct
</code>```

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
Japt, 24 bytes

```<code>Do1 £Ov"Ð400+U"+X e ¥2©X
</code>```

Test it online! Outputs an array of numbers, with false in place of months that don't end in a Monday.

There was a bug in the interpreter that didn't allow me to use Ð in the function body £. After the bug fix and another feature addition, this is 18 bytes in the current commit:

```<code>Do1@Ð400+UX e ¥2©X
</code>```

Title: The Last Monday

Body:
Japt, 24 bytes

Do1 £Ov"Ð400+U"+X e ¥2©X

Test it online! Outputs an array of numbers, with false in place of months that don't end in a Monday.

There was a bug in the interpreter that didn't allow me to use Ð in the function body £. After the bug fix and another feature addition, this is 18 bytes in the current commit:

Do1@Ð400+UX e ¥2©X


问:
Pythagorean Triple Sequence

A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5). If (a, b, c) is a Pythagorean triple, then so is (ka, kb, kc) for any positive integer k. A primitive Pythagorean triple is one in which a, b and c are coprime.

Using this knowledge, we can create a sequence by chaining together the least lengths of triples, where the next element in the sequence is the hypotenuse (largest number) of the smallest primitive Pythagorean triple containing the previous element as the smallest one of its lengths.

Start with the smallest primitive Pythagorean triple (3, 4, 5). The sequence begins with 3, and the hypotenuse (next element in the sequence) is 5. Then find the smallest primitive Pythagorean triple with 5 as a leg, and you get (5, 12, 13). So the sequence continues with 13.

Either output the sequence forever, or take an integer input n and output the first n elements of the sequence, either zero or one indexed.

You need to support output at least through and including 28455997, but if the limit of the data type you are using was suddenly raised, it would need to work for that new limit. So you cannot hard code a list of numbers.

```<code>3
5
13
85
157
12325
90733
2449525
28455997
295742792965
171480834409967437
656310093705697045
1616599508725767821225590944157
4461691012090851100342993272805
115366949386695884000892071602798585632943213
12002377162350258332845595301471273220420939451301220405
</code>```

OEIS A239381

Similar sequences (don't output these!):

A018928

A077034 (the odd terms)

答:
Python 3, 178 bytes

from math import*
p,n=[3,5],int(input())
while len(p)<n:
 for i in range(p[-1],p[-1]**2):
  v=sqrt(i**2+p[-1]**2)
  if v==int(v)and gcd(i,p[-1])==1:
   p+=[int(v)];break
print(p)
```

This is basically just a brute force algorithm, and thus is very slow. It takes the amount of terms to output as the input.

I'm not 100% sure about the correctness of this algorithm, the program checks for the other leg up to the first leg squared, which I believe is enough, but I haven't done the math.

Try it on repl.it! (Outdated) (Please don't try it for numbers greater than 10, it will be very slow)

Title: Pythagorean Triple Sequence

Body:
Python 3, 178 bytes

from math import*
p,n=[3,5],int(input())
while len(p)<n:
 for i in range(p[-1],p[-1]**2):
  v=sqrt(i**2+p[-1]**2)
  if v==int(v)and gcd(i,p[-1])==1:
   p+=[int(v)];break
print(p)

This is basically just a brute force algorithm, and thus is very slow. It takes the amount of terms to output as the input.

I'm not 100% sure about the correctness of this algorithm, the program checks for the other leg up to the first leg squared, which I believe is enough, but I haven't done the math.

Try it on repl.it! (Outdated) (Please don't try it for numbers greater than 10, it will be very slow)


答:
Brachylog, 36 bytes

```<code>3{@wB:?>:^a+~^=C:B:?:{$pd}ac#d,C:1&}
</code>```

Try it online!

You have to wait for the program to time out (1 minute) before TIO flushes the output. In SWI-Prolog's REPL this prints as soon as it finds the value.

This will print the sequence forever.

After a few minutes on the offline SWI-Prolog's interpreter, I obtained 90733 after 12325. I stopped it after this point.

This isn't complete bruteforce as it uses constraints to find pythagorean triples, though it is obviously not optimised for speed.

Explanation

```<code>3{                                 }    Call this predicate with 3 as Input
  @w                                    Write the Input followed by a line break
    B:?>                                B > Input
           +                            The sum...
        :^a                             ...of Input^2 with B^2...
            ~^                          ...must equal a number which is itself a square
              =C                        Assign a fitting value to that number and call it C
               C:B:?:{$pd}a             Get the lists of prime factors of C, B and Input
                                          without duplicates
                           c#d,         Concatenate into a single list; all values must be
                                          different
                               C:1&     Call recursively with C as Input
</code>```

Title: Pythagorean Triple Sequence

Body:
A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5). If (a, b, c) is a Pythagorean triple, then so is (ka, kb, kc) for any positive integer k. A primitive Pythagorean triple is one in which a, b and c are coprime.

Using this knowledge, we can create a sequence by chaining together the least lengths of triples, where the next element in the sequence is the hypotenuse (largest number) of the smallest primitive Pythagorean triple containing the previous element as the smallest one of its lengths.

Start with the smallest primitive Pythagorean triple (3, 4, 5). The sequence begins with 3, and the hypotenuse (next element in the sequence) is 5. Then find the smallest primitive Pythagorean triple with 5 as a leg, and you get (5, 12, 13). So the sequence continues with 13.

Either output the sequence forever, or take an integer input n and output the first n elements of the sequence, either zero or one indexed.

You need to support output at least through and including 28455997, but if the limit of the data type you are using was suddenly raised, it would need to work for that new limit. So you cannot hard code a list of numbers.

```<code>3
5
13
85
157
12325
90733
2449525
28455997
295742792965
171480834409967437
656310093705697045
1616599508725767821225590944157
4461691012090851100342993272805
115366949386695884000892071602798585632943213
12002377162350258332845595301471273220420939451301220405
</code>```

OEIS A239381

Similar sequences (don't output these!):

A018928

A077034 (the odd terms)

Body:
Brachylog, 36 bytes

3{@wB:?>:^a+~^=C:B:?:{$pd}ac#d,C:1&}

Try it online!

You have to wait for the program to time out (1 minute) before TIO flushes the output. In SWI-Prolog's REPL this prints as soon as it finds the value.

This will print the sequence forever.

After a few minutes on the offline SWI-Prolog's interpreter, I obtained 90733 after 12325. I stopped it after this point.

This isn't complete bruteforce as it uses constraints to find pythagorean triples, though it is obviously not optimised for speed.

Explanation

3{                                 }    Call this predicate with 3 as Input
  @w                                    Write the Input followed by a line break
    B:?>                                B > Input
           +                            The sum...
        :^a                             ...of Input^2 with B^2...
            ~^                          ...must equal a number which is itself a square
              =C                        Assign a fitting value to that number and call it C
               C:B:?:{$pd}a             Get the lists of prime factors of C, B and Input
                                          without duplicates
                           c#d,         Concatenate into a single list; all values must be
                                          different
                               C:1&     Call recursively with C as Input


问:
My Word can beat up your Word

PROBLEM

Given two words, find the winner in a digital root battle.

Define the digital root of a word this way:

Each letter of the alphabet is assigned a number:  A = 1, B = 2, C = 3, ..., Z = 26

Add the values for each letter to total the word. Take "CAT", for example. C+A+T = 3+1+20 = 24

Add all the single digits that make up that result: 24 => 2 + 4 = 6

Repeat step #3 until you reach a single digit. That single digit is the digital root of the word.

Rules:

A winner is declared if its digital root is larger than the other.

If the digital root values are equal, shorten the words by removing every instance of the highest value letter from both words and recalculating.

Repeat steps #1 and #2 until there is a winner or one of the words has only a single letter (or no letters) remaining.

If the digital root values are equal after going through the shortening process, the longer word is declared the winner.

If the words are of equal length and no winner is found after going through the shortening process, no winner is declared.

Special rules:

No use of modulus is allowed in the calculation of the digital root itself. It can be used anywhere else.

Assume words will consist only of uppercase letters - no punctuation, no spaces, etc.

INPUT

Pull the words in through stdin (comma-separated). method parameters, or however you want. Make it clear in your solution or the code how the words are parsed or prepared.

OUTPUT

Display the winning word. If there is no winner, display "STALEMATE".

Examples:

intput: CAN,BAT

```<code>CAN = 18 = 9
BAT = 23 = 5
</code>```

output: CAN

intput: ZOO,NO

```<code>ZOO = 56 = 11 = 2
NO = 29 = 11 = 2

OO = 30 = 3
N = 14 = 5
</code>```

output: NO

UPDATE: Input must be read using stdin with the words as a comma-separated string.

UPDATE: Added a couple examples to test against.

UPDATE: clarified the removal of the highest valued letter in the case of a tie - this also alters slightly the stop condition as well - if a word is one letter or zero letters long, the shortening process is stopped

答:
Racket 479 bytes

```<code>(define(dl n)(let p((ol '())(n n))(let-values(((q r)(quotient/remainder n 10)))(if(= q 0)(cons r ol)(p(cons r ol)q)))))
(define(dr N)(let p2((n N))(define s(apply +(dl n)))(if(< s 10)s(p2 s))))
(let p3((l(for/list((i(string->list s)))(-(char->integer i)64)))(k(for/list((i(string->list t)))(-(char->integer i)64))))
(let((a(dr(apply + l)))(b(dr(apply + k))))(cond[(> a b)s][(< a b)t][(equal? l k)"STALEMATE"][else(p3(remove*(list(apply max l))l)(remove*(list(apply max k))k))])))
</code>```

Ungolfed:

```<code>(define (f s t)

  (define (getDigitList n)                     ; sub-fn  to get digit list
    (let loop ((ol '())
               (n n))
      (let-values (((q r) (quotient/remainder n 10)))
        (if (= q 0) (cons r ol)
            (loop (cons r ol) q)))))

  (define (digit_root N)                       ; sub-fn to get digital root of a number
    (let loop2 ((n N))
      (define s (apply + (getDigitList n)))
      (if (< s 10)
          s
          (loop2 s))))

  (let loop3 ((l (for/list ((i (string->list s)))  ; actual fn to compare 2 strings
                   (- (char->integer i) 64)))
              (k (for/list ((i (string->list t)))
                   (- (char->integer i) 64))))
    (let ((a (digit_root (apply + l)))
          (b (digit_root (apply + k))))
      (cond
        [(> a b) s]
        [(< a b) t]
        [(equal? l k) "STALEMATE"]
        [else (loop3 (remove* (list (apply max l)) l)
                     (remove* (list (apply max k)) k)
                     )]
        ))))
</code>```

Testing:

```<code>(f "CAN" "BAT")
(f "ZOO" "NO")
</code>```

Output:

```<code>"CAN"
"NO"
</code>```

ContentLicense: CC BY-SA 2.5

Title: My Word can beat up your Word

Body:
Racket 479 bytes

(define(dl n)(let p((ol '())(n n))(let-values(((q r)(quotient/remainder n 10)))(if(= q 0)(cons r ol)(p(cons r ol)q)))))
(define(dr N)(let p2((n N))(define s(apply +(dl n)))(if(< s 10)s(p2 s))))
(let p3((l(for/list((i(string->list s)))(-(char->integer i)64)))(k(for/list((i(string->list t)))(-(char->integer i)64))))
(let((a(dr(apply + l)))(b(dr(apply + k))))(cond[(> a b)s][(< a b)t][(equal? l k)"STALEMATE"][else(p3(remove*(list(apply max l))l)(remove*(list(apply max k))k))])))

Ungolfed:

(define (f s t)

  (define (getDigitList n)                     ; sub-fn  to get digit list
    (let loop ((ol '())
               (n n))
      (let-values (((q r) (quotient/remainder n 10)))
        (if (= q 0) (cons r ol)
            (loop (cons r ol) q)))))

  (define (digit_root N)                       ; sub-fn to get digital root of a number
    (let loop2 ((n N))
      (define s (apply + (getDigitList n)))
      (if (< s 10)
          s
          (loop2 s))))

  (let loop3 ((l (for/list ((i (string->list s)))  ; actual fn to compare 2 strings
                   (- (char->integer i) 64)))
              (k (for/list ((i (string->list t)))
                   (- (char->integer i) 64))))
    (let ((a (digit_root (apply + l)))
          (b (digit_root (apply + k))))
      (cond
        [(> a b) s]
        [(< a b) t]
        [(equal? l k) "STALEMATE"]
        [else (loop3 (remove* (list (apply max l)) l)
                     (remove* (list (apply max k)) k)
                     )]
        ))))

Testing:

(f "CAN" "BAT")
(f "ZOO" "NO")

Output:

"CAN"
"NO"


问:
Encode the alphabet cipher
Given a string that contains only lowercase letters, encode that string with the alphabet cipher.

To encode with the alphabet cipher (I will be using the example hello):

First, convert each letter in the string to a number depending on its position in the alphabet (a = 1, b = 2, etc.) Example: 8 5 12 12 15

Pad each number to two characters with 0s. Example: 08 05 12 12 15

Join. Example: 0805121215

Test cases

```<code>helloworld -> 08051212152315181204
codegolf -> 0315040507151206
alphabetcipher -> 0112160801020520030916080518
johncena -> 1015081403051401
</code>```

Remember, this is code-golf, so the code with the fewest number of bytes wins.

答:
Python, 46 bytes

```<code>lambda x:"".join("%02i"%(ord(j)-96)for j in x)
</code>```

Pretty straightforward. Try it on repl.it!

Title: Encode the alphabet cipher

Body:
Python, 46 bytes

lambda x:"".join("%02i"%(ord(j)-96)for j in x)

Pretty straightforward. Try it on repl.it!


问:
Find the Wavy Words!
(Note: this is an easier spin-off of my previous challenge Find the Infinity Words!, which is a spin-off of my other previous challenge Find the Swirling Words! :) )

Definition of a Wavy Word:

If you connect with curves all the characters of a Wavy Word on the alphabet (A-Z) you obtain the path of a wave continuously going toward right or toward left and never changing direction, like in the diagrams below.

A Wavy Word can be:

Raising if each consecutive character is at the right (on the alphabet) of the previous one.

Decreasing if each consecutive character is at the left (on the alphabet) of the previous one.

All the even connection must be down, all the odd connections must be up.

You can ignore upper/lowercase or consider/convert all to upper case or all to lower case.

The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, or symbols.

If a word has double characters, like "SPOON", you must collapse the doubles to one character: "SPOON" > "SPON" (because if you go from O to O is zero distance).

The Wavy Words will contain at least 3 distinct characters (even after doubles collapsing).

Here there are some examples:

Task:

Write a full program or function that will take a word from standard input and will output if it is a Wavy Word or not, and in positive case, output if it is raising or decreasing. The output can be True/False/Null, 2/1/0, 1/Null/0, -1/0/1, NO/WR/WD, etc, you decide how to represent it.

Test cases:

```<code>WAVY WORDS:
  ADEPT, BEGIN, BILL, BOSS, BOOST, CHIMP,
  KNOW, SPONGE, SPOON, TROLL, WOLF

ADEPT  > YES > RAISING
BEGIN  > YES > RAISING
BILL   > YES > RAISING
BOSS   > YES > RAISING
BOOST  > YES > RAISING
CHIMP  > YES > RAISING
KNOW   > YES > RAISING
SPONGE > YES > DECREASING
SPOON  > YES > DECREASING
TROLL  > YES > DECREASING
WOLF   > YES > DECREASING

NOT WAVY WORDS:
  WATCH, EARTH, NINON, FOO, BAR, WAVE, SELECTION,
  YES, NO, DEFINITION, WATER, WINE, CODE, AAAHHHH, I, MM, ABCA
</code>```

Rules:

Shortest code wins.

Optional Task:

Find, as a list, as many Wavy Words as you can in an English dictionary, and the longest as well. You can take for example as reference the complete list of English words here.

答:
Pyth, 12 bytes

```<code>x*<2lrQ8_BQS
</code>```

Try it online. Test suite.

Title: Find the Wavy Words!

Body:
Pyth, 12 bytes

x*<2lrQ8_BQS

Try it online. Test suite.


答:
05AB1E, <s>11</s> 6 bytes

Code:

```<code>Ç4+€¦J
</code>```

Explanation:

First, we convert the string to their ASCII values. codegolf would become:

```<code>[99, 111, 100, 101, 103, 111, 108, 102]
</code>```

To get to the indices of the alphabet, you subtract 96:

```<code>[3, 15, 4, 5, 7, 15, 12, 6]
</code>```

To pad with zeros, add 100 to each element and remove the first character of each int. For the above example, +100 would be:

```<code>[103, 115, 104, 105, 107, 115, 112, 106]
</code>```

And removing the first character of each would lead to:

```<code>[03, 15, 04, 05, 07, 15, 12, 06]
</code>```

We can merge both steps above (the -96 and the +100) part to just +4. For the code:

```<code>Ç       # Convert to an array of ASCII code points
 4+     # Add four to each element in the array
   €¦   # Remove the first character of each element
     J  # Join to a single string
</code>```

Try it online!

Title: Encode the alphabet cipher

Body:
Given a string that contains only lowercase letters, encode that string with the alphabet cipher.

To encode with the alphabet cipher (I will be using the example hello):

First, convert each letter in the string to a number depending on its position in the alphabet (a = 1, b = 2, etc.) Example: 8 5 12 12 15

Pad each number to two characters with 0s. Example: 08 05 12 12 15

Join. Example: 0805121215

Test cases

```<code>helloworld -> 08051212152315181204
codegolf -> 0315040507151206
alphabetcipher -> 0112160801020520030916080518
johncena -> 1015081403051401
</code>```

Remember, this is code-golf, so the code with the fewest number of bytes wins.

Body:
05AB1E, <s>11</s> 6 bytes

Code:

Ç4+€¦J

Explanation:

First, we convert the string to their ASCII values. codegolf would become:

[99, 111, 100, 101, 103, 111, 108, 102]

To get to the indices of the alphabet, you subtract 96:

[3, 15, 4, 5, 7, 15, 12, 6]

To pad with zeros, add 100 to each element and remove the first character of each int. For the above example, +100 would be:

[103, 115, 104, 105, 107, 115, 112, 106]

And removing the first character of each would lead to:

[03, 15, 04, 05, 07, 15, 12, 06]

We can merge both steps above (the -96 and the +100) part to just +4. For the code:

Ç       # Convert to an array of ASCII code points
 4+     # Add four to each element in the array
   €¦   # Remove the first character of each element
     J  # Join to a single string

Try it online!


答:
JavaScript (ES6), <s>52</s> 49 bytes

```<code>f=s=>s&&(s.charCodeAt()+4+f(s.slice(1))).slice(1)
</code>```

Recursion turned out to be 3 bytes shorter than .replace:

```<code>s=>s.replace(/./g,s=>(s.charCodeAt()+4+"").slice(1))
</code>```

parseInt(s,36) is slightly longer for each approach, because you have to change 4 to 91:

```<code>s=>s.replace(/./g,s=>(parseInt(s,36)+91+"").slice(1))
f=s=>s&&(parseInt(s[0],36)+91+f(s.slice(1))).slice(1)
</code>```

Title: Encode the alphabet cipher

Body:
JavaScript (ES6), <s>52</s> 49 bytes

f=s=>s&&(s.charCodeAt()+4+f(s.slice(1))).slice(1)

Recursion turned out to be 3 bytes shorter than .replace:

s=>s.replace(/./g,s=>(s.charCodeAt()+4+"").slice(1))

parseInt(s,36) is slightly longer for each approach, because you have to change 4 to 91:

s=>s.replace(/./g,s=>(parseInt(s,36)+91+"").slice(1))
f=s=>s&&(parseInt(s[0],36)+91+f(s.slice(1))).slice(1)


答:
Jelly, <s>9</s> 7 bytes

```<code>O+4ṾḊ$€
</code>```

TryItOnline

How?

```<code>O+4ṾḊ$€ - Main link: s                                e.g. hello
O       - cast to ordinals                            e.g. [ 104,  101,  108,  108,  111]
 +4     - add 4                                       e.g. [  108,  109,  112,  112,  115]
     $€ - last two links as a monad for €ach
   Ṿ    -    uneval, effectively converts to strings  e.g. ["108","109","112","112","115"]
    Ḋ   -    dequeue, remove the leading '1'          e.g. [ "08", "09", "12", "12", "15"]
        - implicit print                              e.g. "0809121215"
</code>```

Title: Encode the alphabet cipher

Body:
Jelly, <s>9</s> 7 bytes

O+4ṾḊ$€

TryItOnline

How?

O+4ṾḊ$€ - Main link: s                                e.g. hello
O       - cast to ordinals                            e.g. [ 104,  101,  108,  108,  111]
 +4     - add 4                                       e.g. [  108,  109,  112,  112,  115]
     $€ - last two links as a monad for €ach
   Ṿ    -    uneval, effectively converts to strings  e.g. ["108","109","112","112","115"]
    Ḋ   -    dequeue, remove the leading '1'          e.g. [ "08", "09", "12", "12", "15"]
        - implicit print                              e.g. "0809121215"


答:
Perl, 29 bytes

28 bytes of code + -n flag.

printf"%02s",-96+ord for/./g
```
<p>Run with :</p>
```perl -ne 'printf"%02s",-96+ord for/./g' <<< "helloworld"
```

Title: Encode the alphabet cipher

Body:
Perl, 29 bytes

28 bytes of code + -n flag.

printf"%02s",-96+ord for/./g

Run with :

perl -ne 'printf"%02s",-96+ord for/./g' <<< "helloworld"


问:
Tips for golfing in vim
I've recently realized how vim works great for golfing, especially for kolmogorov-complexity. Also, according to meta vim is a perfectly acceptable 'programming language' at least, for the scope of this site, that is.

What general tips do you have for golfing in Vim? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Vim (e.g. "remove comments" is not an answer).

Please post one tip per answer.

答:
The alphabet in 10 keystrokes

All credit for this technique goes to Lynn, who first used it in this answer. I'm writing it up here for posterity.

Use the following ten keystrokes to yank the lowercase alphabet:

```<code>:h<_␍jjYZZ
</code>```

(Where ␍ is a carriage return, i.e. the Enter key.)

Explanation

:h<_␍ opens the help section v_b_<_example (an example of visual blockwise selection), which happens to contain the text abcdefghijklmnopqrstuvwyxz. jjY moves down to that line and yanks it, then ZZ closes the help window.

Title: Tips for golfing in vim

Body:
The alphabet in 10 keystrokes

All credit for this technique goes to Lynn, who first used it in this answer. I'm writing it up here for posterity.

Use the following ten keystrokes to yank the lowercase alphabet:

:h<_␍jjYZZ

(Where ␍ is a carriage return, i.e. the Enter key.)

Explanation

:h<_␍ opens the help section v_b_<_example (an example of visual blockwise selection), which happens to contain the text abcdefghijklmnopqrstuvwyxz. jjY moves down to that line and yanks it, then ZZ closes the help window.


Title: Encode the alphabet cipher

Body:
C, <s>55</s> 43 bytes

f(char*c){for(;*c;)printf("%02d",*c++-96);}

ideone