答:
Java, <s>185</s> <s>184</s> <s>167</s> 152 bytes

```<code>S->S.map(s->{s=s.replace("\t","    ");String t=s.replaceAll("^ +","");int n=s.length()-t.length();if(n>3){s="/";for(;n-->2;)s+="*";s+="/"+t;}return s;})
</code>```

Given the very loose definition of string array given in the initial post, I've used Stream<String> which allows for some consequent byte savings.

I used different techniques than the RI to achieve the same goal. The algorithm itself is rather the same.

Testing and ungolfed:

```<code>import java.util.Arrays;
import java.util.stream.Stream;

public class Main {

  public static void main(String[] args) {
    StringStreamTransformer sst = lines -> lines.map(line -> {
      line = line.replace("\t","    ");
      String trimmed = line.replaceAll("^ +", "");
      int startingSpaces = line.length() - trimmed.length();
      if (startingSpaces > 3) {
        line = "/";
        for(;startingSpaces > 2; startingSpaces--) {
          line += "*";
        }
        line += "/" + trimmed;
      }
      return line;
    });

    Stream<String> lines = Arrays.stream(new String[]{
      "lots of spaces and tabs after\t\t    \t\t         \t\t\t\t\t",
      "no space",
      " 1 space",
      "  2 spaces",
      "   3 spaces",
      "    4 spaces",
      "     5 spaces",
      "      6 spaces",
      "       7 spaces",
      "        8 spaces",
      "\t1 tab",
      "\t\t2 tabs",
      "\t\t\t3 tabs"
    });
    sst.map(lines).map(s -> s.replace(" ", ".").replace("\t","-")).forEach(System.out::println);

  }
}
</code>```

Title: End the tabs versus space war

Body:
End the tabs versus space war

So, there has been a great deal of debate of whether to use tabs or spaces to indent/format code. Can you help the university settle the dispute, by going to an incredibly <s>crazy</s> unique method of formatting.

Your job is to write a full program or function which expands all tabs into four spaces. And then replaces a run of n leading spaces with "/(n - two stars here)/". You will receive input over multiple lines in any reasonable format (single string array of strings for each new line. Columnar array etc.)

Sample input shamelessly stolen. Note that since tabs get automagically expanded to four spaces on SE I represent it as the "^" character, but you must handle tabs (codepoint 0x09) as well. All "^" characters represent a tabulation.

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
    Not zero so multiply by 256 again to get 65536
    [>++++<-]>[<++++++++>-]<[>++++++++<-]
    +>[>
        # Print "32"
        ++++++++++[>+++++<-]>+.-.[-]<
    <[-]<->] <[>>
        # Print "16"
        +++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
    # Print "8"
    ++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
^this is preceded by a tab
^^two tabs
^^^three tabs etcetera!
</code>```

Sample output

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
/**/Not zero so multiply by 256 again to get 65536
/**/[>++++<-]>[<++++++++>-]<[>++++++++<-]
/**/+>[>
/******/# Print "32"
/******/++++++++++[>+++++<-]>+.-.[-]<
/**/<[-]<->] <[>>
/******/# Print "16"
/******/+++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
/**/# Print "8"
/**/++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
/**/this is preceded by a tab
/******/two tabs
/**********/three tabs etcetera!
</code>```

Because the university needs space to download both Vim and Emacs, you are allowed very little storage for your code. Therefore this is code-golf and the shortest code wins. You may assume that input is well formed and lines with less than four spaces (after replacement of tabs) may result in undefined behavior.

Disclaimer

This "excellent" formatting strategy came courtesy of Geobits, and is reproduced with his permission. No programmers were harmed during the production of this challenge.

Body:
Java, <s>185</s> <s>184</s> <s>167</s> 152 bytes

S->S.map(s->{s=s.replace("\t","    ");String t=s.replaceAll("^ +","");int n=s.length()-t.length();if(n>3){s="/";for(;n-->2;)s+="*";s+="/"+t;}return s;})

Given the very loose definition of string array given in the initial post, I've used Stream<String> which allows for some consequent byte savings.

I used different techniques than the RI to achieve the same goal. The algorithm itself is rather the same.

Testing and ungolfed:

import java.util.Arrays;
import java.util.stream.Stream;

public class Main {

  public static void main(String[] args) {
    StringStreamTransformer sst = lines -> lines.map(line -> {
      line = line.replace("\t","    ");
      String trimmed = line.replaceAll("^ +", "");
      int startingSpaces = line.length() - trimmed.length();
      if (startingSpaces > 3) {
        line = "/";
        for(;startingSpaces > 2; startingSpaces--) {
          line += "*";
        }
        line += "/" + trimmed;
      }
      return line;
    });

    Stream<String> lines = Arrays.stream(new String[]{
      "lots of spaces and tabs after\t\t    \t\t         \t\t\t\t\t",
      "no space",
      " 1 space",
      "  2 spaces",
      "   3 spaces",
      "    4 spaces",
      "     5 spaces",
      "      6 spaces",
      "       7 spaces",
      "        8 spaces",
      "\t1 tab",
      "\t\t2 tabs",
      "\t\t\t3 tabs"
    });
    sst.map(lines).map(s -> s.replace(" ", ".").replace("\t","-")).forEach(System.out::println);

  }
}


问:
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-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. :D

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 infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

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 Brainf**k-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.

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//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"//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}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;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">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
T-SQL, 8 bytes

```<code>l:goto l
</code>```

(Not to be confused with this excellent answer from @MickyT    in Standard SQL)

ContentLicense: CC BY-SA 3.0

Body:
T-SQL, 8 bytes

l:goto l

(Not to be confused with this excellent answer from @MickyT    in Standard SQL)


问:
Print numbers from 1 to 10
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:

Print all Integers from 1 to 10 inclusive in ascending order to standard output.

Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and prefixes and postfixes (like [...]). However, you may not output any other numbers than 1 through 10. Your program may not take any input. Standard loopholes are disallowed.

This is code-golf, so shortest answer in bytes wins!

Leaderboard

var QUESTION_ID=86075,OVERRIDE_USER=42570;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

```

答:
Java, 47 bytes

```<code>()->{for(int i=0;i++<10;System.out.print(i));};
</code>```

Ungolfed test program

```<code>public static void main(String[] args) {
    Runnable r = () -> {
        for (int i = 0; i++ < 10; System.out.print(i));
    };

    r.run();
}
</code>```

36 bytes + imports

```<code>()->IntStream.range(0,11).toArray();
</code>```

Doesn't include imports :(

Title: Print numbers from 1 to 10

Body:
Java, 47 bytes

()->{for(int i=0;i++<10;System.out.print(i));};

Ungolfed test program

public static void main(String[] args) {
    Runnable r = () -> {
        for (int i = 0; i++ < 10; System.out.print(i));
    };

    r.run();
}

36 bytes + imports

()->IntStream.range(0,11).toArray();

Doesn't include imports :(

ContentLicense: CC BY-SA 4.0


问:
Subtract the next numbers

Description

Subtract the next P numbers from a N number. The next number of N is N + 1.

Look at the examples to get what I mean.

Examples:

```<code>Input: N=2,P=3
Calculate: n - (n+1) - (n+2) - (n+3)     //Ending with 3, because P=3
Calculate: 2 -  2+1  -  2+2  - 2+3       //Replacing N with 2 from Input
Calculate: 2 -  3    -  4    - 5
Output: -10

Input: N=100,P=5
Calculate: n - (n+1) - (n+2) - (n+3) - (n+4) - (n+5)
Calculate: 100-  101 -  102  -  103  -  104  - 105
Output: -415

Input: N=42,P=0
Calculate: n
Calculate: 42
Output: 42

Input: N=0,P=3
Calculate: n - (n+1) - (n+2) - (n+3)
Calculate: 0 -  1    -  2    -  3
Output: -6

Input: N=0,P=0
Calulate: n
Calculate: 0
Output: 0
</code>```

Input:

N: Integer, positive, negative or 0

P: Integer, positive or 0, not negative

Output:

Integer or String, leading 0 allowed, trailing newline allowed

Rules:

No loopholes

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

Input and Output must be as described

答:
C#, 21 20 bytes

Edit: Saved one byte thanks to TheLethalCoder

```<code>N=>P=>N-P++*(N+P/2);
</code>```

Try it online!

Full source, including test cases:

```<code>using System;

namespace substract
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<int,Func<int,int>>s=N=>P=>N-P++*(N+P/2);
            Console.WriteLine(s(2)(3));     //-10
            Console.WriteLine(s(100)(5));   //-415
            Console.WriteLine(s(42)(0));    //42
            Console.WriteLine(s(0)(3));     //-6
            Console.WriteLine(s(0)(0));     //0

        }
    }
}
</code>```

Title: Subtract the next numbers

Body:
C#, 21 20 bytes

Edit: Saved one byte thanks to TheLethalCoder

N=>P=>N-P++*(N+P/2);

Try it online!

Full source, including test cases:

using System;

namespace substract
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<int,Func<int,int>>s=N=>P=>N-P++*(N+P/2);
            Console.WriteLine(s(2)(3));     //-10
            Console.WriteLine(s(100)(5));   //-415
            Console.WriteLine(s(42)(0));    //42
            Console.WriteLine(s(0)(3));     //-6
            Console.WriteLine(s(0)(0));     //0

        }
    }
}


答:
S.I.L.O.S, 11 bytes

```<code>lbla
GOTO a
</code>```

Title: Shortest infinite loop producing no output

Body:
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-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. :D

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 infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

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 Brainf**k-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.

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//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"//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}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;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">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

Body:
S.I.L.O.S, 11 bytes

lbla
GOTO a


答:
Java, 50 bytes

```<code>interface D{static void main(String[]a){for(;;);}}
</code>```

Body:
Java, 50 bytes

interface D{static void main(String[]a){for(;;);}}


问:
Write a program that always outputs "2012" - even if it's modified!
This idea is not mine, though I don't know where it originated. I once met it in a programming contest very long ago (1998, if I remember correctly). The task is to write a program in your favorite language that outputs 2012 and only 2012. The catch is that the program must still output 2012 after any one of its characters is modified. The modification can be either insertion, deletion or replacement. Of course, the modification will be such that the program is still syntactically valid.

Since I don't know all the programming languages, I have to ask the audience to help me and test the answers submitted.

Added: Many have commented that my definition of acceptable modifications is too vague. Here's my second attempt: The allowed modifications will leave your program syntactically valid and will not cause it to crash. There, I think that should cover all the compile-time, link-time and run-time errors. Though I'm sure that there will be some odd edge case in some language anyway, so when that comes up we'll look at it individually.

答:
Ruby 1.9 - 43 chars

```<code>qq=[:p,2012]
b if qq!=[:p,2012]
send(
*qq)
</code>```

Not tested, so break away.

Body:
Ruby 1.9 - 43 chars

qq=[:p,2012]
b if qq!=[:p,2012]
send(
*qq)

Not tested, so break away.


问:
Hate/love conundrum

Challenge description

In this challenge, we only consider love and hate as feelings. If we want to utter a feeling expression of order N, we alternate between these two (starting with hate):

```<code>order | expression

1       I hate it.
2       I hate that I love it.
3       I hate that I love that I hate it.
4       I hate that I love that I hate that I love it.
</code>```

The pattern follows for every positive integer N. Given N, output the correspoinding feeling expression of order N.

Notes

Full stop (.) at the end of the expression is mandatory,

Trailing and leading whitespaces (including newlines) are permitted,

Output for a non-positive or non-integer N is undefined,

This is a code-golf challenge, so make your code as short as possible!

Title: Hate/love conundrum

Body:
Thue, 100 bytes

@::=:::
>##::=>$.
$::=~I hate that I love
>.#::=>&#
&::=~that
>#<::=~I hate it.
>.<::=~it.
::=
>@<

Takes input as unary. (A string of n #s)


问:
The world is like a Mirror: smile and it'll sɯıןǝ qɐɔʞ
Input:

A string only containing the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) and two special characters (_ and |)

Output:

Mirror the text based on the position(s) of the _ and |.

_ mirrors horizontally and | mirrors vertically.

Mirroring process

The first _ indicates the start of the mirroring of that substring, the second _ the end.

If just one _ is present, you can continue on until the end of the string.

If more then two _ are present, the same process repeats.

There can only be one | in the string, and this reversed the first substring and removes the second substring.

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) will be converted to ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ (space at the end) when it is mirrored by _ (click the link for the unicode values - requires unicode v8.0+).

Example input 1: _Will I be mirrored?!

Output 1: Mıll I qǝ ɯıɹɹoɹǝp¿¡

Example input 2: Wi_ll I be mi_rrored?!

Output 2: Will I qǝ ɯırrored?!

When it is mirrored by | we simply reverse the substring from 0 to index-of-|.

Example input 1: Will I be mirror|ed?!

Output 1: Will I be mirrorrorrim eb I lliW

Both mirrors (_ and |) can be present in the string.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_Will I be mirrored?!                          ->   Mıll I qǝ ɯıɹɹoɹǝp¿¡
Wi_ll I be mi_rrored?!                         ->   Will I qǝ ɯırrored?!
Will I be mirror|ed?!                          ->   Will I be mirrorrorrim eb I lliW
This_ is a test_ cont_aining bo|t_h mirrors.   ->   This ıs ɐ ʇǝsʇ contɐıuıuɓ qooq ɓuıuıɐtnoc ʇsǝʇ ɐ sı sihT
0_1_2_3_4_5|_6_7_8_9                           ->   0⇂2Ɛ4ϛϛ4Ɛ2⇂0
</code>```

答:
Javascript (ES5), 344 340 bytes

```<code>function mirror(a){d=[];~a.indexOf("|")&&(a=a.split("|")[0]+a.split("|")[0].split("").reverse().join(""));for(var c=!1,b=0;b<a.length;++b)"_"==a[b]&&(c=!c),d[b]=c?"zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(a[b])]:a[b];return d.join("")}
</code>```

Ungolfed:

```<code>function mirror_u(s){return "zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(s)]};

function mirror(str){var b=[];
if(~str.indexOf("|"))str=str.split("|")[0]+str.split("|")[0].split("").reverse().join("");
    var is_mirrored=false;
    for(var i=0;i<str.length;++i){
        if(str[i]=="_")is_mirrored=!is_mirrored;
        if(is_mirrored){b[i]=mirror_u(str[i])}else{b[i]=str[i]};
    }
    return b.join("");
}
</code>```

EDIT: Longer working code, that is mirrored | by character 341.

```<code>function mirror(a){d=[];~a.indexOf("|")&&(a=a.split("|")[0]+a.split("|")[0].split("").reverse().join(""));for(var c=!1,b=0;b<a.length;++b)"_"==a[b]&&(c=!c),d[b]=c?"zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(a[b])]:a[b];return d.join("")}//})""(nioj.d nruter;]b[a:])]b[a(fOxedni." !?.1234567890ABCDEFGHJIKLMONPQRSTUVWXYZabcdefghjiklmnopqrstuvwxyz"[" ¡¿˙⇂ᘔƐ߈59ㄥ860ⱯᗺƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Zɐqɔpǝɟɓɥᴉɾʞlɯuodbɹsʇnʌʍxʎz"?c=]b[d,)c!=c(&&]b[a=="_")b++;htgnel.a<b;0=b,1!=c rav(rof;))""(nioj.)(esrever.)""(tilps.]0[)"|"(tilps.a+]0[)"|"(tilps.a=a(&&)"|"(fOxedni.a~;][=d{)a(rorrim noitcnuf
</code>```

Body:
Javascript (ES5), 344 340 bytes

function mirror(a){d=[];~a.indexOf("|")&&(a=a.split("|")[0]+a.split("|")[0].split("").reverse().join(""));for(var c=!1,b=0;b<a.length;++b)"_"==a[b]&&(c=!c),d[b]=c?"zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(a[b])]:a[b];return d.join("")}

Ungolfed:

function mirror_u(s){return "zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(s)]};

function mirror(str){var b=[];
if(~str.indexOf("|"))str=str.split("|")[0]+str.split("|")[0].split("").reverse().join("");
    var is_mirrored=false;
    for(var i=0;i<str.length;++i){
        if(str[i]=="_")is_mirrored=!is_mirrored;
        if(is_mirrored){b[i]=mirror_u(str[i])}else{b[i]=str[i]};
    }
    return b.join("");
}

EDIT: Longer working code, that is mirrored | by character 341.

function mirror(a){d=[];~a.indexOf("|")&&(a=a.split("|")[0]+a.split("|")[0].split("").reverse().join(""));for(var c=!1,b=0;b<a.length;++b)"_"==a[b]&&(c=!c),d[b]=c?"zʎxʍʌnʇsɹbdouɯlʞɾᴉɥɓɟǝpɔqɐZ⅄XMΛ∩⊥SᴚΌԀONW⅂⋊ſIH⅁ℲƎᗡƆᗺⱯ068ㄥ95߈Ɛᘔ⇂˙¿¡ "["zyxwvutsrqponmlkijhgfedcbaZYXWVUTSRQPNOMLKIJHGFEDCBA0987654321.?! ".indexOf(a[b])]:a[b];return d.join("")}//})""(nioj.d nruter;]b[a:])]b[a(fOxedni." !?.1234567890ABCDEFGHJIKLMONPQRSTUVWXYZabcdefghjiklmnopqrstuvwxyz"[" ¡¿˙⇂ᘔƐ߈59ㄥ860ⱯᗺƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Zɐqɔpǝɟɓɥᴉɾʞlɯuodbɹsʇnʌʍxʎz"?c=]b[d,)c!=c(&&]b[a=="_")b++;htgnel.a<b;0=b,1!=c rav(rof;))""(nioj.)(esrever.)""(tilps.]0[)"|"(tilps.a+]0[)"|"(tilps.a=a(&&)"|"(fOxedni.a~;][=d{)a(rorrim noitcnuf


问:
Exploded view of a string
Don't you love those exploded-view diagrams  in which a machine or object is taken apart into its smallest pieces?

Let's do that to a string!

The challenge

Write a program or function that

inputs a string containing only printable ASCII characters;

dissects the string into groups of non-space equal characters (the "pieces" of the string);

outputs those groups in any convenient format, with some separator between groups.

For example, given the string

```<code>Ah, abracadabra!
</code>```

the output would be the following groups:

```
!
,
A
aaaaa
bb
c
d
h
rr
```

Each group in the output contains equal characters, with spaces removed. A newline has been used as separator between groups. More about allowed formats below.

Rules

The input should be a string or an array of chars. It will only contain printable ASCII chars (the inclusive range from space to tilde). If your language does not support that, you can take the input in the form of numbers representing ASCII codes.

You can assume that the input contains at least one non-space character.

The output should consist of characters (even if the input is by means of ASCII codes). There has to be an unambiguous separator between groups, different than any non-space character that may appear in the input.

If the output is via function return, it may also be an array or strings, or an array of arrays of chars, or similar structure. In that case the structure provides the necessary separation.

A separator between characters of each group is optional. If there is one, the same rule applies: it can't be a non-space character that may appear in the input. Also, it can't be the same separator as used between groups.

Other than that, the format is flexible. Here are some examples:

The groups may be strings separated by newlines, as shown above.

The groups may be separated by any non-ASCII character, such as  ¬. The output for the above input would be the string:

```<code>!¬,¬A¬aaaaa¬bb¬c¬d¬h¬rr
</code>```

The groups may be separated by n>1 spaces (even if n is variable), with chars between each group separated by a single space:

```<code>!  ,    A   a a a a a    b b  c       d   h  r r
</code>```

The output may also be an array or list of strings returned by a function:

```<code>['!', 'A', 'aaaaa', 'bb', 'c', 'd', 'h', 'rr']
</code>```

Or an array of char arrays:

```<code>[['!'], ['A'], ['a', 'a', 'a', 'a', 'a'], ['b', 'b'], ['c'], ['d'], ['h'], ['r', 'r']]
</code>```

Examples of formats that are not allowed, according to the rules:

A comma can't be used as separator (!,,,A,a,a,a,a,a,b,b,c,d,h,r,r), because the input may contain commas.

It's not accepted to drop the separator between groups (!,Aaaaaabbcdhrr) or to use the same separator between groups and within groups (! , A a a a a a b b c d h r r).

The groups may appear in any order in the output. For example: alphabetical order (as in the examples above), order of first appearance in the string, ... The order need not be consistent or even deterministic.

Note that the input cannot contain newline characters, and A and a are different characters (grouping is case-sentitive).

Shortest code in bytes wins.

Test cases

In each test case, first line is input, and the remaining lines are the output, with each group in a different line.

Test case 1:

```
Ah, abracadabra!
!
,
A
aaaaa
bb
c
d
h
rr
```

Test case 2:

```
\o/\o/\o/
///
\\\
ooo
```

Test case 3:

```
A man, a plan, a canal: Panama!
!
,,
:
A
P
aaaaaaaaa
c
ll
mm
nnnn
p
```

Test case 4:

```
"Show me how you do that trick, the one that makes me scream" she said
""
,
S
aaaaa
cc
dd
eeeeeee
hhhhhh
ii
kk
mmmm
n
ooooo
rr
ssss
tttttt
u
ww
y
```

答:
R, 67 bytes

Even though there's already an R-answer by @Frédéric I thought my solution deserves it's own answer because it's conceptually different.

```<code>for(i in unique(x<-strsplit(readline(),"")[[1]]))cat(x[x%in%i]," ")
</code>```

The program prints the ascii characters in order of appearence in the string where groups are separated by two white spaces and chars within groups by one white space. A special case is if the string has whitespaces in itself, then at one specific place in the output there will be 4+number of white spaces in string white spaces separating two groups E.g:

Ah, abracadabra! => A  h  ,     a a a a a  b b  r r  c  d  !

Ungolfed

Split up the code for clarity even though assignment is done within the unique functions and changed to order of evaluation:

```<code>x<-strsplit(readline(),"")[[1]]) # Read string from command line and convert into vector

for(i in unique(x){              # For each unique character of the string, create vector
  cat(x[x%in%i]," ")             # of TRUE/FALSE and return the elements in x for which
}                                # these are matched
</code>```

Title: Exploded view of a string

Body:
R, 67 bytes

Even though there's already an R-answer by @Frédéric I thought my solution deserves it's own answer because it's conceptually different.

for(i in unique(x<-strsplit(readline(),"")[[1]]))cat(x[x%in%i]," ")

The program prints the ascii characters in order of appearence in the string where groups are separated by two white spaces and chars within groups by one white space. A special case is if the string has whitespaces in itself, then at one specific place in the output there will be 4+number of white spaces in string white spaces separating two groups E.g:

Ah, abracadabra! => A  h  ,     a a a a a  b b  r r  c  d  !

Ungolfed

Split up the code for clarity even though assignment is done within the unique functions and changed to order of evaluation:

x<-strsplit(readline(),"")[[1]]) # Read string from command line and convert into vector

for(i in unique(x){              # For each unique character of the string, create vector
  cat(x[x%in%i]," ")             # of TRUE/FALSE and return the elements in x for which
}                                # these are matched


答:
Pyke, 36 bytes

```<code>2/"I hate ""I love "]*"that "J"it."+
</code>```

Try it here!

```<code>2/                                   -    input/2
                     *               -   ^ * v
  "I hate ""I love "]                -    ["I hate ", "I love "]
                      "that "J       -  "that ".join(^)
                              "it."+ - ^+"it."
</code>```

Also 36 bytes

```<code>12*5+.daෆ   ű   l5d+12"I ":Q*<"it."+
</code>```

Try it here! (Link uses X instead of I, this should work for the same amount of bytes offline where you can literally use those bytes. Online \r gets automatically replaced with \n)

Title: Hate/love conundrum

Body:
Challenge description

In this challenge, we only consider love and hate as feelings. If we want to utter a feeling expression of order N, we alternate between these two (starting with hate):

```<code>order | expression

1       I hate it.
2       I hate that I love it.
3       I hate that I love that I hate it.
4       I hate that I love that I hate that I love it.
</code>```

The pattern follows for every positive integer N. Given N, output the correspoinding feeling expression of order N.

Notes

Full stop (.) at the end of the expression is mandatory,

Trailing and leading whitespaces (including newlines) are permitted,

Output for a non-positive or non-integer N is undefined,

This is a code-golf challenge, so make your code as short as possible!

Body:
Pyke, 36 bytes

2/"I hate ""I love "]*"that "J"it."+

Try it here!

2/                                   -    input/2
                     *               -   ^ * v
  "I hate ""I love "]                -    ["I hate ", "I love "]
                      "that "J       -  "that ".join(^)
                              "it."+ - ^+"it."

Also 36 bytes

12*5+.daෆ   ű   l5d+12"I ":Q*<"it."+

Try it here! (Link uses X instead of I, this should work for the same amount of bytes offline where you can literally use those bytes. Online \r gets automatically replaced with \n)


Title: Subtract the next numbers

Body:
Description

Subtract the next P numbers from a N number. The next number of N is N + 1.

Look at the examples to get what I mean.

Examples:

```<code>Input: N=2,P=3
Calculate: n - (n+1) - (n+2) - (n+3)     //Ending with 3, because P=3
Calculate: 2 -  2+1  -  2+2  - 2+3       //Replacing N with 2 from Input
Calculate: 2 -  3    -  4    - 5
Output: -10

Input: N=100,P=5
Calculate: n - (n+1) - (n+2) - (n+3) - (n+4) - (n+5)
Calculate: 100-  101 -  102  -  103  -  104  - 105
Output: -415

Input: N=42,P=0
Calculate: n
Calculate: 42
Output: 42

Input: N=0,P=3
Calculate: n - (n+1) - (n+2) - (n+3)
Calculate: 0 -  1    -  2    -  3
Output: -6

Input: N=0,P=0
Calulate: n
Calculate: 0
Output: 0
</code>```

Input:

N: Integer, positive, negative or 0

P: Integer, positive or 0, not negative

Output:

Integer or String, leading 0 allowed, trailing newline allowed

Rules:

No loopholes

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

Input and Output must be as described

Body:
C89, <s>38</s>, <s>35</s>, 33 bytes

h(n,p,r)int*r;{*r=n-p++*(n+p/2);}

Test it on Coliru.


答:
JavaScript (ES6), 308 bytes

s=>s[r='replace'](/_.*?(_|$)/g,m=>m[r](/./g,c=>'| ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡'['| abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?!B'.indexOf(c)]||''))[r](/(.*)\|.*/,(m,t)=>t+[...t].reverse().join``)
```

<h2>Test</h2>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var solution =

s=>
  s[r='replace'](/_.*?(_|$)/g,m=>
    m[r](/./g,c=>
      '| ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡'
        ['| abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?!B'
          .indexOf(c)]||''
    )
  )
  [r](/(.*)\|.*/,(m,t)=>t+[...t].reverse().join``)

var testCases = [
  '_Will I be mirrored?!',
  'Wi_ll I be mi_rrored?!',
  'Will I be mirror|ed?!',
  'This_ is a test_ cont_aining bo|t_h mirrors.',
  '0_1_2_3_4_5|_6_7_8_9'
];
tests.textContent = testCases.map((c) => c + '   =>   ' + solution(c)).join('\n');</code>```

<input type="text" oninput="result.textContent=solution(this.value)" value="This_ is a test_ cont_aining bo|t_h mirrors." />
```<pre id="tests">``````

Title: The world is like a Mirror: smile and it'll sɯıןǝ qɐɔʞ

Body:
Input:

A string only containing the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) and two special characters (_ and |)

Output:

Mirror the text based on the position(s) of the _ and |.

_ mirrors horizontally and | mirrors vertically.

Mirroring process

The first _ indicates the start of the mirroring of that substring, the second _ the end.

If just one _ is present, you can continue on until the end of the string.

If more then two _ are present, the same process repeats.

There can only be one | in the string, and this reversed the first substring and removes the second substring.

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) will be converted to ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ (space at the end) when it is mirrored by _ (click the link for the unicode values - requires unicode v8.0+).

Example input 1: _Will I be mirrored?!

Output 1: Mıll I qǝ ɯıɹɹoɹǝp¿¡

Example input 2: Wi_ll I be mi_rrored?!

Output 2: Will I qǝ ɯırrored?!

When it is mirrored by | we simply reverse the substring from 0 to index-of-|.

Example input 1: Will I be mirror|ed?!

Output 1: Will I be mirrorrorrim eb I lliW

Both mirrors (_ and |) can be present in the string.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_Will I be mirrored?!                          ->   Mıll I qǝ ɯıɹɹoɹǝp¿¡
Wi_ll I be mi_rrored?!                         ->   Will I qǝ ɯırrored?!
Will I be mirror|ed?!                          ->   Will I be mirrorrorrim eb I lliW
This_ is a test_ cont_aining bo|t_h mirrors.   ->   This ıs ɐ ʇǝsʇ contɐıuıuɓ qooq ɓuıuıɐtnoc ʇsǝʇ ɐ sı sihT
0_1_2_3_4_5|_6_7_8_9                           ->   0⇂2Ɛ4ϛϛ4Ɛ2⇂0
</code>```

Body:
JavaScript (ES6), 308 bytes

s=>s[r='replace'](/_.*?(_|$)/g,m=>m[r](/./g,c=>'| ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡'['| abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?!B'.indexOf(c)]||''))[r](/(.*)\|.*/,(m,t)=>t+[...t].reverse().join``)

Test

var solution =

s=>
  s[r='replace'](/_.*?(_|$)/g,m=>
    m[r](/./g,c=>
      '| ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡'
        ['| abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?!B'
          .indexOf(c)]||''
    )
  )
  [r](/(.*)\|.*/,(m,t)=>t+[...t].reverse().join``)

var testCases = [
  '_Will I be mirrored?!',
  'Wi_ll I be mi_rrored?!',
  'Will I be mirror|ed?!',
  'This_ is a test_ cont_aining bo|t_h mirrors.',
  '0_1_2_3_4_5|_6_7_8_9'
];
tests.textContent = testCases.map((c) => c + '   =>   ' + solution(c)).join('\n');

<input type="text" oninput="result.textContent=solution(this.value)" value="This_ is a test_ cont_aining bo|t_h mirrors." /><pre id="result"></pre><pre id="tests"></pre>


问:
End the tabs versus space war

End the tabs versus space war

So, there has been a great deal of debate of whether to use tabs or spaces to indent/format code. Can you help the university settle the dispute, by going to an incredibly <s>crazy</s> unique method of formatting.

Your job is to write a full program or function which expands all tabs into four spaces. And then replaces a run of n leading spaces with "/(n - two stars here)/". You will receive input over multiple lines in any reasonable format (single string array of strings for each new line. Columnar array etc.)

Sample input shamelessly stolen. Note that since tabs get automagically expanded to four spaces on SE I represent it as the "^" character, but you must handle tabs (codepoint 0x09) as well. All "^" characters represent a tabulation.

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
    Not zero so multiply by 256 again to get 65536
    [>++++<-]>[<++++++++>-]<[>++++++++<-]
    +>[>
        # Print "32"
        ++++++++++[>+++++<-]>+.-.[-]<
    <[-]<->] <[>>
        # Print "16"
        +++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
    # Print "8"
    ++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
^this is preceded by a tab
^^two tabs
^^^three tabs etcetera!
</code>```

Sample output

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
/**/Not zero so multiply by 256 again to get 65536
/**/[>++++<-]>[<++++++++>-]<[>++++++++<-]
/**/+>[>
/******/# Print "32"
/******/++++++++++[>+++++<-]>+.-.[-]<
/**/<[-]<->] <[>>
/******/# Print "16"
/******/+++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
/**/# Print "8"
/**/++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
/**/this is preceded by a tab
/******/two tabs
/**********/three tabs etcetera!
</code>```

Because the university needs space to download both Vim and Emacs, you are allowed very little storage for your code. Therefore this is code-golf and the shortest code wins. You may assume that input is well formed and lines with less than four spaces (after replacement of tabs) may result in undefined behavior.

Disclaimer

This "excellent" formatting strategy came courtesy of Geobits, and is reproduced with his permission. No programmers were harmed during the production of this challenge.

答:
Ruby, <s>52</s> 47 + 1 (p flag) = 48 bytes

Edit: saved whole 5 bytes, thanks to Value Ink

```<code>ruby -pe 'gsub ?\t," "*4;sub(/^ +/){?/+?**($&.size-2)+?/}'
</code>```

Title: End the tabs versus space war

Body:
Ruby, <s>52</s> 47 + 1 (p flag) = 48 bytes

Edit: saved whole 5 bytes, thanks to Value Ink

ruby -pe 'gsub ?\t," "*4;sub(/^ +/){?/+?**($&.size-2)+?/}'


Title: Subtract the next numbers

Body:
php, 38 bytes

<?=$argv[1]*(1-$a=$argv[2])-$a++*$a/2;


问:
10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)
Just had a 'spirited' conversation with a co-worker about the succinctness of the following BASIC statement:

```<code>10 PRINT CHR$(205.5+RND(1)); : GOTO 10
</code>```

It's the title of this book, and will simply print a sequence of / and \ characters, alternating between the two randomly, resulting in a pattern similar to this:

(Image borrowed from http://www.flickr.com/photos/rndmcnlly/5058442151/sizes/o/in/photostream/)

Being of a PHP proclivity, we wondered what the most compact way of writing the same thing in PHP would be, and came up with this:

```<code>while(1) { echo chr(47 + 45 * rand(0,1)); }
</code>```

chr(47) is a / character, and chr(92) is a \. So the statement echo chr(47 + 45 * rand(0,1)); will randomly alternate between the two, ad nauseam.

In a language of your choosing, write the shortest program or function to output an infinite random sequence of \ and / characters, where each character has an equal probability of being chosen.

答:
C++, 45 Chars

```<code>int main(){for(;;)cout<<(rand()%2?"/":"\\");}
</code>```

Not going to win any awards for shortness, but I had already written this when I heard about the mentioned book, so I just golfed it.

The putchar trick also works in C++, getting you down to 43, but you can't avoid declaring the return type on main.

OwnerDisplayName: Judy

Body:
C++, 45 Chars

int main(){for(;;)cout<<(rand()%2?"/":"\\");}

Not going to win any awards for shortness, but I had already written this when I heard about the mentioned book, so I just golfed it.

The putchar trick also works in C++, getting you down to 43, but you can't avoid declaring the return type on main.


问:
Print a 10 by 10 grid of asterisks

Background

This is a standard textbook example to demonstrate for loops.

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

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

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

Scoring

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

答:
Thue, 30 bytes

```<code>%::=~**********
::=
%%%%%%%%%%
</code>```

Try it online!

Thue, 53 bytes

```<code>%::=,*,*
>*::=>[
>,::=>]]
[::=~
]::=~*****
::=
>%%%%%
</code>```

Uses the convention that "when a string is sent to the output stream, no newline is printed at the end, except if the string is empty, in which case a newline is all that is printed." This is not followed by the TIO interpreter.

Title: Print a 10 by 10 grid of asterisks

Body:
Thue, 30 bytes

%::=~**********
::=
%%%%%%%%%%

Try it online!

Thue, 53 bytes

%::=,*,*
>*::=>[
>,::=>]]
[::=~
]::=~*****
::=
>%%%%%

Uses the convention that "when a string is sent to the output stream, no newline is printed at the end, except if the string is empty, in which case a newline is all that is printed." This is not followed by the TIO interpreter.


答:
PHP, 33 Bytes

```<code>$n-=$n*$p+array_sum(range(0,$p));
</code>```

Title: Subtract the next numbers

Body:
PHP, 33 Bytes

$n-=$n*$p+array_sum(range(0,$p));


答:
V, <s>21</s>, 20 bytes

```<code>Íô/
Î^hr/hv0r*r/
</code>```

Try it online!

This is literally just a direct port of my vim answer. The notable differences:

The Í command (Global substitute) automatically fills in the /g flag, which saves two bytes

ô is identical to \t

Î Is a mnemonic for :%norm, and it also fills in the necessary space between :%norm and the set of keystrokes.

The trailing carriage return at the end is implicitly added.

Title: End the tabs versus space war

Body:
End the tabs versus space war

So, there has been a great deal of debate of whether to use tabs or spaces to indent/format code. Can you help the university settle the dispute, by going to an incredibly <s>crazy</s> unique method of formatting.

Your job is to write a full program or function which expands all tabs into four spaces. And then replaces a run of n leading spaces with "/(n - two stars here)/". You will receive input over multiple lines in any reasonable format (single string array of strings for each new line. Columnar array etc.)

Sample input shamelessly stolen. Note that since tabs get automagically expanded to four spaces on SE I represent it as the "^" character, but you must handle tabs (codepoint 0x09) as well. All "^" characters represent a tabulation.

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
    Not zero so multiply by 256 again to get 65536
    [>++++<-]>[<++++++++>-]<[>++++++++<-]
    +>[>
        # Print "32"
        ++++++++++[>+++++<-]>+.-.[-]<
    <[-]<->] <[>>
        # Print "16"
        +++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
    # Print "8"
    ++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
^this is preceded by a tab
^^two tabs
^^^three tabs etcetera!
</code>```

Sample output

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
/**/Not zero so multiply by 256 again to get 65536
/**/[>++++<-]>[<++++++++>-]<[>++++++++<-]
/**/+>[>
/******/# Print "32"
/******/++++++++++[>+++++<-]>+.-.[-]<
/**/<[-]<->] <[>>
/******/# Print "16"
/******/+++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
/**/# Print "8"
/**/++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
/**/this is preceded by a tab
/******/two tabs
/**********/three tabs etcetera!
</code>```

Because the university needs space to download both Vim and Emacs, you are allowed very little storage for your code. Therefore this is code-golf and the shortest code wins. You may assume that input is well formed and lines with less than four spaces (after replacement of tabs) may result in undefined behavior.

Disclaimer

This "excellent" formatting strategy came courtesy of Geobits, and is reproduced with his permission. No programmers were harmed during the production of this challenge.

Body:
V, <s>21</s>, 20 bytes

Íô/
Î^hr/hv0r*r/

<a href="http://v.tryitonline.net/#code=w43DtC8gICAgCsOOXmhyL2h2MHIqci8&input=U2FtcGxlIGlucHV0IHNoYW1lbGVzc2x5IHN0b2xlbi4gTm90ZSB0aGF0IHRhYnMgZ2V0IGF1dG9tYWdpY2FsbHkgZXhwYW5kZWQgdG8gZm91ciBzcGFjZXMgb24gU0UsIGJ1dCB5b3UgbXVzdCBoYW5kbGUgdGFicyBhcyB3ZWxsLgpDYWxjdWxhdGUgdGhlIHZhbHVlIDI1NiBhbmQgdGVzdCBpZiBpdCdzIHplcm8KSWYgdGhlIGludGVycHJldGVyIGVycm9ycyBvbiBvdmVyZmxvdyB0aGlzIGlzIHdoZXJlIGl0J2xsIGhhcHBlbgorKysrKysrK1s-KysrKysrKys8LV0-WzwrKysrPi1dCis8Wz4tPAoJTm90IHplcm8gc28gbXVsdGlwbHkgYnkgMjU2IGFnYWluIHRvIGdldCA2NTUzNgoJWz4rKysrPC1dPls8KysrKysrKys-LV08Wz4rKysrKysrKzwtXQoJKz5bPgoJCSMgUHJpbnQgIjMyIgoJCSsrKysrKysrKytbPisrKysrPC1dPisuLS5bLV08Cgk8Wy1dPC0-XSA8Wz4-CgkJIyBQcmludCAiMTYiCgkJKysrKysrK1s-KysrKysrKzwtXT4uKysrKysuWy1dPAo8PC1dXSA-Wz4KCSMgUHJpbnQgIjgiCgkrKysrKysrK1s-KysrKysrKzwtXT4uWy1dPAo8LV08CiMgUHJpbnQgIiBiaXQgY2VsbHNcbiIKKysrKysrKysrKytbPisrKz4rKysrKysrKys-KysrKysrKysrPis8PDw8LV0-LS4-LS4rKysrKysrLisrKysrKysrKysrLjwuCj4-LisrLisrKysrKysuLjwtLj4-LQpDbGVhbiB1cCB1c2VkIGNlbGxzLgpbWy1dPF1sCgl0aGlzIGlzIHByZWNlZGVkIGJ5IGEgdGFiCgkJdHdvIHRhYnMKCQkJdGhyZWUgdGFicyBldGNldGVyYSE" rel="nofollow">Try it online!

This is literally just a direct port of my vim answer. The notable differences:

The Í command (Global substitute) automatically fills in the /g flag, which saves two bytes

ô is identical to \t

Î Is a mnemonic for :%norm, and it also fills in the necessary space between :%norm and the set of keystrokes.

The trailing carriage return at the end is implicitly added.


问:
The Squiggly Sequence

All credits to Adnan for coming up with this challenge.

My last challenge, before I go on break.

Task

Given positive integer n, if n is odd, repeat / that many times; if n is even, repeat \ that many times.

(Seriously, the testcases would be much clearer than this description, so just look at the testcases.)

Specs

Any reasonable input/output format.

Standard loopholes apply.

Testcases

```<code>n output
1 /
2 \\
3 ///
4 \\\\
5 /////
6 \\\\\\
</code>```

答:
awk, 26 bytes

```<code>NF=$1,$1=OFS=$1%2?"/":"\\"
</code>```

$1 is the input and then part of the output

NF is the number of fields

OFS is the output field separator

It prints if the expression before the comma is truthy.

Title: The Squiggly Sequence

Body:
awk, 26 bytes

NF=$1,$1=OFS=$1%2?"/":"\\"

$1 is the input and then part of the output

NF is the number of fields

OFS is the output field separator

It prints if the expression before the comma is truthy.


Title: Print numbers from 1 to 10

Body:
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:

Print all Integers from 1 to 10 inclusive in ascending order to standard output.

Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and prefixes and postfixes (like [...]). However, you may not output any other numbers than 1 through 10. Your program may not take any input. Standard loopholes are disallowed.

This is code-golf, so shortest answer in bytes wins!

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Stata,  40 bytes

loc i=1
wh `i'<11 {
di `i'
loc i=`i'+1
}

Output

1
2
3
4
5
6
7
8
9
10


问:
Convert string to number

Task

The task is to convert a string to a number. It must accept the string via stdin and output the number via stdout.

You convert a string to a number by replacing each letter of the string by its index (mind that you don't need to replace it with the index, that's just an example. You are allowed to replace it with anything you like, as long as the output is decodable) in the following list (you don't need to convert any other characters):

Characters: abcdefghijklmnopqrstuvwxyz1234567890 (the input will only either be lowercase letters, or/and a number).

Additionally, you must make the output decodable, so if you have output 0 for input a, and somebody inputs bl, then the output will be something like 111. This is not decodable since the program might interpret it as bbb or lb or bl. You might make it decodable by making sure the the number that each character outputs always has a length of 2. Any other way of making sure your output is decodable is allowed, but you must explain how one would decode the output in your answer.

Standard loopholes are not allowed. This is code golf, so shortest code wins!

EDIT: By decodable, just to clarify, I mean that you can convert the output back into the input. Your program doesn't need to feature decoding features, only encoding.

Examples

```<code>Input    Output
a        00
ab       0001
1        26
</code>```

答:
Ruby, <s>97</s> <s>37</s> 44 bytes

```<code>lambda{|s|s.chars.map{|c|c.upcase.ord}.join}
</code>```

Take the ordinal of each character in s converted to uppercase (to ensure 2 chars per number for ordinals)

Title: Convert string to number

Body:
Ruby, <s>97</s> <s>37</s> 44 bytes

lambda{|s|s.chars.map{|c|c.upcase.ord}.join}

Take the ordinal of each character in s converted to uppercase (to ensure 2 chars per number for ordinals)


答:
PowerShell v2+, <s>42</s> 32 bytes

```<code>-join([char[]]$args[0]|%{$_-38})
</code>```

Takes input $args[0], treats it as a char-array, sends it into a loop, and each loop cast the char as an int (implicit) minus 38. Those are all encapsulated in parens and -joined into one string. That string is left on the pipeline and printing is implicit.

The lowest ASCII point of abcdefghijklmnopqrstuvwxyz0123456789 is 0, with 48. The highest is z with 122. By subtracting 38 from each code point, we're guaranteed distinct two-digit number for each input character.

Examples

```<code>PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'ab'
5960

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'ppcg'
74746165

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'error404'
6376767376141014

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'abcdefghijklmnopqrstuvwxyz0123456789'
596061626364656667686970717273747576777879808182838410111213141516171819
</code>```

Title: Convert string to number

Body:
Task

The task is to convert a string to a number. It must accept the string via stdin and output the number via stdout.

You convert a string to a number by replacing each letter of the string by its index (mind that you don't need to replace it with the index, that's just an example. You are allowed to replace it with anything you like, as long as the output is decodable) in the following list (you don't need to convert any other characters):

Characters: abcdefghijklmnopqrstuvwxyz1234567890 (the input will only either be lowercase letters, or/and a number).

Additionally, you must make the output decodable, so if you have output 0 for input a, and somebody inputs bl, then the output will be something like 111. This is not decodable since the program might interpret it as bbb or lb or bl. You might make it decodable by making sure the the number that each character outputs always has a length of 2. Any other way of making sure your output is decodable is allowed, but you must explain how one would decode the output in your answer.

Standard loopholes are not allowed. This is code golf, so shortest code wins!

EDIT: By decodable, just to clarify, I mean that you can convert the output back into the input. Your program doesn't need to feature decoding features, only encoding.

Examples

```<code>Input    Output
a        00
ab       0001
1        26
</code>```

Body:
PowerShell v2+, <s>42</s> 32 bytes

-join([char[]]$args[0]|%{$_-38})

Takes input $args[0], treats it as a char-array, sends it into a loop, and each loop cast the char as an int (implicit) minus 38. Those are all encapsulated in parens and -joined into one string. That string is left on the pipeline and printing is implicit.

The lowest ASCII point of abcdefghijklmnopqrstuvwxyz0123456789 is 0, with 48. The highest is z with 122. By subtracting 38 from each code point, we're guaranteed distinct two-digit number for each input character.

Examples

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'ab'
5960

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'ppcg'
74746165

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'error404'
6376767376141014

PS C:\Tools\Scripts\golfing> .\convert-string-to-number.ps1 'abcdefghijklmnopqrstuvwxyz0123456789'
596061626364656667686970717273747576777879808182838410111213141516171819


答:
C <s>69</s> <s>61</s> <s>52</s> 62 Bytes

```<code>i;char v[99];main(){gets(v);while(v[i])printf("%.3d",v[i++]);}
</code>```

Now taking input from stdin, each character code is 3 digits.

a.exe thisisatest

116104105115105115097116101115116

Title: Convert string to number

Body:
C <s>69</s> <s>61</s> <s>52</s> 62 Bytes

i;char v[99];main(){gets(v);while(v[i])printf("%.3d",v[i++]);}

Now taking input from stdin, each character code is 3 digits.

a.exe thisisatest

116104105115105115097116101115116


答:
Bash + coreutils, 20

```<code>od -vbAn|tr -d ' \n'
</code>```

The index of each character in the ASCII table is given in octal by od, which ensures each octal number for each input character is exactly 3 digits long (padded with leading zeros as necessary).  tr removes the whitespace.

Decoding would be performed by grouping output into groups of 3 digits and then conversion from octal back to ASCII.

Title: Convert string to number

Body:
Bash + coreutils, 20

od -vbAn|tr -d ' \n'

The index of each character in the ASCII table is given in octal by od, which ensures each octal number for each input character is exactly 3 digits long (padded with leading zeros as necessary).  tr removes the whitespace.

Decoding would be performed by grouping output into groups of 3 digits and then conversion from octal back to ASCII.


答:
S.I.L.O.S, <s>63</s> <s>60</s> 55 bytes

```<code>loadLine
b=256
lbla
c=get b
printIntNoLine c
b+1
if c a
</code>```

Prints ASCII value.

Try it online!

Title: Convert string to number

Body:
S.I.L.O.S, <s>63</s> <s>60</s> 55 bytes

loadLine
b=256
lbla
c=get b
printIntNoLine c
b+1
if c a

Prints ASCII value.

Try it online!


问:
Generate alphabet with 4 copies of each letter
Note that this is not the same as Print the alphabet four times.

This task is to write a program to generate four copies of each letter of the English alphabet, one letter per line, on standard output:

```<code>A
A
A
A
B
B
B
B
</code>```

etc.

The output should include newlines after each letter.

Lowercase letters and/or extra whitespace are acceptable.

The solution must be a complete program.

This is code-golf so answers will be scored in bytes with a lower score being the goal.

答:
CJam, 15 13 characters

```<code>'[,65>4f*e_N*
</code>```

Probably very golf-able; I'm new to CJam and even code golfing.

Body:
CJam, 15 13 characters

'[,65>4f*e_N*

Probably very golf-able; I'm new to CJam and even code golfing.


答:
Python 3, 86 bytes

I appear to have misunderstood what the question allows... Either way, this exactly matches the test cases given.

print(''.join('%02d'%'abcdefghijklmnopqrstuvwxyz0123456789'.index(i)for i in input()))
```

Ideone it!

Title: Convert string to number

Body:
Python 3, 86 bytes

I appear to have misunderstood what the question allows... Either way, this exactly matches the test cases given.

print(''.join('%02d'%'abcdefghijklmnopqrstuvwxyz0123456789'.index(i)for i in input()))

Ideone it!


答:
Pyth, 1 byte

```<code>C
</code>```

Try it here!

Converts a string to a number

Decode with the following Python code:

```<code>def decode(x):
    rest, char = divmod(x, 256)
    if rest < 256: return chr(rest)+chr(char)
    return decode(rest)+chr(char)
</code>```

Title: Convert string to number

Body:
Pyth, 1 byte

C

Try it here!

Converts a string to a number

Decode with the following Python code:

def decode(x):
    rest, char = divmod(x, 256)
    if rest < 256: return chr(rest)+chr(char)
    return decode(rest)+chr(char)


问:
I'm not the language you're looking for!
Isn't it annoying when you find a piece of code and you don't know what language it was written in? This challenge attempts to somewhat solve this.

Challenge

You will have to write a program that when run in two different languages, will output the string:

This program wasn't written in <language program compiled/interpreted in>, it was built for <other language the program can be run in>!

In the output, language names should have official capitalization. eg: CJam, C++

Neither program should take any input from the user.

When run in both languages, output should be to stdout or equivalent.

There should be no output to stderr in either program.

You may use comments in either language.

Two different versions of the same language count as different languages.

If this is done, the program should output the major version number, and if running on two different minor versions, should report the minor version also.

You should not use prebuilt version functions (this includes variables that have already been evaluated at runtime).

Example output:

Perl and Ruby:

Perl: This program wasn't written in Perl, it was built for Ruby!

Ruby: This program wasn't written in Ruby, it was built for Perl!

Python and C:

Python: This program wasn't written in Python, it was built for C!

C: This program wasn't written in C, it was built for Python!

Python 2 and Python 3:

Python 2: This program wasn't written in Python 2, it was built for Python 3!

Python 3: This program wasn't written in Python 3, it was built for Python 2!

Python 2.4 and Python 2.7:

Python 2.4: This program wasn't written in Python 2.4, it was built for Python 2.7!

Python 2.7: This program wasn't written in Python 2.7, it was built for Python 2.4!

This is code golf so the shortest code in bytes wins.

答:
JavaScript ES6 / Python2, 98 bytes, REPL ONLY

```<code>js = 'python'
python = 'js'
s = 'this program is not ' + `js` + ', it was built for ' + `python`
s
</code>```

Tested with Python 2.7.10 and Chrome 52.

The caveat here is actually printing the output....Python uses print s and JS uses console.log(js). So instead I assume you are using a REPL and that s alone will print to stdout.

Body:
JavaScript ES6 / Python2, 98 bytes, REPL ONLY

js = 'python'
python = 'js'
s = 'this program is not ' + `js` + ', it was built for ' + `python`
s

Tested with Python 2.7.10 and Chrome 52.

The caveat here is actually printing the output....Python uses print s and JS uses console.log(js). So instead I assume you are using a REPL and that s alone will print to stdout.


答:
PERL 243

242 + 1 for -p

```<code>$h=(split'\|',$_)[0];$_=$h.reverse$h if($_=~/\|/);for$b(split'_',$_){$b=~y/A-Za-z0-9.?!/ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡/ if($f);$\.=$b;$f=!$f;}$_='';
</code>```

Ungolfed:

```<code>$reverse = (split('\|', $_))[0];
$_ = $reverse . reverse($reverse) if($_=~/\|/);

for $block (split '_', $_) {
    $block =~ y/A-Za-z0-9.?!/ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡/ if($flip);
    $\.=$block;
    $flip=!$flip;
}
$_='';
</code>```

Example:

```<code>$ perl -p mirror.pl <<<'Will I be mirror|ed?!'
Will I be mirrorrorrim eb I lliW
</code>```

I'm 99% sure this works, but most of the upsidedown characters don't display correctly on my system. I tested it by using a different range of character, e.g. .?! -> %^& instead of .?! -> ˙¿¡.

Body:
Input:

A string only containing the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) and two special characters (_ and |)

Output:

Mirror the text based on the position(s) of the _ and |.

_ mirrors horizontally and | mirrors vertically.

Mirroring process

The first _ indicates the start of the mirroring of that substring, the second _ the end.

If just one _ is present, you can continue on until the end of the string.

If more then two _ are present, the same process repeats.

There can only be one | in the string, and this reversed the first substring and removes the second substring.

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.?! (space at the end) will be converted to ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ (space at the end) when it is mirrored by _ (click the link for the unicode values - requires unicode v8.0+).

Example input 1: _Will I be mirrored?!

Output 1: Mıll I qǝ ɯıɹɹoɹǝp¿¡

Example input 2: Wi_ll I be mi_rrored?!

Output 2: Will I qǝ ɯırrored?!

When it is mirrored by | we simply reverse the substring from 0 to index-of-|.

Example input 1: Will I be mirror|ed?!

Output 1: Will I be mirrorrorrim eb I lliW

Both mirrors (_ and |) can be present in the string.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_Will I be mirrored?!                          ->   Mıll I qǝ ɯıɹɹoɹǝp¿¡
Wi_ll I be mi_rrored?!                         ->   Will I qǝ ɯırrored?!
Will I be mirror|ed?!                          ->   Will I be mirrorrorrim eb I lliW
This_ is a test_ cont_aining bo|t_h mirrors.   ->   This ıs ɐ ʇǝsʇ contɐıuıuɓ qooq ɓuıuıɐtnoc ʇsǝʇ ɐ sı sihT
0_1_2_3_4_5|_6_7_8_9                           ->   0⇂2Ɛ4ϛϛ4Ɛ2⇂0
</code>```

Body:
PERL 243

242 + 1 for -p

$h=(split'\|',$_)[0];$_=$h.reverse$h if($_=~/\|/);for$b(split'_',$_){$b=~y/A-Za-z0-9.?!/ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡/ if($f);$\.=$b;$f=!$f;}$_='';

Ungolfed:

$reverse = (split('\|', $_))[0];
$_ = $reverse . reverse($reverse) if($_=~/\|/);

for $block (split '_', $_) {
    $block =~ y/A-Za-z0-9.?!/ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡/ if($flip);
    $\.=$block;
    $flip=!$flip;
}
$_='';

Example:

$ perl -p mirror.pl <<<'Will I be mirror|ed?!'
Will I be mirrorrorrim eb I lliW

I'm 99% sure this works, but most of the upsidedown characters don't display correctly on my system. I tested it by using a different range of character, e.g. .?! -> %^& instead of .?! -> ˙¿¡.


答:
GS2, 1 byte

Byte 14, which, in CP437, is ♫.

Try it online!

Decoding is possible: get all matches of the regex (1..|..) and map them from decimal ASCII code points to ASCII characters.

Title: Convert string to number


问:
Highlight the Bounding Box, Part I: Cartesian Grid
You're given a rectangular grid of the characters . and #, like this:

```<code>..........
..#.......
....#..#..
...#......
..........
</code>```

Your task is to fill the entire axis-aligned bounding box of the # with further #:

```<code>..........
..######..
..######..
..######..
..........
</code>```

The axis-aligned bounding box is the smallest rectangle which contains all the #.

Want more? Try Part II!

Rules

You may use any two distinct printable ASCII characters (0x20 to 0x7E, inclusive), in place of # and .. I'll continue referring to them as # and . for the remainder of the specification though.

Input and output may either be a single linefeed-separated string or a list of strings (one for each line), but the format has to be consistent.

You may assume that the input contains at least one # and all lines are the same length.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

You may use any programming language, but note that these loopholes are forbidden by default.

This is code-golf, so the shortest valid answer – measured in bytes – wins.

Test Cases

Each test case has input and output next to each other.

```<code>#    #

...    ...
#..    #..
...    ...

...    ...
#..    ###
..#    ###

.#.    ###
#..    ###
..#    ###

.....    .....
.#.#.    .###.
.....    .....

...    ...
.#.    .#.
...    .#.
.#.    .#.
...    ...

..........    ..........
..........    ..........
....#.....    ....#.....
..........    ..........

..........    ..........
..........    ..........
....#.....    ...##.....
...#......    ...##.....

..........    ..........
..#.......    ..###.....
....#.....    ..###.....
...#......    ..###.....

..........    ..........
..#.......    ..######..
....#..#..    ..######..
...#......    ..######..

.........#    ..########
..#.......    ..########
....#..#..    ..########
...#......    ..########
</code>```

答:
Python 2, 184 bytes

def c(i):
 m=n=();e,z=enumerate,'for j,r in e(i):\n for k,c in e(r):%s'
 exec z%'\n  if"#"==c:m+=j,;n+=k,'
 exec z%'\n  if min(m)<=j<=max(m)<[]>min(n)<=k<=max(n):i[j][k]="#"'
 return i
```

Input and output are a list of strings.

Try it on Ideone (fork of Jonathan Allan's test page)

Body:
Python 2, 184 bytes

def c(i):
 m=n=();e,z=enumerate,'for j,r in e(i):\n for k,c in e(r):%s'
 exec z%'\n  if"#"==c:m+=j,;n+=k,'
 exec z%'\n  if min(m)<=j<=max(m)<[]>min(n)<=k<=max(n):i[j][k]="#"'
 return i

Input and output are a list of strings.

Try it on Ideone (fork of Jonathan Allan's test page)


Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

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

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

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

Scoring

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

Body:
Stata, 49 bytes

loc i=1
wh `i'<11 {
di "**********"
loc i=`i'+1
}

Output

**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


问:
Prune connections
John is writing a program that finds the best route from A to B using public transport. For a given pair of origin and destination the program calculates a set of routes with departure time and arrival time, such as this:

```<code>10:12 11:45
10:15 11:50
10:22 12:05
10:25 12:00
</code>```

As you see, the output may include a few routes that are superfluous in the sense that there is another route that starts later and ends earlier. Such routes are certainly never wanted by the user since he cat get out later to arrive sooner.

Your task, if you choose to accept it, is to write a program that prunes a set of routes such that all superfluous rules are eliminated.

Input

The input is a list of newline separated pairs of whitespace separated departure and arrival time in military format (hh:mm). Such a pair is called a route.

You may assume that all times are in the same day and that the arrival time is always later than the departure time. You may also assume that the list is orderer by departure times.

Output

The output is the same list as the input without redundant routes. A redundant route is a route for which another route exists in the list that has a later departure and an earlier arrival time. There must exist an order to remove all redundant routes such that in each step you can show the route that makes the removed route redundant. You don't have to output that order.

Extra credit

Prove or disprove that for each list of input routes there exists exactly one set of output routes.

Restriction

Usual codegolf rules apply

Scoring

To score, apply the function that gives an upper bound to your solutions complexity with your solution's total number of characters. Normalize your bounding function such that a solution length of two character yields a score of two.

For example, if your solution has 24 characters and a complexity of O(2n), your score is 4194304. If your solution has 123 characters and a complexity of O(n2) your score is 7564. If your solution has 200 characters and a complexity of O(n*logn), your score is 734.

I use this scoring method in order to encourage people to implement efficient solutions.

答:
GolfScript, 26 characters, 26 score

```<code>n%-1%{6>[0$m]$0=:m=},-1%n*
</code>```

The solution assumes a list sorted on departure time on input (as noted in the problem description) and also prints a sorted list (if this restriction can be dropped we may save 3 chars).

The code traverses the list backwards and removes any connection where the arrival time is larger than the minimum arrival time processed so far.

```<code>n%            # split input at newlines
-1%           # reverse list
{             # filter list...
   6>         # take arrival time of current item
   [0$m]      # make an array consisting of that arrival time and the minimum
              # up to now, contained in variable m. Note since m is not initialized
              # the array will consist of a single item in the first iteration
   $          # sort that array (consisting of one or two items)
   0=         # take first item, i.e. minimum arrival time
   :m         # save to variable m
   =          # compare current item to m and select if both are equal
},            # ... end of filter list
-1%           # reverse list again
n*            # join items with newline
</code>```

The code can be tested online.

Title: Prune connections

Body:
GolfScript, 26 characters, 26 score

n%-1%{6>[0$m]$0=:m=},-1%n*

The solution assumes a list sorted on departure time on input (as noted in the problem description) and also prints a sorted list (if this restriction can be dropped we may save 3 chars).

The code traverses the list backwards and removes any connection where the arrival time is larger than the minimum arrival time processed so far.

n%            # split input at newlines
-1%           # reverse list
{             # filter list...
   6>         # take arrival time of current item
   [0$m]      # make an array consisting of that arrival time and the minimum
              # up to now, contained in variable m. Note since m is not initialized
              # the array will consist of a single item in the first iteration
   $          # sort that array (consisting of one or two items)
   0=         # take first item, i.e. minimum arrival time
   :m         # save to variable m
   =          # compare current item to m and select if both are equal
},            # ... end of filter list
-1%           # reverse list again
n*            # join items with newline

The code can be tested online.


Title: Subtract the next numbers

Body:
Description

Subtract the next P numbers from a N number. The next number of N is N + 1.

Look at the examples to get what I mean.

Examples:

```<code>Input: N=2,P=3
Calculate: n - (n+1) - (n+2) - (n+3)     //Ending with 3, because P=3
Calculate: 2 -  2+1  -  2+2  - 2+3       //Replacing N with 2 from Input
Calculate: 2 -  3    -  4    - 5
Output: -10

Input: N=100,P=5
Calculate: n - (n+1) - (n+2) - (n+3) - (n+4) - (n+5)
Calculate: 100-  101 -  102  -  103  -  104  - 105
Output: -415

Input: N=42,P=0
Calculate: n
Calculate: 42
Output: 42

Input: N=0,P=3
Calculate: n - (n+1) - (n+2) - (n+3)
Calculate: 0 -  1    -  2    -  3
Output: -6

Input: N=0,P=0
Calulate: n
Calculate: 0
Output: 0
</code>```

Input:

N: Integer, positive, negative or 0

P: Integer, positive or 0, not negative

Output:

Integer or String, leading 0 allowed, trailing newline allowed

Rules:

No loopholes

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

Input and Output must be as described

Body:
Jelly, 7 bytes

RS+×_×-

Arguments are P, N

Test it on TryItOnline

How?

RS+×_×-  - takes two arguments: P, N
R        - range(P): [1,2,3, ... ,P]
 S       - sum: 1+2+3+ ... +P
   ×     - multiply: P*N
  +      - add: 1+2+3+ ... +P + P*N
    _    - subtract: 1+2+3+ ... +P + P*N - N
      -  - -1
     ×   - multiply: (1+2+3+ ... +P + P*N - N)*-1
                   = -1-2-3- ... -P - P*N + N
                   = N - (N+1) - (N+2) - (N+3) - ... - (N+P)


答:
Pyth - 174 bytes

Can prolly save with base compression or something cuz of unicode(this is only 119 chars)

```<code>u?qH\_&=hZG+G@@c2K+s+rB;1UT".?! ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ "ZxKH?}\|zs_Bhcz\|zk
</code>```

Test Suite.

Body:
Pyth - 174 bytes

Can prolly save with base compression or something cuz of unicode(this is only 119 chars)

u?qH\_&=hZG+G@@c2K+s+rB;1UT".?! ɐqɔpǝɟɓɥıɾʞlɯuodbɹsʇnʌʍxʎz∀ƆᗡƎℲ⅁HIſ⋊⅂WNOԀΌᴚS⊥∩ΛMX⅄Z0⇂ᘔƐ߈ϛ9ㄥ86˙¿¡ "ZxKH?}\|zs_Bhcz\|zk

<a href="http://pyth.herokuapp.com/?code=u%3FqH%5C_%26%3DhZG%2BG%40%40c2K%2Bs%2BrB%3B1UT%22.%3F%21+%C9%90q%C9%94p%C7%9D%C9%9F%C9%93%C9%A5%C4%B1%C9%BE%CA%9El%C9%AFuodb%C9%B9s%CA%87n%CA%8C%CA%8Dx%CA%8Ez%E2%88%80%F0%90%90%92%C6%86%E1%97%A1%C6%8E%E2%84%B2%E2%85%81HI%C5%BF%E2%8B%8A%E2%85%82WNO%D4%80%CE%8C%E1%B4%9AS%E2%8A%A5%E2%88%A9%CE%9BMX%E2%85%84Z0%E2%87%82%E1%98%94%C6%90%DF%88%CF%9B9%E3%84%A586%CB%99%C2%BF%C2%A1+%22ZxKH%3F%7D%5C%7Czs_Bhcz%5C%7Czk&test_suite=1&test_suite_input=_Will+I+be+mirrored%3F%21%0AWi_ll+I+be+mi_rrored%3F%21%0AWill+I+be+mirror%7Ced%3F%21%0AThis_+is+a+test_+cont_aining+bo%7Ct_h+mirrors.%0A0_1_2_3_4_5%7C_6_7_8_9&debug=0" rel="nofollow noreferrer">Test Suite.


Title: Subtract the next numbers

Body:
Maple, 19 bytes

n-sum(i,i=n+1..n+p)

Usage:

> f:=(n,p)->n-sum(i,i=n+1..n+p);
> f(2, 3);
  -10
> f(100,5);
  -415
> f(42,0);
  42


答:
Jelly, 4 bytes

```<code>r+_/
</code>```

Try it online!

How it works

```<code>r+_/  Main link. Arguments: n, p

 +    Yield n+p.
r     Range; yield [n, ..., n+p].
  _/  Reduce by subtraction.
</code>```

Title: Subtract the next numbers

Body:
Jelly, 4 bytes

r+_/

Try it online!

How it works

r+_/  Main link. Arguments: n, p

 +    Yield n+p.
r     Range; yield [n, ..., n+p].
  _/  Reduce by subtraction.


答:
Pyth - 6 bytes

```<code>-F}Q+E
</code>```

Test Suite.

Title: Subtract the next numbers

Body:
Pyth - 6 bytes

-F}Q+E

Test Suite.


问:
Let's make a map of dungeon
Long time ago, when I was spending more time playing RPG, one of the issues what some players had, was to track party movement and to draw proper map.
So I come with idea, to check how you guys come deal with this issue.

Task is to write a function, which takes as input parameter list of directions (passed as structure of your choice) ^v<>, display map of dungeon.
In example for input: >>>vvv<<<^^^ output will be:

```<code>+----+               +----+
|    |               |>>>v|
| ++ |               |^++v|
| ++ |  because      |^++v|
|    |               |^<<<|
+----+               +----+
</code>```

Testcases

```<code>>>>>>>vvvvv<<<<^^^>>v

 +-------+
 |       |
 +-+---+ |
   |   | |
   | + | |
   | +-+ |
   |     |
   +-----+

^^^^^vvv<<<^^vv>>>>>>>>vv>><<^^^^v>>>>v^<^

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

As it is golf code challenge, shortest code wins.

Happy golfing.

EDIT
Sorry for late edit, I didn't have much time recently.

Map is generated based on movement.  It should contain only corridors which were visited during walk. Hence creating one big room won't be a valid answer.

There are three valid symbols in the map:

| vertical wall

| horizontal wall

+ intersection of vertical and horizontal wall.

Maximum length of the path is 255 character (but if you can, do not limit yourself).

More test cases:

```<code> ><><><><

 +--+
 |  |
 +--+

 >^<v

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

I hope now everything is clear.

Title: Let's make a map of dungeon

Body:
Javascript (ES6), <s>261</s> <s>254</s> 243 bytes

s=>{v=Array(w=32);p=526;b=n=>v[n>>5]&(1<<(n&31));B=(n,i)=>b(p+n)|b(p-n)?i:0;[...0+s].map(c=>v[(p+=[0,1,-1,w,-w]['0><v^'.indexOf(c)])>>5]|=1<<(p&31));for(z='',p=0;p<w*w;z+=' |-+'[b(p)?0:B(1,1)|B(w,2)||B(31,3)|B(33,3)],p++%w||(z+=`
`));return z}

JSFiddle


答:
Pyth, 13 bytes

```<code>f&P_TP_+ThQSe
</code>```

A program that takes input of a list of the form [k, u] and prints a list.

Try it online

How it works

```<code>f&P_TP_+ThQSe  Program. Input: Q
           Se  1-indexed range up to Q[1], yielding [1, 2, 3, ..., u]
f              Filter that, using variable T, by:
  P_T           T is prime
 &              and
     P_+ThQ     T+Q[0], i.e. T+k, is prime
               Implicitly print
</code>```

Title: Variable Prime "Twins"

Body:
I am 2/3 twins with my brother, i.e. born on the same day of the same month but twelve years later. When I was 5, he was 17, both primes; the last pair of ages we can reasonably count on is [71, 83] with both of us being alive and able to celebrate this coincidental jubilee.

Task

Create a code that

takes two integers as input: the difference between the counter and the "twin" as a positive integer k (well yes, I'm the younger) and the upper bound as a positive integer u (runtime consideration)

and gives output as an array or list of all i numbers lower than or equal u for which both i and i+k are primes. The output does not need to be sorted.

Test Cases

```<code>12, 1000 -> [5, 7, 11, 17, 19, 29, 31, 41, 47, 59, 61, 67, 71, 89, 97, 101, 127, 137, 139, 151, 167, 179, 181, 199, 211, 227, 229, 239, 251, 257, 269, 271, 281, 337, 347, 367, 389, 397, 409, 419, 421, 431, 449, 467, 479, 487, 491, 509, 557, 587, 601, 607, 619, 631, 641, 647, 661, 727, 739, 757, 761, 797, 809, 811, 827, 907, 929, 941, 971, 997]
2, 999 -> [3, 5, 11, 17, 29, 41, 59, 71, 101, 107, 137, 149, 179, 191, 197, 227, 239, 269, 281, 311, 347, 419, 431, 461, 521, 569, 599, 617, 641, 659, 809, 821, 827, 857, 881]
3, 1500 -> [2]
30, 1500 -> [7, 11, 13, 17, 23, 29, 31, 37, 41, 43, 53, 59, 67, 71, 73, 79, 83, 97, 101, 107, 109, 127, 137, 149, 151, 163, 167, 181, 193, 197, 199, 211, 227, 233, 239, 241, 251, 263, 277, 281, 283, 307, 317, 337, 349, 353, 359, 367, 379, 389, 401, 409, 419, 431, 433, 449, 457, 461, 479, 491, 541, 547, 557, 563, 569, 571, 577, 587, 601, 613, 617, 631, 643, 647, 653, 661, 709, 727, 739, 743, 757, 797, 809, 823, 827, 829, 853, 857, 877, 881, 907, 911, 937, 941, 947, 953, 967, 983, 991, 1009, 1019, 1021, 1031, 1033, 1039, 1061, 1063, 1087, 1093, 1123, 1151, 1163, 1171, 1187, 1193, 1201, 1229, 1249, 1259, 1277, 1289, 1291, 1297, 1399, 1409, 1423, 1429, 1451, 1453, 1459, 1481, 1493]
</code>```

Edit

Since I failed to specify the upper bound, both inclusive and exclusive solutions are welcome.

Edit No. 2

The challenge ends on 1st September, one week from the start.

Looks like we have a winner but in case of a tie popularity is the tie-breaker; in this case the "second" will be compensated via bounty.

Body:
Pyth, 13 bytes

f&P_TP_+ThQSe

A program that takes input of a list of the form [k, u] and prints a list.

Try it online

How it works

f&P_TP_+ThQSe  Program. Input: Q
           Se  1-indexed range up to Q[1], yielding [1, 2, 3, ..., u]
f              Filter that, using variable T, by:
  P_T           T is prime
 &              and
     P_+ThQ     T+Q[0], i.e. T+k, is prime
               Implicitly print


答:
Perl 6, 21 bytes

{$^n-[+] $n^..$n+$^p}
```

<h2>Explanation:</h2>

<pre class="lang-perl6 prettyprint-override"><code># bare block lambda with two placeholder parameters ｢$n｣ and ｢$p｣
{
  $^n -
      # reduce using ｢&infix:<+>｣
      [+]
          # a Range that excludes ｢$n｣ and has ｢$p｣ values after it
          $n ^.. ($n + $^p)
}
</code>```

Title: Subtract the next numbers

Body:
Perl 6, 21 bytes

{$^n-[+] $n^..$n+$^p}

Explanation:

# bare block lambda with two placeholder parameters ｢$n｣ and ｢$p｣
{
  $^n -
      # reduce using ｢&infix:<+>｣
      [+]
          # a Range that excludes ｢$n｣ and has ｢$p｣ values after it
          $n ^.. ($n + $^p)
}


答:
SED (56 + 1 for -r) 57

```<code>s/⇥/    /g;tr;:r;s,^ ( *) ,/\1/,;T;:l;s,^(/\**) ,\1*,;tl
</code>```

Where ⇥ is a tab

1. replaces tabs with spaces.

2. replaces the first and last leading space with /.

3. replaces the first space after / and 0+ *s with a * until there isn't a match.

Title: End the tabs versus space war

Body:
End the tabs versus space war

So, there has been a great deal of debate of whether to use tabs or spaces to indent/format code. Can you help the university settle the dispute, by going to an incredibly <s>crazy</s> unique method of formatting.

Your job is to write a full program or function which expands all tabs into four spaces. And then replaces a run of n leading spaces with "/(n - two stars here)/". You will receive input over multiple lines in any reasonable format (single string array of strings for each new line. Columnar array etc.)

Sample input shamelessly stolen. Note that since tabs get automagically expanded to four spaces on SE I represent it as the "^" character, but you must handle tabs (codepoint 0x09) as well. All "^" characters represent a tabulation.

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
    Not zero so multiply by 256 again to get 65536
    [>++++<-]>[<++++++++>-]<[>++++++++<-]
    +>[>
        # Print "32"
        ++++++++++[>+++++<-]>+.-.[-]<
    <[-]<->] <[>>
        # Print "16"
        +++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
    # Print "8"
    ++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
^this is preceded by a tab
^^two tabs
^^^three tabs etcetera!
</code>```

Sample output

```<code>Calculate the value 256 and test if it's zero
If the interpreter errors on overflow this is where it'll happen
++++++++[>++++++++<-]>[<++++>-]
+<[>-<
/**/Not zero so multiply by 256 again to get 65536
/**/[>++++<-]>[<++++++++>-]<[>++++++++<-]
/**/+>[>
/******/# Print "32"
/******/++++++++++[>+++++<-]>+.-.[-]<
/**/<[-]<->] <[>>
/******/# Print "16"
/******/+++++++[>+++++++<-]>.+++++.[-]<
<<-]] >[>
/**/# Print "8"
/**/++++++++[>+++++++<-]>.[-]<
<-]<
# Print " bit cells\n"
+++++++++++[>+++>+++++++++>+++++++++>+<<<<-]>-.>-.+++++++.+++++++++++.<.
>>.++.+++++++..<-.>>-
Clean up used cells.
[[-]<]l
/**/this is preceded by a tab
/******/two tabs
/**********/three tabs etcetera!
</code>```

Because the university needs space to download both Vim and Emacs, you are allowed very little storage for your code. Therefore this is code-golf and the shortest code wins. You may assume that input is well formed and lines with less than four spaces (after replacement of tabs) may result in undefined behavior.

Disclaimer

This "excellent" formatting strategy came courtesy of Geobits, and is reproduced with his permission. No programmers were harmed during the production of this challenge.

Body:
SED (56 + 1 for -r) 57

s/⇥/    /g;tr;:r;s,^ ( *) ,/\1/,;T;:l;s,^(/\**) ,\1*,;tl

Where ⇥ is a tab

1. replaces tabs with spaces.

2. replaces the first and last leading space with /.

3. replaces the first space after / and 0+ *s with a * until there isn't a match.