答:
Java 156 150 149 147 142 bytes

```<code>t->z->{Integer H=100,T=H.valueOf(t.replace(":","")),Z=H.valueOf(z.replace(":","").substring(3)),c=(T/H+Z/H+24)*60+T%H+Z%H;return c/60%24+":"+c%60;}
</code>```

Test cases & ungolfed

```<code>import java.util.function.BiFunction;

public class Main {
    public static void main(String[] args) {

        BiFunction<String,String,String> f = (t,z)->{
            Integer H = 100, // Hundred, used several times, shorter as variable
                    T = H.valueOf(t.replace(":","")), // as int (HHMM)
                    Z = H.valueOf(z.replaceAll("[UTC:]","")), // as int (-HHMM)
                    c = (T/H + Z/H + 24) * 60 + T%H + Z%H; // transform into minutes
            return c/60%24+":"+c%60;
        };

        test(f, "08:50", "UTC-06:00", "02:50");
        test(f, "09:42", "UTC+05:45", "15:27");
        test(f, "03:42", "UTC-05:45", "21:57");
        test(f, "06:42", "UTC+13:00", "19:42");
        test(f, "02:40", "UTC-10:00", "16:40");
        test(f, "17:25", "UTC+09:00", "02:25");
    }

    private static void test(BiFunction<String,String,String> f, String time, String zone, String expected) {
        // Padding is allowed. Make sure the padding is skipped for the test, then.
        String result = String.format("%2s:%2s", (Object[])f.apply(time, zone).split(":")).replace(" ","0");
        if (result.equals(expected)) {
            System.out.printf("%s + %s: OK%n", time, zone);
        } else {
            System.out.printf("%s + %s: Expected \"%s\", got \"%s\"%n", time, zone, expected, result);
        }

    }
}
</code>```

Shavings

150 -> 149: a/H*60+b/H*60 -> (a/H+b/H)*60

149 -> 147: (T/H+Z/H)*60+1440 -> (T/H+Z/H+24)*60.

147 -> 142: z.replace(":","").substring(3) -> z.replaceAll("[UTC:]","")

Title: Change the Timezone

Body:
Java 156 150 149 147 142 bytes

t->z->{Integer H=100,T=H.valueOf(t.replace(":","")),Z=H.valueOf(z.replace(":","").substring(3)),c=(T/H+Z/H+24)*60+T%H+Z%H;return c/60%24+":"+c%60;}

Test cases & ungolfed

import java.util.function.BiFunction;

public class Main {
    public static void main(String[] args) {

        BiFunction<String,String,String> f = (t,z)->{
            Integer H = 100, // Hundred, used several times, shorter as variable
                    T = H.valueOf(t.replace(":","")), // as int (HHMM)
                    Z = H.valueOf(z.replaceAll("[UTC:]","")), // as int (-HHMM)
                    c = (T/H + Z/H + 24) * 60 + T%H + Z%H; // transform into minutes
            return c/60%24+":"+c%60;
        };

        test(f, "08:50", "UTC-06:00", "02:50");
        test(f, "09:42", "UTC+05:45", "15:27");
        test(f, "03:42", "UTC-05:45", "21:57");
        test(f, "06:42", "UTC+13:00", "19:42");
        test(f, "02:40", "UTC-10:00", "16:40");
        test(f, "17:25", "UTC+09:00", "02:25");
    }

    private static void test(BiFunction<String,String,String> f, String time, String zone, String expected) {
        // Padding is allowed. Make sure the padding is skipped for the test, then.
        String result = String.format("%2s:%2s", (Object[])f.apply(time, zone).split(":")).replace(" ","0");
        if (result.equals(expected)) {
            System.out.printf("%s + %s: OK%n", time, zone);
        } else {
            System.out.printf("%s + %s: Expected \"%s\", got \"%s\"%n", time, zone, expected, result);
        }

    }
}

Shavings

150 -> 149: a/H*60+b/H*60 -> (a/H+b/H)*60

149 -> 147: (T/H+Z/H)*60+1440 -> (T/H+Z/H+24)*60.

147 -> 142: z.replace(":","").substring(3) -> z.replaceAll("[UTC:]","")


问:
Can the number reach 1 by repeatedly subtracting the largest prime less than it?

Challenge:

Given a number, take the largest prime strictly less than it, subtract it from this number, do this again to this new number with the biggest prime less than it, and continue doing this until it's less than 3. If it reaches 1, your program should output a truthy value, else, the program should output a falsey value.

Examples:

All of these should give a truthy value:

```<code>3
4
6
8
10
11
12
14
16
17
18
20
22
23
24
26
27
29
30
32
34
35
37
38
40
41
42
44
46
47
48
50
</code>```

All of these should give falsey values:

```<code>5
7
9
13
15
19
21
25
28
31
33
36
39
43
45
49
</code>```

Rules:

You can either write a program or function.

You can assume that the input is bigger than 2.

Standard loopholes apply

This is code-golf so the shortest answer wins!

答:
Python, with sympy, 60 bytes

import sympy
f=lambda n:n>2and f(n-sympy.prevprime(n))or n<2
```

<hr>

<p>My previous method was 83 bytes without sympy using recursion, but I took truthy/falsey to mean distinguishable and consistent, but I have been informed that's an incorrect interpretation. I can't seem to salvage it due to the tail, but I'll leave it here in case someone knows how to do so:</p>

```f=lambda n,p=0:n>2and(any(p%x==0for x in range(2,p))and f(n,p-1)or f(n-p,n+~p))or n
```

ContentLicense: CC BY-SA 3.0

Body:
Python, with sympy, 60 bytes

import sympy
f=lambda n:n>2and f(n-sympy.prevprime(n))or n<2

My previous method was 83 bytes without sympy using recursion, but I took truthy/falsey to mean distinguishable and consistent, but I have been informed that's an incorrect interpretation. I can't seem to salvage it due to the tail, but I'll leave it here in case someone knows how to do so:

f=lambda n,p=0:n>2and(any(p%x==0for x in range(2,p))and f(n,p-1)or f(n-p,n+~p))or n


问:
Hyperprogramming: N+N, N×N, N^N all in one
Write a program that takes in a number N from 1 to 9 inclusive. In its native form your program should output N+N. E.g. output 2 if N is 1, 4 if N is 2, 6 if N is 3, and so on.

When every character in your program is duplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N×N. E.g. output 1 if N is 1, 4 if N is 2, 9 if N is 3, and so on.

When every character in your program is triplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N^N. E.g. output 1 if N is 1, 4 if N is 2, 27 if N is 3, 387420489 if N is 9, etc.

Numbers above 9 aren't required because 10^10 is outside of many language's usual integer range.

Example

If your initial program was

```<code>My_Program!
Exit();
</code>```

Then it should be capable of taking in N and outputting N+N.

Additionally, the program

```<code>MMyy__PPrrooggrraamm!!

EExxiitt(());;
</code>```

should take in N and output N×N.

Finally, the program

```<code>MMMyyy___PPPrrrooogggrrraaammm!!!

EEExxxiiittt((()));;;
</code>```

should take in N and output N^N.

Quadrupled-character programs and beyond are not required.

Rules

Input and output should be plain, normally formatted decimal numbers. You may answer using a different base to show off your code but then your answer is non-competitive.

Windows users may treat \r\n as one character since things like \r\r\n\n wouldn't make sense or perhaps even work.

The shortest native program (the N+N one) in bytes wins.

答:
Jelly, 12 bytes

N+N

```<code>“(ẹ+)‘FQṖṪỌv
</code>```

Try it online!

N×N

```<code>““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv
</code>```

Try it online!

N^N

```<code>“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv
</code>```

Try it online!

How it works

Jelly has several different types of string literals; all of them start with a “. If the literal contains more than one “, a string array is returned, and “ separates the strings from each other.

For example, “abc“def” yields ['abc', 'def'].

Depending on the last character of the literal (any of ”«»‘’, where « is currently unimplemented), one can choose between the different types of literals. For ‘, we get the code points in Jelly's code page instead of the corresponding Unicode characters.

For example, “abc“def‘ yields [[97, 98, 99], [100, 101, 102]].

The three literals in the programs correspond to the following code point arrays.

```<code>“(ẹ+)‘           -> [40, 214, 43, 41]
““((ẹẹ++))‘      -> [[], [40, 40, 214, 214, 43, 43, 41, 41]]
“““(((ẹẹẹ+++)))‘ -> [[], [], [40, 40, 40, 214, 214, 214, 43, 43, 43, 41, 41, 41]]
</code>```

N+N

```<code>“(ẹ+)‘FQṖṪỌv                          Main link. Argument: n

“(ẹ+)‘                                As before.
      F                               Flatten the array. Yields an integer array.
       Q                              Unique; deduplicate the integers.
                                      This yields [40, 214, 43, 41].
        Ṗ                             Pop; remove the last element.
         Ṫ                            Tail; extract the last element.
                                      This yields 43, the Unicode code point of +.
          Ọ                           Unordinal; cast to character.
           v                          Eval; execute the character as a Jelly
                                      program with argument n.
</code>```

N×N

```<code>““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv              Main link. Argument: n

““((ẹẹ++))‘                           As before.
           ‘                          Increment all integers.
            FF                        Flatten the array. Yields an integer array.
              QQ                      Unique; deduplicate the integers.
                                      This yields [41, 215, 44, 42].
                ṖṖ                    Pop twice; remove the last two elements.
                  ṪṪ                  Tail; extract the last element.
                                      This yields 215, the Unicode code point of ×.
                    ỌỌ                Unordinal; cast to character.
                      v               Eval; execute the character as a Jelly
                                      program with argument n.
                       v              Eval; convert the return value (n×n) to a
                                      string and execute that string as a Jelly
                                      program with argument n. Since the string
                                      consists of a single integer literal, that
                                      integer is returned, ignoring the argument.
</code>```

Note that F, Q, Ṫ, and Ọ do not alter 1D arrays, arrays without duplicates, integers, and characters (respectively).

N^N

```<code>“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv  Main link. Argument: n

“““(((ẹẹẹ+++)))‘                      As before.
                ‘‘                    Increment all integers twice.
                  FFF                 Flatten the array. Yields an integer array.
                     QQQ              Unique; deduplicate the integers.
                                      This yields [42, 216, 45, 43].
                        ṖṖṖ           Pop thrice; remove the last three elements.
                           ṪṪṪ        Tail; extract the last element.
                                      This yields 42, the Unicode code point of *.
                              ỌỌỌ     Unordinal; cast to character.
                                 v    Eval; execute the character as a Jelly
                                      program with argument n.
                                  vv  Eval twice. See N×N.
</code>```

Body:
Jelly, 12 bytes

N+N

“(ẹ+)‘FQṖṪỌv

Try it online!

N×N

““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv

Try it online!

N^N

“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv

Try it online!

How it works

Jelly has several different types of string literals; all of them start with a “. If the literal contains more than one “, a string array is returned, and “ separates the strings from each other.

For example, “abc“def” yields ['abc', 'def'].

Depending on the last character of the literal (any of ”«»‘’, where « is currently unimplemented), one can choose between the different types of literals. For ‘, we get the code points in Jelly's code page instead of the corresponding Unicode characters.

For example, “abc“def‘ yields [[97, 98, 99], [100, 101, 102]].

The three literals in the programs correspond to the following code point arrays.

“(ẹ+)‘           -> [40, 214, 43, 41]
““((ẹẹ++))‘      -> [[], [40, 40, 214, 214, 43, 43, 41, 41]]
“““(((ẹẹẹ+++)))‘ -> [[], [], [40, 40, 40, 214, 214, 214, 43, 43, 43, 41, 41, 41]]

N+N

“(ẹ+)‘FQṖṪỌv                          Main link. Argument: n

“(ẹ+)‘                                As before.
      F                               Flatten the array. Yields an integer array.
       Q                              Unique; deduplicate the integers.
                                      This yields [40, 214, 43, 41].
        Ṗ                             Pop; remove the last element.
         Ṫ                            Tail; extract the last element.
                                      This yields 43, the Unicode code point of +.
          Ọ                           Unordinal; cast to character.
           v                          Eval; execute the character as a Jelly
                                      program with argument n.

N×N

““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv              Main link. Argument: n

““((ẹẹ++))‘                           As before.
           ‘                          Increment all integers.
            FF                        Flatten the array. Yields an integer array.
              QQ                      Unique; deduplicate the integers.
                                      This yields [41, 215, 44, 42].
                ṖṖ                    Pop twice; remove the last two elements.
                  ṪṪ                  Tail; extract the last element.
                                      This yields 215, the Unicode code point of ×.
                    ỌỌ                Unordinal; cast to character.
                      v               Eval; execute the character as a Jelly
                                      program with argument n.
                       v              Eval; convert the return value (n×n) to a
                                      string and execute that string as a Jelly
                                      program with argument n. Since the string
                                      consists of a single integer literal, that
                                      integer is returned, ignoring the argument.

Note that F, Q, Ṫ, and Ọ do not alter 1D arrays, arrays without duplicates, integers, and characters (respectively).

N^N

“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv  Main link. Argument: n

“““(((ẹẹẹ+++)))‘                      As before.
                ‘‘                    Increment all integers twice.
                  FFF                 Flatten the array. Yields an integer array.
                     QQQ              Unique; deduplicate the integers.
                                      This yields [42, 216, 45, 43].
                        ṖṖṖ           Pop thrice; remove the last three elements.
                           ṪṪṪ        Tail; extract the last element.
                                      This yields 42, the Unicode code point of *.
                              ỌỌỌ     Unordinal; cast to character.
                                 v    Eval; execute the character as a Jelly
                                      program with argument n.
                                  vv  Eval twice. See N×N.


问:
1, 2, Fizz, 4, Buzz

Introduction

In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other catalogue challenges, there is "Hello World!" and "Is this number a prime?".

Challenge

Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Output

The output will be a list of numbers (and Fizzes, Buzzes and FizzBuzzes) separated by a newline (either \n or \r\n). A trailing newline is acceptable, but a leading newline is not.  Apart from your choice of newline, the output should look exactly like this:

```<code>1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
</code>```

The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation.

Further Rules

This is not about finding the language with the shortest approach for playing FizzBuzz, this is about finding the shortest approach in every language. Therefore, no answer will be marked as accepted.

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

Nothing can be printed to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge. If anyone wants to abuse this by creating a language where the empty program generates FizzBuzz output, then congrats for paving the way for a very boring answer.

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

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

Because the output is fixed, you may hardcode the output (but this may not be the shortest option).

You may use preexisting solutions, as long as you credit the original author of the program.

Standard loopholes are otherwise disallowed.

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

Catalogue

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

```

答:
Groovy, 61 bytes

```<code>100.times{a=++it%3?"":"fizz"
a+=it%5?"":"buzz"
println a?:it}
</code>```

ContentLicense: CC BY-SA 4.0

Title: 1, 2, Fizz, 4, Buzz

Body:
Groovy, 61 bytes

100.times{a=++it%3?"":"fizz"
a+=it%5?"":"buzz"
println a?:it}


问:
C: replace AES FIPS-197 SubBytes table by constant-time code
In FIPS-197 (the Advanced Encryption Standard, known as AES), it is made heavy use of SubBytes, which could be implemented as

```<code>unsigned char SubBytes(unsigned char x) {
static const unsigned char t[256] = {
  0x63,0x7C,0x77,0x7B,0xF2,0x6B,0x6F,0xC5,0x30,0x01,0x67,0x2B,0xFE,0xD7,0xAB,0x76,
  0xCA,0x82,0xC9,0x7D,0xFA,0x59,0x47,0xF0,0xAD,0xD4,0xA2,0xAF,0x9C,0xA4,0x72,0xC0,
  0xB7,0xFD,0x93,0x26,0x36,0x3F,0xF7,0xCC,0x34,0xA5,0xE5,0xF1,0x71,0xD8,0x31,0x15,
  0x04,0xC7,0x23,0xC3,0x18,0x96,0x05,0x9A,0x07,0x12,0x80,0xE2,0xEB,0x27,0xB2,0x75,
  0x09,0x83,0x2C,0x1A,0x1B,0x6E,0x5A,0xA0,0x52,0x3B,0xD6,0xB3,0x29,0xE3,0x2F,0x84,
  0x53,0xD1,0x00,0xED,0x20,0xFC,0xB1,0x5B,0x6A,0xCB,0xBE,0x39,0x4A,0x4C,0x58,0xCF,
  0xD0,0xEF,0xAA,0xFB,0x43,0x4D,0x33,0x85,0x45,0xF9,0x02,0x7F,0x50,0x3C,0x9F,0xA8,
  0x51,0xA3,0x40,0x8F,0x92,0x9D,0x38,0xF5,0xBC,0xB6,0xDA,0x21,0x10,0xFF,0xF3,0xD2,
  0xCD,0x0C,0x13,0xEC,0x5F,0x97,0x44,0x17,0xC4,0xA7,0x7E,0x3D,0x64,0x5D,0x19,0x73,
  0x60,0x81,0x4F,0xDC,0x22,0x2A,0x90,0x88,0x46,0xEE,0xB8,0x14,0xDE,0x5E,0x0B,0xDB,
  0xE0,0x32,0x3A,0x0A,0x49,0x06,0x24,0x5C,0xC2,0xD3,0xAC,0x62,0x91,0x95,0xE4,0x79,
  0xE7,0xC8,0x37,0x6D,0x8D,0xD5,0x4E,0xA9,0x6C,0x56,0xF4,0xEA,0x65,0x7A,0xAE,0x08,
  0xBA,0x78,0x25,0x2E,0x1C,0xA6,0xB4,0xC6,0xE8,0xDD,0x74,0x1F,0x4B,0xBD,0x8B,0x8A,
  0x70,0x3E,0xB5,0x66,0x48,0x03,0xF6,0x0E,0x61,0x35,0x57,0xB9,0x86,0xC1,0x1D,0x9E,
  0xE1,0xF8,0x98,0x11,0x69,0xD9,0x8E,0x94,0x9B,0x1E,0x87,0xE9,0xCE,0x55,0x28,0xDF,
  0x8C,0xA1,0x89,0x0D,0xBF,0xE6,0x42,0x68,0x41,0x99,0x2D,0x0F,0xB0,0x54,0xBB,0x16};
return t[x];}
</code>```

This function is not arbitrary; it is a reversible mapping, consisting of an inversion in a Galois Field followed by an affine transformation. All the details are in FIPS-197 section 5.1.1 or here section 4.2.1 (under a slightly different name).

One problem with implementation as a table is that it opens to so-called cache-timing attacks.

Thus your mission is to devise an exact replacement for the above SubBytes() function, that exhibits constant-time behavior; we'll assume that's the case when nothing depending on the input x of SubBytes is used  either:

as an array index,

as the control operand of if, while, for, case, or operator ?:;

as any operand of operators &&, ||, !, ==, !=, <, >, <=, >=, *, /, %;

as the right operand of operators >>, <<, *=, /=, %=, <<=, >>=.

The winning entry will be one with the lowest cost, obtained from the number of operators executed in the input-dependent data path, with a weight of 5 for unary operators - and ~ as well as for <<1, >>1, +1, -1; weight of 7 for all other operators, shifts with other counts, or adds/subs of other constants (type casts and promotions are free). By principle, that cost is unchanged by unrolling loops (if any), and independent of the input x. As a tie-breaker, the answer with the shortest code after removing whitespace and comments wins.

I plan to designate an entry as answer as early as I can in year 2013, UTC. I will consider answers in languages that I've some knowledge of, ranking them as a straight translation to C not optimized for size.

Apologies for the initial omission of +1 and -1 in the favored operators, of free casts and promotions, and ranking of size. Note that * is prohibited both when unary, and as multiplication.

Body:
Score 1968 1692, using the lookup table

Note: This solution doesn't pass the criteria, because of w >> b.

Using the lookup table, but reading 8 bytes at a time.

3*7 + 32 * (6*7 + 2*5) + 7 = 692

unsigned char SubBytes(unsigned char x){

static const unsigned char t[256] = {
  0x63,0x7C,0x77,0x7B,0xF2,0x6B,0x6F,0xC5,0x30,0x01,0x67,0x2B,0xFE,0xD7,0xAB,0x76,
  0xCA,0x82,0xC9,0x7D,0xFA,0x59,0x47,0xF0,0xAD,0xD4,0xA2,0xAF,0x9C,0xA4,0x72,0xC0,
  0xB7,0xFD,0x93,0x26,0x36,0x3F,0xF7,0xCC,0x34,0xA5,0xE5,0xF1,0x71,0xD8,0x31,0x15,
  0x04,0xC7,0x23,0xC3,0x18,0x96,0x05,0x9A,0x07,0x12,0x80,0xE2,0xEB,0x27,0xB2,0x75,
  0x09,0x83,0x2C,0x1A,0x1B,0x6E,0x5A,0xA0,0x52,0x3B,0xD6,0xB3,0x29,0xE3,0x2F,0x84,
  0x53,0xD1,0x00,0xED,0x20,0xFC,0xB1,0x5B,0x6A,0xCB,0xBE,0x39,0x4A,0x4C,0x58,0xCF,
  0xD0,0xEF,0xAA,0xFB,0x43,0x4D,0x33,0x85,0x45,0xF9,0x02,0x7F,0x50,0x3C,0x9F,0xA8,
  0x51,0xA3,0x40,0x8F,0x92,0x9D,0x38,0xF5,0xBC,0xB6,0xDA,0x21,0x10,0xFF,0xF3,0xD2,
  0xCD,0x0C,0x13,0xEC,0x5F,0x97,0x44,0x17,0xC4,0xA7,0x7E,0x3D,0x64,0x5D,0x19,0x73,
  0x60,0x81,0x4F,0xDC,0x22,0x2A,0x90,0x88,0x46,0xEE,0xB8,0x14,0xDE,0x5E,0x0B,0xDB,
  0xE0,0x32,0x3A,0x0A,0x49,0x06,0x24,0x5C,0xC2,0xD3,0xAC,0x62,0x91,0x95,0xE4,0x79,
  0xE7,0xC8,0x37,0x6D,0x8D,0xD5,0x4E,0xA9,0x6C,0x56,0xF4,0xEA,0x65,0x7A,0xAE,0x08,
  0xBA,0x78,0x25,0x2E,0x1C,0xA6,0xB4,0xC6,0xE8,0xDD,0x74,0x1F,0x4B,0xBD,0x8B,0x8A,
  0x70,0x3E,0xB5,0x66,0x48,0x03,0xF6,0x0E,0x61,0x35,0x57,0xB9,0x86,0xC1,0x1D,0x9E,
  0xE1,0xF8,0x98,0x11,0x69,0xD9,0x8E,0x94,0x9B,0x1E,0x87,0xE9,0xCE,0x55,0x28,0xDF,
  0x8C,0xA1,0x89,0x0D,0xBF,0xE6,0x42,0x68,0x41,0x99,0x2D,0x0F,0xB0,0x54,0xBB,0x16};

  unsigned long long *t2 = (unsigned long long *)t;
  int a = x>>3, b=(x&7)<<3;                       // 7+7+7
  int i;
  int ret = 0;
  for (i=0;i<256/8;i++) {                         // 32 *
      unsigned long long w = t2[i];
      int badi = ((unsigned int)(a|-a))>>31;      // 7+7+5
      w &= (badi-1);                              // +7+7
      a--;                                        // +5
      ret |= w >> b;                              // +7+7
  }
  return ret & 0xff;                              // +7
}


问:
Lead Your Turtle by a String
Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space:

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

You may assume the input is valid.

Based on the input, draw a new string arranged on a textual grid of spaces and newlines following turtle graphics-esque rules where the turtle always occupies one grid space and can only face the cardinal directions.

Print the first character in the input string to the text grid. The turtle starts here facing right. Iterate over the rest of the characters in the input string (only stopping if the turtle gets stuck), repeating this process:

If the 4 grid spaces directly neighboring the turtle are all filled (i.e. none of them is a space), stop iterating. The turtle is stuck and the grid is as  complete as it can be.

Look at the current character in the input compared to the previous character:

If the current character is lexically before the previous, rotate the turtle a quarter turn left.

If the current character is lexically after the previous, rotate the turtle a quarter turn right.

If the current character equals the previous, don't rotate the turtle.

If the grid space the turtle is now facing is not empty (i.e. not a space), repeatedly rotate the turtle a quarter turn left until she is facing an empty grid space.

Move the turtle one grid step forward in the direction she's facing and print the current character on the grid in the turtle's new location.

Print or return the resulting text grid string with no extraneous rows or columns of whitespace. Lines may have trailing spaces up to the rightmost column with a non-space, but not beyond. A single trailing newline is optionally allowed.

The shortest code in bytes wins.

Example

Here are all the steps of the input spattuuxze. The ^V<> characters show the direction the turtle is facing, they are not part of the input or output.

```<code>s></code>```

```<code>^
p
s</code>```

```<code><ap
  s</code>```

```<code>^
t
ap
 s</code>```

```<code>^
t
t
ap
 s</code>```

```<code>tu>
t
ap
 s</code>```

```<code>tuu>
t
ap
 s</code>```

```<code>tuu
t x
apV
 s</code>```

```<code>tuu
<zx
ap
 s</code>```

At this point the turtle is stuck so the e never gets printed and the final output is:

```<code>s></code>```0

Following is a similar but invalid output since it has an unnecessary leading column of whitespace:

```<code>s></code>```1

Test Cases

```<code>s></code>```2

(Do tell me right away if any of these seem wrong.)

答:
Java, <s>408</s> 406 bytes

```<code>String f(String I){int l=I.length(),x=l,y=x,z=x,t=y,Z=x,T=y,d=1,i=1,a;char[][]g=new char[l*2][l*2];int[]D={-1,0,1,0};for(char c,p=g[x][y]=I.charAt(0);i<l;p=c){c=I.charAt(i++);d=((c<p?d-1:c>p?d+1:d)+4)%4;for(a=0;g[x+D[d]][y+D[3-d]]>0&&a++<4;)d=(d+3)%4;if(a>3)break;g[x+=D[d]][y+=D[3-d]]=c;z=z<x?z:x;Z=Z>x?Z:x;t=t<y?t:y;T=T>y?T:y;}for(I="";z<=Z;z++,I+="\n")for(a=t;a<=T;a++)I+=g[z][a]<1?32:g[z][a];return I;}
</code>```

The function gets the the input as String and returns the outcome as a String.

Internally it uses a 2D char array to store the letters and keeps the min and max columns and rows used in order to return the sub-array that was used.

So, in the outcome String there are no leading columns of white-spaces but there are trailing white-spaces up to the rightmost column with a non-space character. A newline is added at the end.

Any suggestions to golf it more are welcome :-)

Title: Lead Your Turtle by a String

Body:
Java, <s>408</s> 406 bytes

String f(String I){int l=I.length(),x=l,y=x,z=x,t=y,Z=x,T=y,d=1,i=1,a;char[][]g=new char[l*2][l*2];int[]D={-1,0,1,0};for(char c,p=g[x][y]=I.charAt(0);i<l;p=c){c=I.charAt(i++);d=((c<p?d-1:c>p?d+1:d)+4)%4;for(a=0;g[x+D[d]][y+D[3-d]]>0&&a++<4;)d=(d+3)%4;if(a>3)break;g[x+=D[d]][y+=D[3-d]]=c;z=z<x?z:x;Z=Z>x?Z:x;t=t<y?t:y;T=T>y?T:y;}for(I="";z<=Z;z++,I+="\n")for(a=t;a<=T;a++)I+=g[z][a]<1?32:g[z][a];return I;}

The function gets the the input as String and returns the outcome as a String.

Internally it uses a 2D char array to store the letters and keeps the min and max columns and rows used in order to return the sub-array that was used.

So, in the outcome String there are no leading columns of white-spaces but there are trailing white-spaces up to the rightmost column with a non-space character. A newline is added at the end.

Any suggestions to golf it more are welcome :-)


问:
Distance to four
This challenge is based on this video. I recommend that you watch it before trying this challenge.

First we define a function.  This function (OEIS) takes a integer n as input and outputs the number of letters in the English representation of n (without spaces or hyphens).  For example "three" has 5 letters so 3 maps to 5.

As demonstrated in the video starting with any number repeating this process will eventually result in a four, which will map to itself forever.

Here is a crude directed graph showing the orbits of the numbers less than 16:

```<code>  12 11
    \|
15 2 6 1 10 14 13
  \ \|/ /  /  /
   7 3-/  8--/
    \|   /
 9 0 5--/
  \ \|
   \-4
</code>```

Your challenge is to determine the number of steps that a number will take (or the number of times this function must be applied to a number) before reaching four (i.e. the level on the directed graph pictured).

Forming english numbers

Here is a brief explanation of how one should form english words for this challenge:

The numbers one through nineteen are:

one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen

For numbers greater than nineteen the process is as follows:

If the number has a hundreds place begin with the name of digit in the hundreds place and "hundred".

e.g.

```<code>100 -> "onehundred"
</code>```

If the remainder is less than twenty append the remainder's English representation.

e.g.

```<code>714 -> "sevenhundredfourteen"
</code>```

Otherwise if the tens digit is not zero append the proper representation:

```<code>2-> twenty
3-> thirty
4-> forty
5-> fifty
6-> sixty
7-> seventy
8-> eighty
9-> ninety
</code>```

e.g.

```<code>470 -> "fourhundredseventy"
</code>```

Finally if there is a one's digit append its representation

e.g.

```<code>681 -> "sixhundredeightyone"
</code>```

Further Stipulations

For numbers greater than one hundred you should leave out the "and" when counting the number of letters. For instance 577 is "fivehundredseventyseven" which has 23 letters.

Your program must accept all integers greater than 0 and less than 1,000 as input via standard methods.

Your program must output the number of steps required to standard output methods.

This is codegolf so the solution with the fewest bytes wins.

Test cases

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

答:
Python 2.7, <s>344</s> <s>216</s> 208 bytes:

```<code>x=`input()`;c=0;y=lambda v:dict(zip(range(0,10),[0]+v));l=[3,3,5,4,4,3,5,5,4];d=y(l);e=y([3,6,6,6,5,5,7,7,6]);f=y([i+7for i in l])
while x!='4':x=`sum([q[int(r)]for q,r in zip([d,e,f],x[::-1])])`;c+=1
print c
</code>```

Does not use any external libraries unlike other Python answer. Takes input through stdin and outputs to stdout.

Repl.it with All Test Cases!

Explanation

First creates 3 dictionaries with each one pairing the length of the English word representations of each number to the number it represents in the closed interval [1,9] in the ones, tens, and hundreds place, respectively. For example, the first entry in dictionary d is 1:3 as 1 is spelled one in English and has 3 letters.

Then, each digits place in some string input x is assigned to its corresponding dictionary, after which each number in each place is matched up with its value in the corresponding dictionary. For instance, suppose the input number was 23. The 20 in the tens place would be paired with dictionary e, in which it is matched with 6, and the 3 in the ones place would be paired with dictionary d, in which it is matched with 5. These matched digits are then added together to represent the length of the English representation of the number, which is assigned to x as a string and, as long as x!='4', the while loop goes on, incrementing c by 1 each time to represent the number of steps taken thus far. Therefore, 23 would correspond to 11, which would in turn correspond to 6 which would turn to 3 and then to 5 and finally to 4, resulting in 5 total steps.

Finally, once the loop finishes, c is output to stdout to represent the "Distance to Four", which in this case would be 5.

Title: Distance to four

Body:
Python 2.7, <s>344</s> <s>216</s> 208 bytes:

x=`input()`;c=0;y=lambda v:dict(zip(range(0,10),[0]+v));l=[3,3,5,4,4,3,5,5,4];d=y(l);e=y([3,6,6,6,5,5,7,7,6]);f=y([i+7for i in l])
while x!='4':x=`sum([q[int(r)]for q,r in zip([d,e,f],x[::-1])])`;c+=1
print c

Does not use any external libraries unlike other Python answer. Takes input through stdin and outputs to stdout.

Repl.it with All Test Cases!

Explanation

First creates 3 dictionaries with each one pairing the length of the English word representations of each number to the number it represents in the closed interval [1,9] in the ones, tens, and hundreds place, respectively. For example, the first entry in dictionary d is 1:3 as 1 is spelled one in English and has 3 letters.

Then, each digits place in some string input x is assigned to its corresponding dictionary, after which each number in each place is matched up with its value in the corresponding dictionary. For instance, suppose the input number was 23. The 20 in the tens place would be paired with dictionary e, in which it is matched with 6, and the 3 in the ones place would be paired with dictionary d, in which it is matched with 5. These matched digits are then added together to represent the length of the English representation of the number, which is assigned to x as a string and, as long as x!='4', the while loop goes on, incrementing c by 1 each time to represent the number of steps taken thus far. Therefore, 23 would correspond to 11, which would in turn correspond to 6 which would turn to 3 and then to 5 and finally to 4, resulting in 5 total steps.

Finally, once the loop finishes, c is output to stdout to represent the "Distance to Four", which in this case would be 5.


问:
Make me a bad fade animation... please
Your task is to, as the title discreetly suggests, make a bad fade animation of one word turning into a second word for yours truly.

What exactly is this "fade animation" you may ask?

To make a spectacular(ly bad) fade animation, you take two strings which will contain only printable ASCII characters. You start by printing your starting string (the first of the two). Then, you randomly pick a character in the original word and change it to the corresponding character in the word you want to animate to. When the words are of unequal length, you must pad them with spaces.

You keep on doing this until all of the characters have been changed, but you will not change the character at a certain index more than once. Here is an example i/o:

```<code>Hey -> Peeps
Hey    # original string
Hey s  # replace char at index 4
Hey s  # replace char at index 1
Pey s  # replace char at index 0
Pee s  # replace char at index 2
Peeps  # replace char at index 3
</code>```

You must write a function or full program that changes a letter and then prints the new string at increments of one second. The input format is loose, but the output format is strict.

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

Some test cases (Form: init -> final):

```<code>Stringy -> Blingy
Banana -> Republic
United -> States
Make America -> Tissue box
I like walls -> I have small hands
Hello, -> world!
</code>```

Reference implementation in Python 2:

```<code>import random
import time
def F(c,f):
    print c                                      # before we do stuff
    if len(c)>len(f):f+=" "*(len(c)-len(f))      # add padding part 1
    if len(f)>len(c):c+=" "*(len(f)-len(c))      # add padding part 2
    c, f = list(c), list(f)
    ai = [i for i in range(len(c))]              # a list for keeping track
    while len(ai) > 0:                           #  of available indices
        time.sleep(1)                            # 1 second pause...
        i = ai.pop(random.randint(0,len(ai)-1))  # get a random index and remove
        c[i] = f[i]                              #   it from the list
        print ''.join(c)                         # print the new string
</code>```

答:
Python 2, <s>171 169 168</s> 163 bytes

import time,random as r
def f(a,b):
 d=len(a)-len(b);a+=' '*-d;b+=' '*d;o=range(len(a));r.shuffle(o);print a
 for i in o:time.sleep(1);a=a[:i]+b[i]+a[i+1:];print a
```

Test cases are on ideone

Title: Make me a bad fade animation... please

Body:
Python 2, <s>171 169 168</s> 163 bytes

import time,random as r
def f(a,b):
 d=len(a)-len(b);a+=' '*-d;b+=' '*d;o=range(len(a));r.shuffle(o);print a
 for i in o:time.sleep(1);a=a[:i]+b[i]+a[i+1:];print a

Test cases are on ideone


答:
MATL, 33 bytes

```<code>cn2/XKZ@!Oyhg*XR"GcK:@mK:Eq+)D1Y.
</code>```

Try it at MATL Online. You may need to refresh the page and press "Run" again if it doesn't work.

Alternatively, this version (35 bytes) deletes the screen before each new string is displayed, which results in the output being "modified in place":

Title: Make me a bad fade animation... please

Body:
Your task is to, as the title discreetly suggests, make a bad fade animation of one word turning into a second word for yours truly.

What exactly is this "fade animation" you may ask?

To make a spectacular(ly bad) fade animation, you take two strings which will contain only printable ASCII characters. You start by printing your starting string (the first of the two). Then, you randomly pick a character in the original word and change it to the corresponding character in the word you want to animate to. When the words are of unequal length, you must pad them with spaces.

You keep on doing this until all of the characters have been changed, but you will not change the character at a certain index more than once. Here is an example i/o:

```<code>Hey -> Peeps
Hey    # original string
Hey s  # replace char at index 4
Hey s  # replace char at index 1
Pey s  # replace char at index 0
Pee s  # replace char at index 2
Peeps  # replace char at index 3
</code>```

You must write a function or full program that changes a letter and then prints the new string at increments of one second. The input format is loose, but the output format is strict.

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

Some test cases (Form: init -> final):

```<code>Stringy -> Blingy
Banana -> Republic
United -> States
Make America -> Tissue box
I like walls -> I have small hands
Hello, -> world!
</code>```

Reference implementation in Python 2:

```<code>import random
import time
def F(c,f):
    print c                                      # before we do stuff
    if len(c)>len(f):f+=" "*(len(c)-len(f))      # add padding part 1
    if len(f)>len(c):c+=" "*(len(f)-len(c))      # add padding part 2
    c, f = list(c), list(f)
    ai = [i for i in range(len(c))]              # a list for keeping track
    while len(ai) > 0:                           #  of available indices
        time.sleep(1)                            # 1 second pause...
        i = ai.pop(random.randint(0,len(ai)-1))  # get a random index and remove
        c[i] = f[i]                              #   it from the list
        print ''.join(c)                         # print the new string
</code>```

Body:
MATL, 33 bytes

cn2/XKZ@!Oyhg*XR"GcK:@mK:Eq+)D1Y.

Try it at MATL Online. You may need to refresh the page and press "Run" again if it doesn't work.

Alternatively, this version (35 bytes) deletes the screen before each new string is displayed, which results in the output being "modified in place":


答:
Perl, 131 + 4 (-F -l) = 135 bytes

@T=@F if!$i++}$T[$_]||=$",$F[$_]||=$"for 0..$#F,0..$#T;say@T;{$==rand@T;redo if$h{$=}++;$T[$=]=$F[$=];sleep 1;say@T;redo if++$v!=@T
```

<p>Needs <code>-F</code> and <code>-l</code> flags to run, as well as <code>-M5.010</code> (or <code>-E</code>). Note that if your version of perl is a bit old, you'll need to add <code>-an</code> on your command line (which I'll add too bellow to show it, but it's not needed).
For instance :</p>

```$ cat fade.pl
@T=@F if!$i++}$T[$_]||=$",$F[$_]||=$"for 0..$#F,0..$#T;say@T;{$==rand@T;redo if$h{$=}++;$T[$=]=$F[$=];sleep 1;say@T;redo if++$v!=@T
$ perl -F -anl -M5.010 fade.pl <<< "Hey
Peeps"
Hey
Pey
Pee
Pee s
Pee s
Peeps
```

I'm pretty sure this could be shorter, but I couldn't find out how... yet! Still, I don't think this is a bad answer, and hopefully someone will be inspired to make it shorter (or have a totally different idea!).

Title: Make me a bad fade animation... please

Body:
Perl, 131 + 4 (-F -l) = 135 bytes

@T=@F if!$i++}$T[$_]||=$",$F[$_]||=$"for 0..$#F,0..$#T;say@T;{$==rand@T;redo if$h{$=}++;$T[$=]=$F[$=];sleep 1;say@T;redo if++$v!=@T

Needs -F and -l flags to run, as well as -M5.010 (or -E). Note that if your version of perl is a bit old, you'll need to add -an on your command line (which I'll add too bellow to show it, but it's not needed).
For instance :

$ cat fade.pl
@T=@F if!$i++}$T[$_]||=$",$F[$_]||=$"for 0..$#F,0..$#T;say@T;{$==rand@T;redo if$h{$=}++;$T[$=]=$F[$=];sleep 1;say@T;redo if++$v!=@T
$ perl -F -anl -M5.010 fade.pl <<< "Hey
Peeps"
Hey
Pey
Pee
Pee s
Pee s
Peeps

I'm pretty sure this could be shorter, but I couldn't find out how... yet! Still, I don't think this is a bad answer, and hopefully someone will be inspired to make it shorter (or have a totally different idea!).


问:
Random Golf of the Day #7: A distinctly random character

About the Series

This is a guest entry for the Random Golf of the Day series.

First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post.

Input

No input is taken.

Output

A single letter of the alphabet (case irrelevant), with an optional trailing newline. Each letter must have non-zero probability of being chosen, and all 26 probabilities must be distinct. To remove all ambiguity: Distinct means that there must not be two probabilities that are equal to each other.

Scoring

This is code golf. Shortest code in bytes wins.

A valid entry is a full program or function that has zero probability of not terminating.

Alphabet

To avoid confusion, the particular alphabet to be used is the Latin alphabet:

Either

```<code>ABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

or

```<code>abcdefghijklmnopqrstuvwxyz
</code>```

You may choose to output upper case or lower case. Alternatively, you may choose to output different cases on different runs if that helps. The probability for a given letter is the probability of that letter appearing in either case (upper or lower).

Explanation

As it won't be at all obvious from the output, please include a clear explanation of how you achieved the 26 distinct probabilities.

Leaderboard

(from here)

var QUESTION_ID=89621,OVERRIDE_USER=20283;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

```
</div>
</div>
</p>

<p><strong>The first post of the series also generates an overall leaderboard.</strong></p>

<p>To make sure that your answers show up, please start every answer with a headline, using the following Markdown template:</p>

```## Language Name, N bytes
```

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

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

(The language is not currently shown, but the snippet does require and parse it, and I may add a by-language leaderboard in the future.)

答:
IA-32 machine code, 12 bytes

Hexdump:

```<code>0F C7 F0 F6 E4 88 E0 D4 1A 04 61 C3
</code>```

Source code:

```<code>rdrand eax
mul ah
mov al, ah
aam 26
add al, 'a'
ret
</code>```

Or, as a C expression (assuming r is a uniformly generated random number of type uint32_t):

```<code>(r & 0xff) * ((r >> 8) & 0xff) / 0x100 % 26 + 'a'
</code>```

Running this expression on values in the range 0...65535 gives the probabilities of the letters:

```<code>z 1968
y 2012
x 2068
w 2076
v 2134
u 2140
t 2194
s 2209
r 2233
q 2292
p 2335
o 2358
n 2410
m 2437
l 2475
k 2545
j 2571
i 2654
h 2696
g 2738
f 2818
e 2922
d 2955
c 3098
b 3241
a 3957
</code>```

Body:
IA-32 machine code, 12 bytes

Hexdump:

0F C7 F0 F6 E4 88 E0 D4 1A 04 61 C3

Source code:

rdrand eax
mul ah
mov al, ah
aam 26
add al, 'a'
ret

Or, as a C expression (assuming r is a uniformly generated random number of type uint32_t):

(r & 0xff) * ((r >> 8) & 0xff) / 0x100 % 26 + 'a'

Running this expression on values in the range 0...65535 gives the probabilities of the letters:

z 1968
y 2012
x 2068
w 2076
v 2134
u 2140
t 2194
s 2209
r 2233
q 2292
p 2335
o 2358
n 2410
m 2437
l 2475
k 2545
j 2571
i 2654
h 2696
g 2738
f 2818
e 2922
d 2955
c 3098
b 3241
a 3957


问:
4-way intersection generator
Here is an ASCII-art of a 4-way intersection:

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

(Note how the horizontal roads are 3 rows tall, while the vertical roads are 5 columns wide. This is for aesthetic reasons, because of the rectangular font.)

Your challenge is to produce this ASCII art. However, as I'm sure you all know, not every intersection has a road travelling off in every single direction. This particular intersection goes NESW, but some intersections might go, for example, NW:

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

Or it might go SWE:

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

Or it may even go E, just a single direction (although you can hardly call this an intersection, but try to avoid being overly pedantic):

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

You need to write a program or function that can easily generate any of these combinations. More specifically, your challenge is to write a program or function that takes a string of directions, consisting of NESW, as input, and outputs or returns this ASCII art of an intersection with roads pointing in those directions. These directions may appear in any order, but the input will not contain any characters except for N, E, S, or W. If you like, you may request inputs to be lowercase instead, but you must specify this in your answer. You may also assume that all inputs will contain at least one direction.

The last example had leading spaces on each line, because there is no road going west. If you do not have a road going west, these leading spaces are optional. This:

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

Would also be an acceptable output. Similarly, if N or S is gone, empty lines in there place are optional. One trailing newline is allowed, and trailing spaces are allowed as long as the output is visually the same.

You may take input and output in any reasonable format, such as STDIN/STDOUT, command line args, files, function arguments/return values, etc.

As usual, this is code-golf, so try to get the shortest possible answer in whatever language you happen to use!

Sample IO:

```<code>NESW:

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

NS:

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

S:

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

EW:

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

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

答:
Pyth (385 380 373 353 bytes)

Golfed:

```<code>K"     |  |  |\n     |     |\n"?}\Nz++KKPKk?}\Wz?}\Ez+++*5\-*2+\+*5\-"\n     |     |\n- - -|     |- - -\n     |     |\n"+*5\-*2+\+*5\-++*2+*5\-\+"\n     |     |\n- - -|     |\n     |     |\n"*2+*5\-\+?}\Ez+"     "+*2+\+*5\-"\n     |     |\n     |     |- - -\n     |     |\n     +-----+-----"++"     +-----+\n"*3"     |     |\n""     +-----+"?}\Sz++KKPKk
</code>```

Ungolfed:

```<code>K"     |  |  |\n     |     |\n"  //sets K to first two lines of north
?}\Nz                            //if north in the input
  ++KKPK                         //then: return K + K + K[:-1]
  k                              //else: return ""
?}\Wz                            //if West in input
  ?}\Ez                          //if East in input
    +++*5\-*2+\+*5\-"\n     |     |\n- - -|     |- - -\n     |     |\n"+*5\-*2+\+*5\-    //then: Return E+W string
    ++*2+*5\-\+"\n     |     |\n- - -|     |\n     |     |\n"*2+*5\-\+         //else: Return W string
  ?}\Ez                          //else: if east in input (and not W)
    +"     "+*2+\+*5\-"\n     |     |\n     |     |- - -\n     |     |\n     +-----+-----" //return East without West String
    ++"     +-----+\n"*3"     |     |\n""     +-----+" \\Return empty left and right intersection
?}\Sz                            //if south in input
  ++KKPK                         //return north string
  k                              //return ""
</code>```

Of course, if there are any improvements please tell me.

Saved 5 bytes thanks to Maltysen

You can try it here

Title: 4-way intersection generator

Body:
Pyth (385 380 373 353 bytes)

Golfed:

K"     |  |  |\n     |     |\n"?}\Nz++KKPKk?}\Wz?}\Ez+++*5\-*2+\+*5\-"\n     |     |\n- - -|     |- - -\n     |     |\n"+*5\-*2+\+*5\-++*2+*5\-\+"\n     |     |\n- - -|     |\n     |     |\n"*2+*5\-\+?}\Ez+"     "+*2+\+*5\-"\n     |     |\n     |     |- - -\n     |     |\n     +-----+-----"++"     +-----+\n"*3"     |     |\n""     +-----+"?}\Sz++KKPKk

Ungolfed:

K"     |  |  |\n     |     |\n"  //sets K to first two lines of north
?}\Nz                            //if north in the input
  ++KKPK                         //then: return K + K + K[:-1]
  k                              //else: return ""
?}\Wz                            //if West in input
  ?}\Ez                          //if East in input
    +++*5\-*2+\+*5\-"\n     |     |\n- - -|     |- - -\n     |     |\n"+*5\-*2+\+*5\-    //then: Return E+W string
    ++*2+*5\-\+"\n     |     |\n- - -|     |\n     |     |\n"*2+*5\-\+         //else: Return W string
  ?}\Ez                          //else: if east in input (and not W)
    +"     "+*2+\+*5\-"\n     |     |\n     |     |- - -\n     |     |\n     +-----+-----" //return East without West String
    ++"     +-----+\n"*3"     |     |\n""     +-----+" \\Return empty left and right intersection
?}\Sz                            //if south in input
  ++KKPK                         //return north string
  k                              //return ""

Of course, if there are any improvements please tell me.

Saved 5 bytes thanks to Maltysen

<a href="http://pyth.herokuapp.com/?code=K%22+++++%7C++%7C++%7C%5Cn+++++%7C+++++%7C%5Cn%22%3F%7D%5CNz%2B%2BKKPKk%3F%7D%5CWz%3F%7D%5CEz%2B%2B%2B%2a5%5C-%2a2%2B%5C%2B%2a5%5C-%22%5Cn+++++%7C+++++%7C%5Cn-+-+-%7C+++++%7C-+-+-%5Cn+++++%7C+++++%7C%5Cn%22%2B%2a5%5C-%2a2%2B%5C%2B%2a5%5C-%2B%2B%2a2%2B%2a5%5C-%5C%2B%22%5Cn+++++%7C+++++%7C%5Cn-+-+-%7C+++++%7C%5Cn+++++%7C+++++%7C%5Cn%22%2a2%2B%2a5%5C-%5C%2B%3F%7D%5CEz%2B%22+++++%22%2B%2a2%2B%5C%2B%2a5%5C-%22%5Cn+++++%7C+++++%7C%5Cn+++++%7C+++++%7C-+-+-%5Cn+++++%7C+++++%7C%5Cn+++++%2B-----%2B-----%22%2B%2B%22+++++%2B-----%2B%5Cn%22%2a3%22+++++%7C+++++%7C%5Cn%22%22+++++%2B-----%2B%22%3F%7D%5CSz%2B%2BKKPKk&input=N%0AW%0AE%0AS%0ANW%0ANE%0ANS%0ASW%0ASE%0ASN%0A&test_suite=1&test_suite_input=E&debug=0" rel="nofollow">You can try it here


答:
Irregular, 63 bytes

```<code>p~?1_$-1p:;
n=i(0)?1_$-1p:;
_~
N=n
1(?!(11+)\1+$)11+~1
^11$~0
N
</code>```

I created this language two days ago, and the basic premises are that there are no built in loops, the only features are basic arithmetic and decision making, and program evaluation is based on regular expressions.

Explanation

```<code>p~?1_$-1p:;
n=i(0)?1_$-1p:;
_~
N=n
</code>```

This part converts the input into unary. It repeatedly subtracts 1 from the input until it equals 0, prepending 1_ each time. It then removes all of the _s. If I hadn't forgotten a break in my code it could be written as so:

```<code>p~?1_$-1p:;
_~
n=i(0)?1_$-1p:;
</code>```

The next part repeatedly removes the largest prime from the input until it is equal to 1 or 11, with 11 being replaced with 0.

```<code>1(?!(11+)\1+$)11+~1
^11$~0
N
</code>```

I used the regex from Martin Ender's answer.

Title: Can the number reach 1 by repeatedly subtracting the largest prime less than it?

Body:
Challenge:

Given a number, take the largest prime strictly less than it, subtract it from this number, do this again to this new number with the biggest prime less than it, and continue doing this until it's less than 3. If it reaches 1, your program should output a truthy value, else, the program should output a falsey value.

Examples:

All of these should give a truthy value:

```<code>3
4
6
8
10
11
12
14
16
17
18
20
22
23
24
26
27
29
30
32
34
35
37
38
40
41
42
44
46
47
48
50
</code>```

All of these should give falsey values:

```<code>5
7
9
13
15
19
21
25
28
31
33
36
39
43
45
49
</code>```

Rules:

You can either write a program or function.

You can assume that the input is bigger than 2.

Standard loopholes apply

This is code-golf so the shortest answer wins!

Body:
Irregular, 63 bytes

p~?1_$-1p:;
n=i(0)?1_$-1p:;
_~
N=n
1(?!(11+)\1+$)11+~1
^11$~0
N

I created this language two days ago, and the basic premises are that there are no built in loops, the only features are basic arithmetic and decision making, and program evaluation is based on regular expressions.

Explanation

p~?1_$-1p:;
n=i(0)?1_$-1p:;
_~
N=n

This part converts the input into unary. It repeatedly subtracts 1 from the input until it equals 0, prepending 1_ each time. It then removes all of the _s. If I hadn't forgotten a break in my code it could be written as so:

p~?1_$-1p:;
_~
n=i(0)?1_$-1p:;

The next part repeatedly removes the largest prime from the input until it is equal to 1 or 11, with 11 being replaced with 0.

1(?!(11+)\1+$)11+~1
^11$~0
N

I used the regex from Martin Ender's answer.


答:
Java, <s>456</s> <s>454</s> <s>437</s> 428 bytes

```<code>import java.util.*;public class c{public static void main(String[]s)throws Exception{char[]a=s[0].toCharArray(),b=s[1].toCharArray();int l,j=0;if(a.length<b.length){l=b.length;a=Arrays.copyOf(a,l);}else{l=a.length;b=Arrays.copyOf(b,l);}Vector i=new Vector();for(;j<l;i.add(j++));System.out.println(s[0]);while(l>0){Thread.sleep(1000);j=(int)i.remove(new Random().nextInt(l--));a[j]=b[j];System.out.println(String.valueOf(a));}}}
</code>```

Ungolfed:

```<code>import java.util.*;

public class c
{

public static void main(String[] s) throws Exception
{
    char[] a = s[0].toCharArray(), b = s[1].toCharArray();
    int l, j = 0;
    if (a.length < b.length)
    {
        l = b.length;
        a = Arrays.copyOf(a, l);
    }
    else
    {
        l = a.length;
        b = Arrays.copyOf(b, l);
    }

    Vector i = new Vector();

    for (; j < l; i.add(j++));

    System.out.println(s[0]);

    while (l > 0)
    {
        Thread.sleep(1000);
        j = (int) i.remove(new Random().nextInt(l--));
        a[j] = b[j];
        System.out.println(String.valueOf(a));
    }
}
}
</code>```

Edit: minus 2 byte by  CAD97

Edit: minus 17 byte by Kevin Cruijssen (I slightly altered the suggestion by reusing j instead of creating a new variable x to hold the size)

Edit: minus 9 byte

Title: Make me a bad fade animation... please

Body:
Java, <s>456</s> <s>454</s> <s>437</s> 428 bytes

import java.util.*;public class c{public static void main(String[]s)throws Exception{char[]a=s[0].toCharArray(),b=s[1].toCharArray();int l,j=0;if(a.length<b.length){l=b.length;a=Arrays.copyOf(a,l);}else{l=a.length;b=Arrays.copyOf(b,l);}Vector i=new Vector();for(;j<l;i.add(j++));System.out.println(s[0]);while(l>0){Thread.sleep(1000);j=(int)i.remove(new Random().nextInt(l--));a[j]=b[j];System.out.println(String.valueOf(a));}}}

Ungolfed:

import java.util.*;

public class c
{

public static void main(String[] s) throws Exception
{
    char[] a = s[0].toCharArray(), b = s[1].toCharArray();
    int l, j = 0;
    if (a.length < b.length)
    {
        l = b.length;
        a = Arrays.copyOf(a, l);
    }
    else
    {
        l = a.length;
        b = Arrays.copyOf(b, l);
    }

    Vector i = new Vector();

    for (; j < l; i.add(j++));

    System.out.println(s[0]);

    while (l > 0)
    {
        Thread.sleep(1000);
        j = (int) i.remove(new Random().nextInt(l--));
        a[j] = b[j];
        System.out.println(String.valueOf(a));
    }
}
}

Edit: minus 2 byte by  CAD97

Edit: minus 17 byte by Kevin Cruijssen (I slightly altered the suggestion by reusing j instead of creating a new variable x to hold the size)

Edit: minus 9 byte


问:
Goldenness of an integer
A positive integer n can be represented as a rectangle with integer sides a, b such that n = a * b. That is, the area represents the number. In general, a and b are not unique for a given n.

As is well known, a rectangle is specially pleasing to the eye (or is it the brain?) when its sides are in the golden ratio, φ = (sqrt(5)+1)/2 ≈ 1.6180339887...

Combining these two facts, the purpose of this challenge is to decompose an integer n into the product of two integers a, b whose ratio is as close as possible to φ (with the usual metric on ℝ). The fact that φ is irrational implies that there is a unique solution pair (a, b).

The challenge

Given a positive integer n, output positive integers a, b such that  a * b = n and the absolute difference between a/b and φ is minimized.

As an example, consider n = 12. The pairs (a, b) that satisfy a * b = n are: (1, 12), (2,6), (3,4), (4,3), (6,2), (12,1). The pair whose ratio is closest to φ is (4,3), which gives 4/3 = 1.333.

Rules

Functions or programs are acceptable.

The numerator (a) should appear first in the output, and the denominator (b) second. Other than that, input and output formats are flexible as usual. For example, the two numbers can be output as strings with any reasonable separator, or as an array.

The code should work in theory for arbitrarily large numbers. In practice, it may be limited by memory or data-type restrictions.

It's sufficient to consider an approximate version of φ, as long as it is accurate up to the third decimal or better. That is, the absolute difference between the true φ and the approximate value should not exceed 0.0005. For example, 1.618 is acceptable.

When using an approximate, rational version of φ there's a small chance that the solution is not unique. In that case you can output any pair a, b that satisfies the minimization criterion.

Shortest code wins.

Test cases

```<code>1        ->  1    1
2        ->  2    1
4        ->  2    2
12       ->  4    3
42       ->  7    6
576      ->  32   18
1234     ->  2    617
10000    ->  125  80
199999   ->  1    199999
9699690  ->  3990 2431
</code>```

答:
Matlab, 96 81 bytes

Golfed (-15bytes), props to Luis Mendo

```<code>function w(n);a=find(~(mod(n,1:n)));[~,c]=min(abs(a./(n./a)-1.618));[a(c) n/a(c)]
</code>```

Original:

```<code>function w(n)
a=find(not(mod(n,1:n)));b=abs(a./(n./a)-1.618);c=find(not(b-min(b)));[a(c) n/a(c)]
</code>```

This is by far not a great solution, but my first attempt at code-golf. What fun!

Title: Goldenness of an integer

Body:
Matlab, 96 81 bytes

Golfed (-15bytes), props to Luis Mendo

function w(n);a=find(~(mod(n,1:n)));[~,c]=min(abs(a./(n./a)-1.618));[a(c) n/a(c)]

Original:

function w(n)
a=find(not(mod(n,1:n)));b=abs(a./(n./a)-1.618);c=find(not(b-min(b)));[a(c) n/a(c)]

This is by far not a great solution, but my first attempt at code-golf. What fun!


问:
Palindrome Hello, World
Your task is to create a program that prints "Greetings, Planet!" exactly to the console. Seems simple enough, right? Well, here's the trick. The code must be a palindrome, meaning it reads from right to left the same as in left to right.
Standard loopholes are NOT allowed.

答:
Hy, 58 bytes

```<code>(print "Greetings, Planet!");;("!tenalP ,sgniteerG" tnirp)
</code>```

I'm not competing.

Title: Palindrome Hello, World

Body:
Hy, 58 bytes

(print "Greetings, Planet!");;("!tenalP ,sgniteerG" tnirp)

I'm not competing.


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

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

The Rules

Each submission must be a full program.

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

The program must not write anything to STDERR.

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

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

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

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

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

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

For inspiration, check the Hello World Collection.

The Catalogue

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

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

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

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Brain-Flak, <s>142</s> <s>140</s> 136 bytes

```<code>((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])([()[]](([]([](((([][]))([]{}{})))[]{}[])[[]])))(([][][]){})
</code>```

Try it online!

In the time since this answer was originally posted (original code below) Jo-King wrote a computer program that was able to find a shorter Hello World.  After careful examination I was able to shave 2 bytes off of the computers program.  Jo-King then improved his program to outgolf me.  But I'm not beaten that easily and I've golfed it back, taking another 2 bytes off the machine.  I won't explain the entire program because I don't understand it and Jo-King has already done that in the linked post but I will explain my golf.  My golf pertains the part that looks like:

```<code>([][]([](()[][]){}))
</code>```

From here I noticed that [][] was repeated twice.  I thought it might be a good idea to cache this value instead:

```<code>(([][])([]((){}){}))
</code>```

However because there is a [] between the push and the pop this is off by one.  We can fix this by moving the () outside of the double to decrease by 1.

```<code>(([][])([]()({}){}))
</code>```

At this point we can increase the [] in between by another one by pushing [][] twice instead of once

```<code>((([][]))([]{}{}))
</code>```

This saves 2 bytes.

A man ain't nothin' but a man,
And before I'll let your [metagolfer] beat me down,
I'll die with the [keyboard] in my hand.

Original code,  148 bytes

Now that DJMcMayhem's answer has depreciated.  I made a replacement (and even removed a few bytes).

```<code>(((((((((((()()()()){}){}){}()))){}{}())[][][][])[][])[[]]())[[][][][][]]())([([]([])[][]{})]()()()([[]](([()()()]([([][][])](((({}()){}))){}{})))))
</code>```

Try it Online!

Explanation

This explanation was create by Poke

```<code>(
 (
  (
   (
    (
     (
      (
       (
        (
         (
          (()()()()){} Add 8... to 0
         ){} Double to 16
        ){}() Double and add 1 to 33 which is !
       ) Push the ! to save it for the end
      ) Push an extra 33 to help add to get to the first letter
     ){}{}() Triple the 33 and add 1 for 100 which is d
    )[][][][] Push the d to save it for the end. Add height-2, 4 times for 108 which is l
   )[][] Push the l to save for the end then add height-3, 2 times = 114 which is r
  )[[]]() Push the r to save for the end then subtract height-4 and add 1 = 111 which is o
 )[[][][][][]]() Push the o to save for the end then subtract height-5 5 times and add 1 = 87 which is W
) Push W to save for the end
At this point the stack contains "!dlroW". 87 Floating
( We're now a level lower so we start at 0 for the math here.
 [([]([])[][]{})]()()() Push 6+6+7+7+6=32 which is the space, then negate it + 3 = -29 Floating
 (
  [[]] negate height-7 = -7 Floating
  (
   (
    [()()()] -3 Floating
    (
     [([][][])] Push 3*height-7 = 21 and negate it = -21 Floating
     (
      (
       (
        ({}()){} 21+1+22 = 44 which is the comma
       ) Push the , to save for the end
      ) Push another 44
     ){}{} 44+44+44 = 132
    ) Push 132 plus the -21 we left floating earlier = 111 which is o
   ) Push 111 plus the -3 we left floating earlier = 108 which is l
  ) Push another l
 ) Push 111 plus the -7 we left floating earlier = 101 which is e
) Push 101 plus the -29 we left floating earlier = 72 which is H
At this point the stack contains "!dlroW ,olleH" and our accumulator is at 159 which doesn't get used.
</code>```

Title: "Hello, World!"

Body:
Brain-Flak, <s>142</s> <s>140</s> 136 bytes

((((((((((((()()){}){}){}){}()))){}{}())([][]){})[][])[[]]())[((()[]){}){}])([()[]](([]([](((([][]))([]{}{})))[]{}[])[[]])))(([][][]){})

Try it online!

In the time since this answer was originally posted (original code below) Jo-King wrote a computer program that was able to find a shorter Hello World.  After careful examination I was able to shave 2 bytes off of the computers program.  Jo-King then improved his program to outgolf me.  But I'm not beaten that easily and I've golfed it back, taking another 2 bytes off the machine.  I won't explain the entire program because I don't understand it and Jo-King has already done that in the linked post but I will explain my golf.  My golf pertains the part that looks like:

([][]([](()[][]){}))

From here I noticed that [][] was repeated twice.  I thought it might be a good idea to cache this value instead:

(([][])([]((){}){}))

However because there is a [] between the push and the pop this is off by one.  We can fix this by moving the () outside of the double to decrease by 1.

(([][])([]()({}){}))

At this point we can increase the [] in between by another one by pushing [][] twice instead of once

((([][]))([]{}{}))

This saves 2 bytes.

A man ain't nothin' but a man,
And before I'll let your [metagolfer] beat me down,
I'll die with the [keyboard] in my hand.

Original code,  148 bytes

Now that DJMcMayhem's answer has depreciated.  I made a replacement (and even removed a few bytes).

(((((((((((()()()()){}){}){}()))){}{}())[][][][])[][])[[]]())[[][][][][]]())([([]([])[][]{})]()()()([[]](([()()()]([([][][])](((({}()){}))){}{})))))

Try it Online!

Explanation

This explanation was create by Poke

(
 (
  (
   (
    (
     (
      (
       (
        (
         (
          (()()()()){} Add 8... to 0
         ){} Double to 16
        ){}() Double and add 1 to 33 which is !
       ) Push the ! to save it for the end
      ) Push an extra 33 to help add to get to the first letter
     ){}{}() Triple the 33 and add 1 for 100 which is d
    )[][][][] Push the d to save it for the end. Add height-2, 4 times for 108 which is l
   )[][] Push the l to save for the end then add height-3, 2 times = 114 which is r
  )[[]]() Push the r to save for the end then subtract height-4 and add 1 = 111 which is o
 )[[][][][][]]() Push the o to save for the end then subtract height-5 5 times and add 1 = 87 which is W
) Push W to save for the end
At this point the stack contains "!dlroW". 87 Floating
( We're now a level lower so we start at 0 for the math here.
 [([]([])[][]{})]()()() Push 6+6+7+7+6=32 which is the space, then negate it + 3 = -29 Floating
 (
  [[]] negate height-7 = -7 Floating
  (
   (
    [()()()] -3 Floating
    (
     [([][][])] Push 3*height-7 = 21 and negate it = -21 Floating
     (
      (
       (
        ({}()){} 21+1+22 = 44 which is the comma
       ) Push the , to save for the end
      ) Push another 44
     ){}{} 44+44+44 = 132
    ) Push 132 plus the -21 we left floating earlier = 111 which is o
   ) Push 111 plus the -3 we left floating earlier = 108 which is l
  ) Push another l
 ) Push 111 plus the -7 we left floating earlier = 101 which is e
) Push 101 plus the -29 we left floating earlier = 72 which is H
At this point the stack contains "!dlroW ,olleH" and our accumulator is at 159 which doesn't get used.


问:
Fibonacci function or sequence
The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it.  The first two numbers in the sequence are both 1. Here are the first few terms:

```<code>1 1 2 3 5 8 13 21 34 55 89 ...
</code>```

Write the shortest code that either:

Generates the Fibonacci sequence without end.

Given n calculates the nth term of the sequence. (Either 1 or zero indexed)

You may use standard forms of input and output.

(I gave both options in case one is easier to do in your chosen language than the other.)

For the function that takes an n, a reasonably large return value (the largest Fibonacci number that fits your computer's normal word size, at a minimum) has to be supported.

Leaderboard

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

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

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

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Ruby

Ungolfed, 60 bytes

```<code>def fib(prev,nxt)
  x = prev + nxt
  puts x
  fib(nxt,x)
end
</code>```

Golfed, 33 bytes

```<code>def f(a,b)x=a+b;puts x;f(b,x)end
</code>```

Pretty simple to call, use f(first, next).

Title: Fibonacci function or sequence

Body:
Ruby

Ungolfed, 60 bytes

def fib(prev,nxt)
  x = prev + nxt
  puts x
  fib(nxt,x)
end

Golfed, 33 bytes

def f(a,b)x=a+b;puts x;f(b,x)end

Pretty simple to call, use f(first, next).


答:
Pyth, <s>21</s> <s>20</s> 18 bytes

```<code>hoacFN.n3C_Bf!%QTS
</code>```

Try it online. Test suite.

Explanation

Get the incluSive range from 1 to input.

filter for numbers for that divide the input !%QT.

Get [that list, that list reversed] _B. The reversed divisors of a number is the same list as the number divided by each of the divisors.

Transpose the list to get pairs of [numerator, denominator].

Sort the pairs by the absolute difference of the ratio of the pair cFN and the golden ratio .n3.

Get the first (lowest) pair h and print.

Title: Goldenness of an integer

Body:
A positive integer n can be represented as a rectangle with integer sides a, b such that n = a * b. That is, the area represents the number. In general, a and b are not unique for a given n.

As is well known, a rectangle is specially pleasing to the eye (or is it the brain?) when its sides are in the golden ratio, φ = (sqrt(5)+1)/2 ≈ 1.6180339887...

Combining these two facts, the purpose of this challenge is to decompose an integer n into the product of two integers a, b whose ratio is as close as possible to φ (with the usual metric on ℝ). The fact that φ is irrational implies that there is a unique solution pair (a, b).

The challenge

Given a positive integer n, output positive integers a, b such that  a * b = n and the absolute difference between a/b and φ is minimized.

As an example, consider n = 12. The pairs (a, b) that satisfy a * b = n are: (1, 12), (2,6), (3,4), (4,3), (6,2), (12,1). The pair whose ratio is closest to φ is (4,3), which gives 4/3 = 1.333.

Rules

Functions or programs are acceptable.

The numerator (a) should appear first in the output, and the denominator (b) second. Other than that, input and output formats are flexible as usual. For example, the two numbers can be output as strings with any reasonable separator, or as an array.

The code should work in theory for arbitrarily large numbers. In practice, it may be limited by memory or data-type restrictions.

It's sufficient to consider an approximate version of φ, as long as it is accurate up to the third decimal or better. That is, the absolute difference between the true φ and the approximate value should not exceed 0.0005. For example, 1.618 is acceptable.

When using an approximate, rational version of φ there's a small chance that the solution is not unique. In that case you can output any pair a, b that satisfies the minimization criterion.

Shortest code wins.

Test cases

```<code>1        ->  1    1
2        ->  2    1
4        ->  2    2
12       ->  4    3
42       ->  7    6
576      ->  32   18
1234     ->  2    617
10000    ->  125  80
199999   ->  1    199999
9699690  ->  3990 2431
</code>```

Body:
Pyth, <s>21</s> <s>20</s> 18 bytes

hoacFN.n3C_Bf!%QTS

Try it online. Test suite.

Explanation

Get the incluSive range from 1 to input.

filter for numbers for that divide the input !%QT.

Get [that list, that list reversed] _B. The reversed divisors of a number is the same list as the number divided by each of the divisors.

Transpose the list to get pairs of [numerator, denominator].

Sort the pairs by the absolute difference of the ratio of the pair cFN and the golden ratio .n3.

Get the first (lowest) pair h and print.


问:
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.

答:
SX, 21 bytes

```<code>和(0,10):我('*'*10)
</code>```

Actually: this compiles (technically, it just becomes Python) directly to Python. It is the same as:

for i in range(0,10):print('*'*10)

Title: Print a 10 by 10 grid of asterisks

Body:
SX, 21 bytes

和(0,10):我('*'*10)

Actually: this compiles (technically, it just becomes Python) directly to Python. It is the same as:

for i in range(0,10):print('*'*10)


答:
Jelly, <s>16</s> <s>15</s> 14 bytes

Saved 1 byte thanks to @miles.

```<code>÷/ạØp
ÆDżṚ$ÇÞḢ
</code>```

Try it online!

Explanation

```<code>÷/ạØp         Helper link, calculates abs(a/b - phi). Argument: [a, b]
÷/            Reduce by division to calculate a/b.
  ạØp         Calculate abs(a/b - phi).

ÆDżṚ$ÇÞḢ      Main link. Argument: n
ÆD            Get divisors of n.
  żṚ$         Pair the items of the list with those of its reverse. The reversed
              divisors of a number is the same list as the number divided by each
              of the divisors.
     ÇÞ       Sort by the output of the helper link of each pair.
       Ḣ      Get the first element [a, b] and implicitly print.
</code>```

Title: Goldenness of an integer

Body:
Jelly, <s>16</s> <s>15</s> 14 bytes

Saved 1 byte thanks to @miles.

÷/ạØp
ÆDżṚ$ÇÞḢ

Try it online!

Explanation

÷/ạØp         Helper link, calculates abs(a/b - phi). Argument: [a, b]
÷/            Reduce by division to calculate a/b.
  ạØp         Calculate abs(a/b - phi).

ÆDżṚ$ÇÞḢ      Main link. Argument: n
ÆD            Get divisors of n.
  żṚ$         Pair the items of the list with those of its reverse. The reversed
              divisors of a number is the same list as the number divided by each
              of the divisors.
     ÇÞ       Sort by the output of the helper link of each pair.
       Ḣ      Get the first element [a, b] and implicitly print.


问:
Implementing bool() without any conditionals
Title says it all. Given some input, turn it into a boolean value (0 or 1), without using conditional statements (e.x. == > < <= >= != ~=), or any function which uses conditional statements within its implementation, such as if, while and for. Your program must work with floating points, although you get more if it works with other items.

A general rule for determining whether bool(item) is False is if the item is empty ('' is an empty string, [] is an empty list.), or if the function used to turn an item of one type into another is given no input (in Python, str() returns '', list() returns [].)

Here are (some of) the different valid types. Your program is considered to work with one type if it works with one item in the following lists:

Integers, floating points, doubles, longs

Strings

Lists, tuples, arrays (bytearrays)

Dictionaries

Functions

Objects/Classes

Program score will be calculated like this: [# of characters]-(50*[# of types]). The program with the smallest score wins the challenge.

答:
Perl, 5 char

```<code>1-!$x
</code>```

Works for integers, floating-point values, strings, and C. Although in Perl, these are all the same type.

Body:
Perl, 5 char

1-!$x

Works for integers, floating-point values, strings, and C. Although in Perl, these are all the same type.