答:
CJam, 20 bytes

Thanks to Peter Taylor for letting me base this code on his solution and saving 3 bytes.

```<code>{ee::f{S*\+S/}:~:.+}
</code>```

An unnamed block which expects the input on top of the stack and replaces it with the output.

Test it here.

Explanation

```<code>ee    e# Enumerate the input. E.g. if the input is
      e#   [[3 5 6 2] [0 0 0] [1 0 3 4]]
      e# this gives:
      e#   [[0 [3 5 6 2]] [1 [0 0 0]] [2 [1 0 3 4]]]
::f{  e# The exact details of how this works are a bit tricky, but in effect
      e# this calls the subsequent block once for every spreadsheet and
      e# its correspond index, so the first time we'll have 0 and 3 on the
      e# stack, the next time 0 5, and at the last iteration 2 and 4.
      e# Note that this is a map operation, so we'll end up with an array
      e# on the stack.
  S*  e#   So the stack holds [... index date] now. We start by creating
      e#   a string of 'date' spaces, so "   " on the first iteration.
  \+  e#   We swap this with the index and append the index.
  S/  e#   Now we split this thing on spaces, which gives us 'date' empty
      e#   lists and a list containing the index, e.g. [[] [] [] [0]].
}
:~    e# This flattens the first level of the result, so that we get a list
      e# of all those lists we just created. This is simply one list for
      e# every spreadsheet with its type in the last element.
:.+   e# Finally we fold pairwise concatenation over this list. All the
      e# empty lists won't affect the result so we'll just end up with all
      e# the types in lists for the correct date.
</code>```

Title: Inverting lists of lists of indices

Body:
Inspired by this StackOverflow post.

Introduction

Bob's job is to create spreadsheets and organize them.  The way he organizes them is known to very few except for Bob, but he creates a list of each of the spreadsheets that fall under the same group.  There's a bunch of data in the spreadsheet he creates, but there's only one piece of data that we're looking at right now: The number of days between the day he started this job and the day he made the spreadsheet.  The first day he created two spreadsheets, noted them both as 0 and sorted them in to their proper locations.

Now, his boss is asking for a review of what kinds of spreadsheet happened each day, and it's your job to write some code that will figure that out for Bob; he has far too many spreadsheets to do it by hand.

Input

Bob's info that he gives you comes in the form of a (0-or-1 indexed) jagged array where each datum is of the form x = a[i][j].  a is what I'm calling the jagged array itself, i is the type of spreadsheet, and x is the date the array was created.  j is unimportant.

The task

Given a jagged array of spreadsheet creation days organized by their type, return a jagged array of spreadsheet types organized by spreadsheet creation day.

Examples

Bob isn't going to just leave you with this abstract data. He's given me a subset of some of his spreadsheets to help you out with figuring out what everything is supposed to be.

Example input (0-indexed):

```<code>a = [
[3,2,5,0], # Bob doesn't necessarily sort his lists
[1,3],
[2,1,0,4],
[4,5,3],
[6,6]
]
</code>```

Example output (with commentary, which of course is not required):

```<code>output = [
[0,2] # On day 0, Bob made one type 0 and one type 2 spreadsheet
[1,2] # On day 1, Bob made one type 1 and one type 2 spreadsheet
[0,2] # On day 2, Bob made one type 0 and one type 2 spreadsheet
[0,1,3] # On day 3, Bob made one type 0, one type 1, and one type 3 spreadsheet
[2,3] # On day 4, Bob made one type 2 and one type 3 spreadsheet
[0,3] # On day 5, Bob made one type 0 and one type 3 spreadsheet
[4,4] # On day 6, Bob made two type 4 spreadsheets
]
</code>```

Note that Bob doesn't always make two spreadsheets every day, and so the output may be jagged as well. But he always makes at least one spreadsheet every day, so the output will never need to contain empty arrays - although if your output has empty arrays at the end, you don't need to remove them.

More test cases:

```<code>[[3,5,6,2],[0,0,0],[1,0,3,4]] -> [[1,1,1,2],[2],[0],[0,2],[2],[0],[0]]
[[-1]] -> Undefined behavior, as all input numbers will be non-negative integers.
[[0],[0],[],[0]] -> [[0,1,3]]
</code>```

The output's inner lists do not need to be sorted.

As always, no standard loopholes, and of course shortest code wins.

(As this is my first question, please let me know of anything I can do to improve it.)

Body:
CJam, 20 bytes

Thanks to Peter Taylor for letting me base this code on his solution and saving 3 bytes.

{ee::f{S*\+S/}:~:.+}

An unnamed block which expects the input on top of the stack and replaces it with the output.

Test it here.

Explanation

ee    e# Enumerate the input. E.g. if the input is
      e#   [[3 5 6 2] [0 0 0] [1 0 3 4]]
      e# this gives:
      e#   [[0 [3 5 6 2]] [1 [0 0 0]] [2 [1 0 3 4]]]
::f{  e# The exact details of how this works are a bit tricky, but in effect
      e# this calls the subsequent block once for every spreadsheet and
      e# its correspond index, so the first time we'll have 0 and 3 on the
      e# stack, the next time 0 5, and at the last iteration 2 and 4.
      e# Note that this is a map operation, so we'll end up with an array
      e# on the stack.
  S*  e#   So the stack holds [... index date] now. We start by creating
      e#   a string of 'date' spaces, so "   " on the first iteration.
  \+  e#   We swap this with the index and append the index.
  S/  e#   Now we split this thing on spaces, which gives us 'date' empty
      e#   lists and a list containing the index, e.g. [[] [] [] [0]].
}
:~    e# This flattens the first level of the result, so that we get a list
      e# of all those lists we just created. This is simply one list for
      e# every spreadsheet with its type in the last element.
:.+   e# Finally we fold pairwise concatenation over this list. All the
      e# empty lists won't affect the result so we'll just end up with all
      e# the types in lists for the correct date.


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

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

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

etc.

The output should include newlines after each letter.

Lowercase letters and/or extra whitespace are acceptable.

The solution must be a complete program.

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

答:
C#, 86 bytes

```<code>class P{static void M(){for(var i=65d;i<91;i+=.25)System.Console.WriteLine((char)i);}}
</code>```

a full program...

ContentLicense: CC BY-SA 4.0

Body:
C#, 86 bytes

class P{static void M(){for(var i=65d;i<91;i+=.25)System.Console.WriteLine((char)i);}}

a full program...

ContentLicense: CC BY-SA 3.0


答:
LINQ, 59 bytes

```<code>from i in Enumerable.Range(0, 104)select(char)(65+i/4)+"\n"
</code>```

LINQ expression, try it with LinqPad. The select part is a bit too C#ist but I guess that fine.

```<code>from i                        // for each variable
in Enumerable.Range(0, 104)   // in the range 0, 26*4
select(char)(65+i/4)+"\n"     // get the letter and a newline
</code>```

Title: Generate alphabet with 4 copies of each letter

Body:
Note that this is not the same as Print the alphabet four times.

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

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

etc.

The output should include newlines after each letter.

Lowercase letters and/or extra whitespace are acceptable.

The solution must be a complete program.

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

Body:
LINQ, 59 bytes

from i in Enumerable.Range(0, 104)select(char)(65+i/4)+"\n"

LINQ expression, try it with LinqPad. The select part is a bit too C#ist but I guess that fine.

from i                        // for each variable
in Enumerable.Range(0, 104)   // in the range 0, 26*4
select(char)(65+i/4)+"\n"     // get the letter and a newline


问:
Which ghosts are missing?
In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can

Input

Input will consist of a string or list, which will include a number ghosts, which could include:

Blinky

Inky

Pinky

Clyde

However, input may also include Pac-Man (with that punctuation). So, the maximum amount of items in a list will be five, in any order. It can be assumed that no invalid items will be in the list

Output

Output will consist of a string, or list. This will include of all the ghosts that are not in the input, in any order. However, if Pac-Man is in the input, all ghosts will be considered missing (because he eats them).

Test cases

```<code>input: Clyde
output: Blinky, Inky, Pinky
alternate output: Inky, Pinky, Blinky
or one of the other 4 permutations

input: Clyde, Blinky # or however you delimit it
output: Inky, Pinky
alt: Pinky, Inky

input: Pac-Man, Clyde
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations

input:[null]
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations
</code>```

This is codegolf, so the lower the bytecount, the better.

答:
Python 2, 151 bytes

As there are already Python answers using sets and strings I decided to restrict myself to work with lists, which turned out to be pretty long and uncompetitive. However, as the approach taken is different as the common one used, here it is:

```<code>o=['Blinky','Clyde','Inky','Pinky']
p=lambda x:[l for l in reduce(lambda z,x:z+[y+[x]for y in z],o,[[]])if sorted(l+x)==o][0]if'Pac-Man'not in x else o
</code>```

where the expected input is a list of strings.

The approach is to bruteforce all possible combinations (without taking order into account) of 0,1,2,3 and 4 elements. This is done by

```<code>reduce(lambda z,x:z+[y+[x]for y in z],o,[[]])
</code>```

which returns

```<code>[[], ['Clyde'], ['Pinky'], ['Clyde', 'Pinky'], ['Inky'], ['Clyde', 'Inky'],
['Pinky', 'Inky'], ['Clyde', 'Pinky', 'Inky'], ['Blinky'], ['Clyde', 'Blinky'],
['Pinky', 'Blinky'], ['Clyde', 'Pinky', 'Blinky'], ['Inky', 'Blinky'],
['Clyde', 'Inky', 'Blinky'], ['Pinky', 'Inky', 'Blinky'],
['Clyde', 'Pinky', 'Inky', 'Blinky']]
</code>```

and find the one which, in addition to the input list results in the complete list of ghosts.

Then it is checked if the string 'Pac-Man' is part of the input and, in case it is, the whole list of ghosts is returned. If not, only the ones which are not part of the input are returned.

Notice that the list containing all ghost names (o) is sorted alphabetically and the same goes for the list built as (sorted(l+x)). This is due to the fact that in Python, ['a','b']==['b','a'] is evaluated as False whereas ['a','b']==['a','b'] is evaluated as True.

3 bytes can be saved if it is permitted to return the answer as a list of lists ( by removing the [0] at the end of the first list comprehension). But as I'm not sure it is a valid output I am counting them.

Title: Which ghosts are missing?

Body:
Python 2, 151 bytes

As there are already Python answers using sets and strings I decided to restrict myself to work with lists, which turned out to be pretty long and uncompetitive. However, as the approach taken is different as the common one used, here it is:

o=['Blinky','Clyde','Inky','Pinky']
p=lambda x:[l for l in reduce(lambda z,x:z+[y+[x]for y in z],o,[[]])if sorted(l+x)==o][0]if'Pac-Man'not in x else o

where the expected input is a list of strings.

The approach is to bruteforce all possible combinations (without taking order into account) of 0,1,2,3 and 4 elements. This is done by

reduce(lambda z,x:z+[y+[x]for y in z],o,[[]])

which returns

[[], ['Clyde'], ['Pinky'], ['Clyde', 'Pinky'], ['Inky'], ['Clyde', 'Inky'],
['Pinky', 'Inky'], ['Clyde', 'Pinky', 'Inky'], ['Blinky'], ['Clyde', 'Blinky'],
['Pinky', 'Blinky'], ['Clyde', 'Pinky', 'Blinky'], ['Inky', 'Blinky'],
['Clyde', 'Inky', 'Blinky'], ['Pinky', 'Inky', 'Blinky'],
['Clyde', 'Pinky', 'Inky', 'Blinky']]

and find the one which, in addition to the input list results in the complete list of ghosts.

Then it is checked if the string 'Pac-Man' is part of the input and, in case it is, the whole list of ghosts is returned. If not, only the ones which are not part of the input are returned.

Notice that the list containing all ghost names (o) is sorted alphabetically and the same goes for the list built as (sorted(l+x)). This is due to the fact that in Python, ['a','b']==['b','a'] is evaluated as False whereas ['a','b']==['a','b'] is evaluated as True.

3 bytes can be saved if it is permitted to return the answer as a list of lists ( by removing the [0] at the end of the first list comprehension). But as I'm not sure it is a valid output I am counting them.


答:
Batch, 141 bytes

```<code>@set g= Blinky Inky Pinky Clyde
@for %%a in (%*)do @if %%a==Pac-Man goto l
@for %%a in (%*)do call set g=%%g: %%a=%%
@l
@echo(%g:~1,-1%
</code>```

(Subtract 6 bytes for :~1,-1 if leading and trailing whitespace is acceptable.) Requires Pac-Man in title case but the ghosts are case insensitive.

Title: Which ghosts are missing?

Body:
In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can

Input

Input will consist of a string or list, which will include a number ghosts, which could include:

Blinky

Inky

Pinky

Clyde

However, input may also include Pac-Man (with that punctuation). So, the maximum amount of items in a list will be five, in any order. It can be assumed that no invalid items will be in the list

Output

Output will consist of a string, or list. This will include of all the ghosts that are not in the input, in any order. However, if Pac-Man is in the input, all ghosts will be considered missing (because he eats them).

Test cases

```<code>input: Clyde
output: Blinky, Inky, Pinky
alternate output: Inky, Pinky, Blinky
or one of the other 4 permutations

input: Clyde, Blinky # or however you delimit it
output: Inky, Pinky
alt: Pinky, Inky

input: Pac-Man, Clyde
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations

input:[null]
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations
</code>```

This is codegolf, so the lower the bytecount, the better.

Body:
Batch, 141 bytes

@set g= Blinky Inky Pinky Clyde
@for %%a in (%*)do @if %%a==Pac-Man goto l
@for %%a in (%*)do call set g=%%g: %%a=%%
@l
@echo(%g:~1,-1%

(Subtract 6 bytes for :~1,-1 if leading and trailing whitespace is acceptable.) Requires Pac-Man in title case but the ghosts are case insensitive.


问:
Sort a list of unknown values with the least amount of comparisons
In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin.

The below protocol is line-based, so everytime you print to stdout or read from stdin it is assumed a newline follows. Throughout the question below it is assumed that the user (read: the scoring program) has an array it wants sorted in a 0-based indexed array called array. For technical reasons I suggest flushing after every print to stout.

As your first step your program must read the array size n from stdin.

Then, as often as you wish, you can print a < b to stdout, with two integers 0 <= a, b < n. Then the user will enter 1 in stdin if array[a] < array[b], and 0 otherwise.

Finally, once your program is convinced it has correctly deduced the order of the array, it must print a ... to stdout, where ... is a space separated list of integers indicating the order. So if your program outputs a 3 0 1 4 2 it means your program has deduced

```<code>array[3] <= array[0] <= array[1] <= array[4] <= array[2]
</code>```

Note that your program never knew the contents of array, and never will.

You can only ask for < on stdin to sort the array. You can get other comparison operations by these equivalencies:

```<code>a > b        b < a
a <= b       !(b < a)
a >= b       !(a < b)
a != b       (a < b) || (b < a)
a == b       !(a < b) && !(b < a)
</code>```

Finally, since your program interacts with the scoring program on stdout, print debug information to stderr.

Your program will be scored using the following Python program:

from __future__ import print_function
from subprocess import Popen, PIPE
import sys, random

def sort_test(size):
    array = [random.randrange(0, size) for _ in range(size)]
    pipe = Popen(sys.argv[1:], stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True)
    print(str(size), file=pipe.stdin); pipe.stdin.flush()
    num_comparisons = 0
    while True:
        args = pipe.stdout.readline().strip().split()
        if args and args[0] == "a":
            answer_array = [array[int(n)] for n in args[1:]]
            if list(sorted(array)) != answer_array:
                raise RuntimeError("incorrect sort for size {}, array was {}".format(size, array))
            return num_comparisons
        elif len(args) == 3 and args[1] == "<":
            a, b = int(args[0]), int(args[2])
            print(int(array[a] < array[b]), file=pipe.stdin); pipe.stdin.flush()
            num_comparisons += 1
        else:
            raise RuntimeError("unknown command")

random.seed(0)
total = 0
for i in range(101):
    num_comparisons = sort_test(i)
    print(i, num_comparisons)
    total += num_comparisons
print("total", total)
```

You score your program by typing python score.py yourprogram. The scoring is done by having your program sort one random array of each size 0 to 100 and counting the amount of comparisons your program asks for. These random arrays can have duplicates, your algorithm must be able to handle equal elements. In the event there are duplicates, there are no requirements on the order of the equal elements. So if the array is [0, 0] it doesn't matter if you output a 0 1 or a 1 0.

You may not optimize specifically for the particular arrays the scoring program generates. I may change the RNG seed at any point in time. Answers using built-in sorting algorithms are permitted to be posted for interest's sake, but are non-competing.

Program with lowest score wins.

答:
Python, 333300 score

from __future__ import print_function
import sys

size = int(input())

def less(a, b):
    print(a, "<", b); sys.stdout.flush()
    return bool(int(input()))

array = list(range(size))
for _ in range(size):
    for i in range(0, size-1):
        if less(array[i+1], array[i]):
            array[i], array[i+1] = array[i+1], array[i]

print("a", " ".join(str(i) for i in array)); sys.stdout.flush()
```

This is an example program, implementing the simplest form of bubblesort, always doing n*(n-1) comparisons per array.

I scored this program by saving it as sort.py and typing python score.py python sort.py.

Body:
Python, 333300 score

from __future__ import print_function
import sys

size = int(input())

def less(a, b):
    print(a, "<", b); sys.stdout.flush()
    return bool(int(input()))

array = list(range(size))
for _ in range(size):
    for i in range(0, size-1):
        if less(array[i+1], array[i]):
            array[i], array[i+1] = array[i+1], array[i]

print("a", " ".join(str(i) for i in array)); sys.stdout.flush()

This is an example program, implementing the simplest form of bubblesort, always doing n*(n-1) comparisons per array.

I scored this program by saving it as sort.py and typing python score.py python sort.py.


问:
Draw a ladder and slide
Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs.

Ladder and slide specifications

The ladder is always oriented on the left and the slide on the right. We're viewing it from the ladder side, so part of the slide is obscured at the top three levels. The rungs are represented by four dashes (----) and the sides of the ladder and slide by slashes (/ and \). The following is a diagram to represent the patterns of spaces needed for a slide with five rungs.

```<code>Slide              Blank space count
    /----/\        1234/----/\
   /----/  \       123/----/12\
  /----/    \      12/----/1234\
 /----/ \    \     1/----/1\1234\
/----/   \    \    /----/123\1234\
</code>```

Examples

```<code>>>1
/----/\

>>3
  /----/\
 /----/  \
/----/    \

>>4
   /----/\
  /----/  \
 /----/    \
/----/ \    \

>>10
         /----/\
        /----/  \
       /----/    \
      /----/ \    \
     /----/   \    \
    /----/     \    \
   /----/       \    \
  /----/         \    \
 /----/           \    \
/----/             \    \
</code>```

This is code-golf, so the answer with the lowest byte count wins.

Note: trailing white space is acceptable in the output, as long as it doesn't exceed the length of the line.

答:
Retina, <s>81</s> <s>72</s> 52 bytes

Byte count assumes ISO 8859-1 encoding.

```<code>.+
$* /\    \
^.

+` /(.+)$
$&¶$%`/  $1
/.{5}
/----/
</code>```

Try it online!

Explanation

The program consists of four stages, all of which are regex substitutions (with a couple of Retina-specific features). I'll use input 5 as an example for the explanation.

Stage 1

```<code>.+
$* /\    \
</code>```

This turns the input n into n spaces followed by /\    \ which will become the top of the ladder/slide:

```<code>     /\    \
</code>```

For now, we'll just show the slide in full and represent the ladder only by its left-hand /.

Stage 2

```<code>^.

</code>```

Unfortunately, n spaces are one more than we need, so we remove the first character again. We've now got:

```<code>    /\    \
</code>```

Stage 3

```<code>+` /(.+)$
$&¶$%`/  $1
</code>```

Time to expand the complete structure. Knowing where the top is, is sufficient to build the entire thing, because we can simply extend it one line at a time, moving the ladder and the slide apart by two spaces.

The + tells Retina to repeat this stage in a loop until the output stops changing (in this case, because the regex stops matching). As for the regex itself, we simply match the / on the last line and everything after it and we also match one space in front of it, which means this can no longer match once / has reached the first column.

Here's what we replace this with:

```<code> $&    The match itself. We don't want to remove the line we already have.
 ¶     A linefeed, because we want to append a new line.
 $%`   This is a very recent addition to Retina: it's like the normal $` but
      is bounded by linefeeds. That means this inserts everything in front
      of the match which is on the same line. In particular this one space
      less than the indentation of the matched line, hence we are shifting
      the / one column left.
 /     A literal /, representing the left edge of the ladder.
>  <   Two spaces, so that we can shift the slide one column right.
 $1    Capturing group 1 which contains the slide and its separation from
      the ladder.
</code>```

So at each iteration, this adds one line to the string, until we end up with this:

```<code>    /\    \
   /  \    \
  /    \    \
 /      \    \
/        \    \
</code>```

Stage 4

```<code>/.{5}
/----/
</code>```

All that's left is getting the ladder right. That's really simple, we just match the / and the next 5 characters and insert the correct ladder representation, thereby overriding the slide or spaces that are already there:

```<code>    /----/\
   /----/  \
  /----/    \
 /----/ \    \
/----/   \    \
</code>```

Title: Draw a ladder and slide

Body:
Retina, <s>81</s> <s>72</s> 52 bytes

Byte count assumes ISO 8859-1 encoding.

.+
$* /\    \
^.

+` /(.+)$
$&¶$%`/  $1
/.{5}
/----/

Try it online!

Explanation

The program consists of four stages, all of which are regex substitutions (with a couple of Retina-specific features). I'll use input 5 as an example for the explanation.

Stage 1

.+
$* /\    \

This turns the input n into n spaces followed by /\    \ which will become the top of the ladder/slide:

     /\    \

For now, we'll just show the slide in full and represent the ladder only by its left-hand /.

Stage 2

^.

Unfortunately, n spaces are one more than we need, so we remove the first character again. We've now got:

    /\    \

Stage 3

+` /(.+)$
$&¶$%`/  $1

Time to expand the complete structure. Knowing where the top is, is sufficient to build the entire thing, because we can simply extend it one line at a time, moving the ladder and the slide apart by two spaces.

The + tells Retina to repeat this stage in a loop until the output stops changing (in this case, because the regex stops matching). As for the regex itself, we simply match the / on the last line and everything after it and we also match one space in front of it, which means this can no longer match once / has reached the first column.

Here's what we replace this with:

 $&    The match itself. We don't want to remove the line we already have.
 ¶     A linefeed, because we want to append a new line.
 $%`   This is a very recent addition to Retina: it's like the normal $` but
      is bounded by linefeeds. That means this inserts everything in front
      of the match which is on the same line. In particular this one space
      less than the indentation of the matched line, hence we are shifting
      the / one column left.
 /     A literal /, representing the left edge of the ladder.
>  <   Two spaces, so that we can shift the slide one column right.
 $1    Capturing group 1 which contains the slide and its separation from
      the ladder.

So at each iteration, this adds one line to the string, until we end up with this:

    /\    \
   /  \    \
  /    \    \
 /      \    \
/        \    \

Stage 4

/.{5}
/----/

All that's left is getting the ladder right. That's really simple, we just match the / and the next 5 characters and insert the correct ladder representation, thereby overriding the slide or spaces that are already there:

    /----/\
   /----/  \
  /----/    \
 /----/ \    \
/----/   \    \


答:
2sable, <s>40</s> <s>36</s> <s>32</s> 30 bytes

Hmmm, V is coming awfully close...

```<code>F¹N-<ð×…/--Â«ðð«N×…\  Â««5F¦}¶
</code>```

Uses the CP-1252 encoding. Try a 05AB1E compatible version!.

Title: Draw a ladder and slide

Body:
Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs.

Ladder and slide specifications

The ladder is always oriented on the left and the slide on the right. We're viewing it from the ladder side, so part of the slide is obscured at the top three levels. The rungs are represented by four dashes (----) and the sides of the ladder and slide by slashes (/ and \). The following is a diagram to represent the patterns of spaces needed for a slide with five rungs.

```<code>Slide              Blank space count
    /----/\        1234/----/\
   /----/  \       123/----/12\
  /----/    \      12/----/1234\
 /----/ \    \     1/----/1\1234\
/----/   \    \    /----/123\1234\
</code>```

Examples

```<code>>>1
/----/\

>>3
  /----/\
 /----/  \
/----/    \

>>4
   /----/\
  /----/  \
 /----/    \
/----/ \    \

>>10
         /----/\
        /----/  \
       /----/    \
      /----/ \    \
     /----/   \    \
    /----/     \    \
   /----/       \    \
  /----/         \    \
 /----/           \    \
/----/             \    \
</code>```

This is code-golf, so the answer with the lowest byte count wins.

Note: trailing white space is acceptable in the output, as long as it doesn't exceed the length of the line.

Body:
2sable, <s>40</s> <s>36</s> <s>32</s> 30 bytes

Hmmm, V is coming awfully close...

F¹N-<ð×…/--Â«ðð«N×…\  Â««5F¦}¶

Uses the CP-1252 encoding. Try a 05AB1E compatible version!.


问:
What exactly was your question?

Introduction

When you are given a boring text, you just want to get it over with as quick as possible. Let's observe the following text:

```<code>Ens colligi timenda etc priorem judicem. De quascunque ii at contingere
repugnaret explicetur intellectu. Adjuvetis hoc fortassis suspicari opportune
obversari vix eam? Dei praemia prudens hominum iii constet requiri haberem. Ima
sane nemo modi fuit lus pro dem haud. Vestro age negare tactum hoc cui lor. Ne et
ut quod id soli soni deus. At constare innumera is occurret ea. Nia calebat seu
acquiro fraudem effingo dicimus.
</code>```

Note: This text has newlines for readability, while the test cases you need to handle don't have newline characters.

One way to skim text is to find questions that the writer has put into the text. For example, there is 1 question in the text above. Namely:

```<code>Adjuvetis hoc fortassis suspicari opportune obversari vix eam?
</code>```

This can be done by splitting the text into sentences. A sentence will always end with one of the following punctuation symbols: .?! (others don't have to be handled). Other symbols than these are part of the sentence.

The Task

Given a line of text consisting of only

letters (A-Za-z)

numbers (0-9)

spaces

punctuation (,.;:?!) (a sentence cannot start with one of these).

Output the questions that are in the text in any reasonable format. You may assume that the text will always have at least 1 question. Outputting trailing and leading spaces before and after a question is allowed.

Important: Next to a punctuation symbol, there will never be another punctuation symbol (e.g. ?? is invalid and will not be required to handle).

Test cases

In the format:

```<code>Input
Output(s)
</code>```

The test cases:

```<code>Huh? I haven't heard what you just said. Could you repeat that please?
Huh?
Could you repeat that please?

plz can i haz cheesburgr? i am cat pls.
plz can i haz cheesburgr?

This is a badly formatted question.Can u please help me,or my friends,with formatting this question    ?thankyou.
Can u please help me,or my friends,with formatting this question    ?

a.b.c.d?
d?

Does this question have a question mark? yes
Does this question have a question mark?

Why example.com resolves to 127.0.0.1 in 99.9 percent of cases?
9 percent of cases?

A? b? c? d!
A?
b?
c?
</code>```

This is code-golf, so the submission with the lowest number of bytes wins!

答:
PowerShell v4+, 43 bytes

```<code>([regex]::Matches($args,'[^?!.]*\?')).Value
</code>```

Really straightforward. Takes input $args and feeds that in as the first parameter to a .NET [regex]::Matches(...) static function. The regex we're matching is [^?!.]*\? -- that is, any number of non-sentence-ending characters that are followed by a question mark. The static function returns an array of objects detailing what capture group, index, etc., but we only want the .Values, so the return is encapsulated in parens and we call that property. This is where the v4+ requirement comes into play, as in prior versions you'd need to instead do something like a loop |%{$_.Value} or |Select Value to get the appropriate properties.

Example without the parens and .Value

```<code>PS C:\Tools\Scripts\golfing> .\what-exactly-was-your-question.ps1 "Huh? I haven't heard what you just said! Could you repeat that please?"

Groups   : {Huh?}
Success  : True
Captures : {Huh?}
Index    : 0
Length   : 4
Value    : Huh?

Groups   : { Could you repeat that please?}
Success  : True
Captures : { Could you repeat that please?}
Index    : 40
Length   : 30
Value    :  Could you repeat that please?
</code>```

Example with the parens and .Value

```<code>PS C:\Tools\Scripts\golfing> .\what-exactly-was-your-question.ps1 "Huh? I haven't heard what you just said! Could you repeat that please?"
Huh?
 Could you repeat that please?
</code>```

Title: What exactly was your question?

Body:
PowerShell v4+, 43 bytes

([regex]::Matches($args,'[^?!.]*\?')).Value

Really straightforward. Takes input $args and feeds that in as the first parameter to a .NET [regex]::Matches(...) static function. The regex we're matching is [^?!.]*\? -- that is, any number of non-sentence-ending characters that are followed by a question mark. The static function returns an array of objects detailing what capture group, index, etc., but we only want the .Values, so the return is encapsulated in parens and we call that property. This is where the v4+ requirement comes into play, as in prior versions you'd need to instead do something like a loop |%{$_.Value} or |Select Value to get the appropriate properties.

Example without the parens and .Value

PS C:\Tools\Scripts\golfing> .\what-exactly-was-your-question.ps1 "Huh? I haven't heard what you just said! Could you repeat that please?"

Groups   : {Huh?}
Success  : True
Captures : {Huh?}
Index    : 0
Length   : 4
Value    : Huh?

Groups   : { Could you repeat that please?}
Success  : True
Captures : { Could you repeat that please?}
Index    : 40
Length   : 30
Value    :  Could you repeat that please?

Example with the parens and .Value

PS C:\Tools\Scripts\golfing> .\what-exactly-was-your-question.ps1 "Huh? I haven't heard what you just said! Could you repeat that please?"
Huh?
 Could you repeat that please?


答:
Pyth, <s>39</s> 35 bytes

```<code>VQ++*dt-QN"/----/">+*+ddN"\    \\"5
</code>```

Explanation:

```<code>VQ                                  # Interate over 0 -> Q-1 (Q is the input)
  +                                 # Concatenate the 2 halfs of the slide
   +                                # Concatenate the whitespace block and the ladder
    *d                              # Multiply d (whitespace) by this number \/
      t-QN                          # Calculate the amount of spaces before : input - step of the iterarion -1
          "/----/"                  # Ladder
                  >               5 # Remove the first 5 chars  from the string generated in the following lines
                   +                # Concatenate the whitespace block and the slide
                    *+ddN           # Multiply "+dd" (2 whitespace) by the step of the iterarion to generate the space between the ladder and the slide
                         "\    \\"  # Slide
</code>```

Test here

Title: Draw a ladder and slide

Body:
Pyth, <s>39</s> 35 bytes

VQ++*dt-QN"/----/">+*+ddN"\    \\"5

Explanation:

VQ                                  # Interate over 0 -> Q-1 (Q is the input)
  +                                 # Concatenate the 2 halfs of the slide
   +                                # Concatenate the whitespace block and the ladder
    *d                              # Multiply d (whitespace) by this number \/
      t-QN                          # Calculate the amount of spaces before : input - step of the iterarion -1
          "/----/"                  # Ladder
                  >               5 # Remove the first 5 chars  from the string generated in the following lines
                   +                # Concatenate the whitespace block and the slide
                    *+ddN           # Multiply "+dd" (2 whitespace) by the step of the iterarion to generate the space between the ladder and the slide
                         "\    \\"  # Slide

Test here


答:
Pascal (FPC), <s>204</s> 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline.
Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<31)then WriteLn(a[i])end.
```
<p>Try it online!</p>
<p>Ungolfed:</p>

<pre class="lang-pascal prettyprint-override"><code>var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.
</code>```

Old version using a set, <s>227</s> 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.
```
<p>Ungolfed:</p>

<pre class="lang-pascal prettyprint-override"><code>var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.
</code>```

Title: Which ghosts are missing?

Body:
Pascal (FPC), <s>204</s> 200 bytes

Two loops, using a binary to find which ghosts+pacman are present. Takes the arguments from the commandline.
Thanks to @manatwork for saving some more bytes!

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i,s:Byte;begin for i:=1to ParamCount do s:=1<<Pos(ParamStr(i)[4],'nykd-')or s;for i:=1to 4do if(1<<i and s=0)or(s>31)then WriteLn(a[i])end.

Try it online!

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i, s: byte;
begin
  for i:=1 to ParamCount do
    s := 1 << pos(ParamStr(i)[4], 'nykd-') or s; // fill bits by shifting, check for unique 4th char of names, '-' in 'pac-man', could also use the 3rd char
  for i:=1 to 4 do
    if (1 << i and s=0) or (s>31) then    // check if bits are on
      writeln(a[i]);
end.

Old version using a set, <s>227</s> 209 bytes

Two loops, using a set to find which ghosts+pacman are present. Takes the arguments from the commandline.

var a:array[1..4]of string=('Blinky','Inky','Pinky','Clyde');i:byte;s:set of 1..5;begin for i:=1to ParamCount do s:=s+[pos(ParamStr(i)[4],'nykd-')];for i:=1to 4do if not(i in s)or(5in s)then writeln(a[i]);end.

Ungolfed:

var
  a: array[1..4] of string = ('Blinky', 'Inky', 'Pinky', 'Clyde');
  i: byte;
  s: set of 1..5;
begin
  for i:=1 to ParamCount do
    s := s + [pos(ParamStr(i)[4], 'nykd-')]; // fill set with indxs
  for i:=1 to 4 do
    if not(i in s) or (5 in s) then    // check indx not in set or pac-man is
      writeln(a[i]);
end.


答:
C# LINQ <s>115 Bytes</s>110 Bytes

```<code>Enumerable.Range(65, 26).SelectMany(i => Enumerable.Repeat(i,4))
.ToList().ForEach(i=> Console.WriteLine((char)i));
</code>```

Body:
C# LINQ <s>115 Bytes</s>110 Bytes

Enumerable.Range(65, 26).SelectMany(i => Enumerable.Repeat(i,4))
.ToList().ForEach(i=> Console.WriteLine((char)i));


问:
Convert n strings of m length to m strings of n length
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition:

Every new string should contains the letters at the same index of the others strings

For example, the first output string must contain the first letter of all the input strings, the second output string must contain the second letter of all the input strings, and so on.

Examples (the numbers under the letters are the indexes of the strings):

```<code>input: "car", "dog", "man", "yay"
        012    012    012    012
output: "cdmy", "aoaa", "rgny"
         0000    1111    2222

input: "money", "taken", "trust"
        01234    01234    01234
output: "mtt", "oar", "nku", "ees", "ynt"
         000    111    222    333    444
</code>```

Assume that the input is correct everytime

Shortest bytes' code wins!

Edit:

Since there are many programming languages, and there could be many possible solutions for each of them, I will post the shortest solution for each programming language and the user who provided it. Keep coding!

Re-Edit:

Thanks to user Dennis I inserted a snippet for the leaderboards.

var QUESTION_ID=85255,OVERRIDE_USER=56179;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

```

答:
APL, 3 bytes

```<code>↓⍉↑
</code>```

↑ takes the input strings and turns them into a char matrix.
⍉ transposes the matrix.
↓ splits back the rows of the resulting matrix into strings.

Body:
APL, 3 bytes

↓⍉↑

↑ takes the input strings and turns them into a char matrix.
⍉ transposes the matrix.
↓ splits back the rows of the resulting matrix into strings.


问:
Return each number from a group of numbers

The challenge

The program must return all numbers included into a group (comma and hyphen separated sequence) of numbers.

Rules

s is the sequence string;

all numbers included in s are positive;

numbers will always increase;

numbers will never repeat

when you answer, show the output for s="1,3-5,9,16,18-23"

Examples

```<code>input(s)    outputs
-----------------
1           1
1,2         1,2
1-4         1,2,3,4
1-4,6       1,2,3,4,6
1-4,8-11    1,2,3,4,8,9,10,11
</code>```

Good luck. =)

Body:
K, 47

","/:,/${x+!1+y-x}.'2#'a,'a:"I"$'"-"\:'","\:0:0

Test case

k)","/:,/${x+!1+y-x}.'2#'a,'a:"I"$'"-"\:'","\:0:0
1,3-5,9,16,18-23
"1,3,4,5,9,16,18,19,20,21,22,23"


答:
PowerShell v2+, <s>99</s> <s>90</s> 82 bytes

```<code>param($n)1..$n|%{" "*($n-$_)+"/----/"+-join(" "*($_+$i++)+"\    \")[6..(6+$_+$i)]}
</code>```

Takes input $n, starts a loop from 1 to $n with |%{...}. Each iteration, we're constructing a string. We start with the appropriate number of spaces " "*($n-$_) and the ladder "/----/".

To that, we add another string that's been sliced [...] and -joined back together. The second string is the slide, and we assume that the whole slide is always visible. It's the number of spaces before the slide would start " "*($_+$i++), followed by the slide itself "\    \". This is sliced by a range calculated out to be the part of the "spaces plus slide" that's partially hidden by the ladder.

Examples

```<code>PS C:\Tools\Scripts\golfing> .\draw-a-ladder-and-slide.ps1 7
      /----/\
     /----/  \
    /----/    \
   /----/ \    \
  /----/   \    \
 /----/     \    \
/----/       \    \

PS C:\Tools\Scripts\golfing> .\draw-a-ladder-and-slide.ps1 15
              /----/\
             /----/  \
            /----/    \
           /----/ \    \
          /----/   \    \
         /----/     \    \
        /----/       \    \
       /----/         \    \
      /----/           \    \
     /----/             \    \
    /----/               \    \
   /----/                 \    \
  /----/                   \    \
 /----/                     \    \
/----/                       \    \
</code>```

Title: Draw a ladder and slide

Body:
PowerShell v2+, <s>99</s> <s>90</s> 82 bytes

param($n)1..$n|%{" "*($n-$_)+"/----/"+-join(" "*($_+$i++)+"\    \")[6..(6+$_+$i)]}

Takes input $n, starts a loop from 1 to $n with |%{...}. Each iteration, we're constructing a string. We start with the appropriate number of spaces " "*($n-$_) and the ladder "/----/".

To that, we add another string that's been sliced [...] and -joined back together. The second string is the slide, and we assume that the whole slide is always visible. It's the number of spaces before the slide would start " "*($_+$i++), followed by the slide itself "\    \". This is sliced by a range calculated out to be the part of the "spaces plus slide" that's partially hidden by the ladder.

Examples

PS C:\Tools\Scripts\golfing> .\draw-a-ladder-and-slide.ps1 7
      /----/\
     /----/  \
    /----/    \
   /----/ \    \
  /----/   \    \
 /----/     \    \
/----/       \    \

PS C:\Tools\Scripts\golfing> .\draw-a-ladder-and-slide.ps1 15
              /----/\
             /----/  \
            /----/    \
           /----/ \    \
          /----/   \    \
         /----/     \    \
        /----/       \    \
       /----/         \    \
      /----/           \    \
     /----/             \    \
    /----/               \    \
   /----/                 \    \
  /----/                   \    \
 /----/                     \    \
/----/                       \    \


答:
JavaScript, <s>35</s> 24 bytes

```<code>a=>a.match(/[^.?!]*\?/g)
</code>```

Returns all substrings that start after a ., ?, or ! (or the beginning of the text) and end in a ?.

Title: What exactly was your question?

Body:
Introduction

When you are given a boring text, you just want to get it over with as quick as possible. Let's observe the following text:

```<code>Ens colligi timenda etc priorem judicem. De quascunque ii at contingere
repugnaret explicetur intellectu. Adjuvetis hoc fortassis suspicari opportune
obversari vix eam? Dei praemia prudens hominum iii constet requiri haberem. Ima
sane nemo modi fuit lus pro dem haud. Vestro age negare tactum hoc cui lor. Ne et
ut quod id soli soni deus. At constare innumera is occurret ea. Nia calebat seu
acquiro fraudem effingo dicimus.
</code>```

Note: This text has newlines for readability, while the test cases you need to handle don't have newline characters.

One way to skim text is to find questions that the writer has put into the text. For example, there is 1 question in the text above. Namely:

```<code>Adjuvetis hoc fortassis suspicari opportune obversari vix eam?
</code>```

This can be done by splitting the text into sentences. A sentence will always end with one of the following punctuation symbols: .?! (others don't have to be handled). Other symbols than these are part of the sentence.

The Task

Given a line of text consisting of only

letters (A-Za-z)

numbers (0-9)

spaces

punctuation (,.;:?!) (a sentence cannot start with one of these).

Output the questions that are in the text in any reasonable format. You may assume that the text will always have at least 1 question. Outputting trailing and leading spaces before and after a question is allowed.

Important: Next to a punctuation symbol, there will never be another punctuation symbol (e.g. ?? is invalid and will not be required to handle).

Test cases

In the format:

```<code>Input
Output(s)
</code>```

The test cases:

```<code>Huh? I haven't heard what you just said. Could you repeat that please?
Huh?
Could you repeat that please?

plz can i haz cheesburgr? i am cat pls.
plz can i haz cheesburgr?

This is a badly formatted question.Can u please help me,or my friends,with formatting this question    ?thankyou.
Can u please help me,or my friends,with formatting this question    ?

a.b.c.d?
d?

Does this question have a question mark? yes
Does this question have a question mark?

Why example.com resolves to 127.0.0.1 in 99.9 percent of cases?
9 percent of cases?

A? b? c? d!
A?
b?
c?
</code>```

This is code-golf, so the submission with the lowest number of bytes wins!

Body:
JavaScript, <s>35</s> 24 bytes

a=>a.match(/[^.?!]*\?/g)

Returns all substrings that start after a ., ?, or ! (or the beginning of the text) and end in a ?.


问:
Is it a leap year?
This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not.

Your input will have no newlines or trailing spaces:

```<code>1954
</code>```

You will output in any way that you like that clearly tells the user if it is or isn't a leap year (I will accept y or n for yes/no)

You can get a list of leap years here: http://kalender-365.de/leap-years.php
I would note that leap years are not ever four years always. 1896 is a leap year, but 1900 is not. The years that follow this "skip" are:

```<code>1900
2100
2200
2300
</code>```

Test cases:

```<code>1936 ->  y
1805 ->  n
1900 ->  n
2272 ->  y
2400 ->  y
</code>```

EDIT: This is based on a standard Gregorian calendar: http://www.epochconverter.com/date-and-time/daynumbers-by-year.php

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 = 50798; // 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

```

答:
C#, 26 bytes

```<code>y=>DateTime.IsLeapYear(y);
</code>```

C# lambda (Predicate) where the input is a int and the output is a bool. I use a builtin.

Title: Is it a leap year?

Body:
C#, 26 bytes

y=>DateTime.IsLeapYear(y);

C# lambda (Predicate) where the input is a int and the output is a bool. I use a builtin.


答:
Python 2 - <s>79</s> <s>76</s> 75 bytes

x=input()
for i in range(x):print(x-i)*' '+'/----/'+(i*'  '+'\\    \\')[5:]
```

Thanks to Hubert Grzeskowiak for "disqualifying" me since making my program print actually saved 3 bytes!
Thanks also to Eʀɪᴋ ᴛʜᴇ Gᴏʟғᴇʀ for saving 1 more byte!

Title: Draw a ladder and slide

Body:
Python 2 - <s>79</s> <s>76</s> 75 bytes

x=input()
for i in range(x):print(x-i)*' '+'/----/'+(i*'  '+'\\    \\')[5:]

Thanks to Hubert Grzeskowiak for "disqualifying" me since making my program print actually saved 3 bytes!
Thanks also to Eʀɪᴋ ᴛʜᴇ Gᴏʟғᴇʀ for saving 1 more byte!


问:
Ordering a list

Summary

Given a list of integers, return the index each integer would end up at when sorted.

For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4].  Note that the two 8s maintain their order relative to each other (the sort is stable).

Put another way:  For each element in the list, return the number of elements in the list that are: Smaller than the chosen element OR (equal to the element AND appears before the chosen element)

Indexes must start with 0 (not 1)EDIT: given the large pushback, I'll allow 1-based indicies.

Test cases:

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

答:
Brachylog, 27 bytes

```<code>lL-M,?og:MjO,L~l.#d:Orz:ma?
</code>```

Try it online! or verify all test cases.

Explanation

This is a straightforward implementation of the following relationship: each integer of the output corresponding to an element of the input is the index of that element in the sorted input.

```<code>Example input: [3:2]

lL               L is the length of the input (e.g L=2)
  -M,            M = L-1 (e.g. M=1)
?o               Sort the input...
  g:MjO,         ... and create a list O with L copies of the input (e.g. O=[[2:3]:[2:3]])
L~l.             Output is a list of length L (e.g. [I:J])
    #d           All elements of the output must be distinct (e.g. I≠J)
      :Orz       Zip O with the output (e.g. [[[2:3]:I]:[[2:3]:J]])
          :ma?   Apply predicate Member with that zip as input and the input as output
                 (e.g. 3 is the Ith element of [2:3] and 2 is the Jth element of [2:3])
</code>```

Title: Ordering a list

Body:
Brachylog, 27 bytes

lL-M,?og:MjO,L~l.#d:Orz:ma?

Try it online! or verify all test cases.

Explanation

This is a straightforward implementation of the following relationship: each integer of the output corresponding to an element of the input is the index of that element in the sorted input.

Example input: [3:2]

lL               L is the length of the input (e.g L=2)
  -M,            M = L-1 (e.g. M=1)
?o               Sort the input...
  g:MjO,         ... and create a list O with L copies of the input (e.g. O=[[2:3]:[2:3]])
L~l.             Output is a list of length L (e.g. [I:J])
    #d           All elements of the output must be distinct (e.g. I≠J)
      :Orz       Zip O with the output (e.g. [[[2:3]:I]:[[2:3]:J]])
          :ma?   Apply predicate Member with that zip as input and the input as output
                 (e.g. 3 is the Ith element of [2:3] and 2 is the Jth element of [2:3])


答:
PHP, <s>34</s> 30 bytes

```<code>echo+!($argn%($argn%25?4:16));
</code>```

I'm using the + sign to convert false (which would normally be converted to an empty string) to 0, because that seems to comply closer to the "clearness" requirement (maybe not?). With standard truthy/falsy rules, 1 byte can be saved.

Note: I shamelessly implemented the divisibility by 25 trick from @David Hammen. Without his algorithm it would be 37 bytes:

```<code><?=+!(($b=$argv[1])%400^$b%100^$b%4);
</code>```

Run like this:

```<code>echo 1900 | php -nR 'echo+!($argn%($argn%25?4:16));';echo
</code>```

Tweaks

Saved 4 bytes by using $argn

Title: Is it a leap year?

Body:
This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not.

Your input will have no newlines or trailing spaces:

```<code>1954
</code>```

You will output in any way that you like that clearly tells the user if it is or isn't a leap year (I will accept y or n for yes/no)

You can get a list of leap years here: http://kalender-365.de/leap-years.php
I would note that leap years are not ever four years always. 1896 is a leap year, but 1900 is not. The years that follow this "skip" are:

```<code>1900
2100
2200
2300
</code>```

Test cases:

```<code>1936 ->  y
1805 ->  n
1900 ->  n
2272 ->  y
2400 ->  y
</code>```

EDIT: This is based on a standard Gregorian calendar: http://www.epochconverter.com/date-and-time/daynumbers-by-year.php

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 = 50798; // 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

```

Body:
PHP, <s>34</s> 30 bytes

echo+!($argn%($argn%25?4:16));

I'm using the + sign to convert false (which would normally be converted to an empty string) to 0, because that seems to comply closer to the "clearness" requirement (maybe not?). With standard truthy/falsy rules, 1 byte can be saved.

Note: I shamelessly implemented the divisibility by 25 trick from @David Hammen. Without his algorithm it would be 37 bytes:

<?=+!(($b=$argv[1])%400^$b%100^$b%4);

Run like this:

echo 1900 | php -nR 'echo+!($argn%($argn%25?4:16));';echo

Tweaks

Saved 4 bytes by using $argn


问:
Polar Bear, Polar Bear, what do you hear?
The text of the children's book Polar Bear, Polar Bear, What Do You Hear?  has a very simple pattern.  You might use the text to teach introductory programming concepts.

My son was quickly bored by this idea, so I decided to play some golf with it instead.

The Challenge

In your programming language of choice, write the smallest program possible which will print the following text.  Output should match exactly, including case, spacing, and punctuation.

```<code>Polar Bear, Polar Bear, what do you hear?
I hear a lion roaring in my ear.

Lion, Lion, what do you hear?
I hear a hippopotamus snorting in my ear.

Hippopotamus, Hippopotamus, what do you hear?
I hear a flamingo fluting in my ear.

Flamingo, Flamingo, what do you hear?
I hear a zebra braying in my ear.

Zebra, Zebra, what do you hear?
I hear a boa constrictor hissing in my ear.

Boa Constrictor, Boa Constrictor, what do you hear?
I hear an elephant trumpeting in my ear.

Elephant, Elephant, what do you hear?
I hear a leopard snarling in my ear.

Leopard, Leopard, what do you hear?
I hear a peacock yelping in my ear.

Peacock, Peacock, what do you hear?
I hear a walrus bellowing in my ear.

Walrus, Walrus, what do you hear?
I hear a zookeeper whistling in my ear.

Zookeeper, Zookeeper, what do you hear?
I hear children...

...growling like a polar bear,
roaring like a lion,
snorting like a hippopotamus,
fluting like a flamingo,
braying like a zebra,
hissing like a boa constrictor,
trumpeting like an elephant,
snarling like a leopard,
yelping like a peacock,
bellowing like a walrus...
that's what I hear.
</code>```

答:
C#, 592 572 Bytes

```<code>using System;class p{static void Main(){string[] s={"","","Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Contrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper","growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl"};for(int i=2;i<13;i++){s[0]+=(s[i]+", "+s[i]+", what do you hear?\nI hear "+(i<12?"a"+(i==7?"n ":" ")+s[i+1].ToLower()+" "+s[i+12]+"ing in my ear.\n\n":"children...\n\n..."));if(i<12)s[1]+=s[i+11]+"ing like a"+(i==8?"n ":" ")+s[i].ToLower()+(i<11?",\n":"...\nthat's what I hear.\n");}Console.Write(s[0]+s[1]);}}
</code>```

Had such a great time taking this challenge with my colleague! Thanks for the idea.

Formatted:

```<code>using System;
class p {
    static void Main() {
        string[] s = { "", "", "Polar Bear", "Lion", "Hippopotamus", "Flamingo", "Zebra", "Boa Contrictor", "Elephant", "Leopard", "Peacock", "Walrus", "Zookeeper", "growl", "roar", "snort", "flut", "bray", "hiss", "trumpet", "snarl", "yelp", "bellow", "whistl" };
        for (int i = 2; i < 13; i++) {
            s[0] += (s[i] + ", " + s[i] + ", what do you hear?\nI hear " + (i < 12 ? "a" + (i == 7 ? "n " : " ") + s[i + 1].ToLower() + " " + s[i + 12] + "ing in my ear.\n\n" : "children...\n\n..."));
            if (i < 12) s[1] += s[i + 11] + "ing like a" + (i == 8 ? "n " : " ") + s[i].ToLower() + (i < 11 ? ",\n" : "...\nthat's what I hear.\n");
        }
        Console.Write(s[0] + s[1]);
        Console.ReadKey();
    }
}
</code>```

EDIT: Thank you for your numerous and awesome tips, they helped a lot and I'll try to get the other ones working as well.

Body:
C#, 592 572 Bytes

using System;class p{static void Main(){string[] s={"","","Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Contrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper","growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl"};for(int i=2;i<13;i++){s[0]+=(s[i]+", "+s[i]+", what do you hear?\nI hear "+(i<12?"a"+(i==7?"n ":" ")+s[i+1].ToLower()+" "+s[i+12]+"ing in my ear.\n\n":"children...\n\n..."));if(i<12)s[1]+=s[i+11]+"ing like a"+(i==8?"n ":" ")+s[i].ToLower()+(i<11?",\n":"...\nthat's what I hear.\n");}Console.Write(s[0]+s[1]);}}

Had such a great time taking this challenge with my colleague! Thanks for the idea.

Formatted:

using System;
class p {
    static void Main() {
        string[] s = { "", "", "Polar Bear", "Lion", "Hippopotamus", "Flamingo", "Zebra", "Boa Contrictor", "Elephant", "Leopard", "Peacock", "Walrus", "Zookeeper", "growl", "roar", "snort", "flut", "bray", "hiss", "trumpet", "snarl", "yelp", "bellow", "whistl" };
        for (int i = 2; i < 13; i++) {
            s[0] += (s[i] + ", " + s[i] + ", what do you hear?\nI hear " + (i < 12 ? "a" + (i == 7 ? "n " : " ") + s[i + 1].ToLower() + " " + s[i + 12] + "ing in my ear.\n\n" : "children...\n\n..."));
            if (i < 12) s[1] += s[i + 11] + "ing like a" + (i == 8 ? "n " : " ") + s[i].ToLower() + (i < 11 ? ",\n" : "...\nthat's what I hear.\n");
        }
        Console.Write(s[0] + s[1]);
        Console.ReadKey();
    }
}

EDIT: Thank you for your numerous and awesome tips, they helped a lot and I'll try to get the other ones working as well.


答:
Java 8, <s>49</s> <s>45</s> <s>22</s> 20 bytes

n->n%(n%25<1?16:4)<1
```
<p>-2 bytes thanks to <em>@OlivierGrégoire</em>.</p>
<p>Try it online.</p>
<p>Some <strong>22 bytes solutions:</strong></p>
<pre class="lang-java prettyprint-override"><code>n->n%25<1?n%16<1:n%4<1
</code>```

Try it online.

n->(n%25<1?n%16:n%4)<1
```
<p>Try it online.</p>
<pre class="lang-java prettyprint-override"><code>java.time.Year::isLeap
</code>```

Try it online.

Explanation:

n->                // Method with integer parameter and boolean return-type
   n%          <1  //  Return whether the integer is divisible by:
     (n%25<1?      //   If the input is divisible by 25:
             16    //    Check if its divisible by 16
            :      //   Else:
             4)    //    Check if its divisible by 4 instead
```

Title: Is it a leap year?

Body:
Java 8, <s>49</s> <s>45</s> <s>22</s> 20 bytes

n->n%(n%25<1?16:4)<1

-2 bytes thanks to @OlivierGrégoire.

Try it online.

Some 22 bytes solutions:

n->n%25<1?n%16<1:n%4<1

Try it online.

n->(n%25<1?n%16:n%4)<1

Try it online.

java.time.Year::isLeap

Try it online.

Explanation:

n->                // Method with integer parameter and boolean return-type
   n%          <1  //  Return whether the integer is divisible by:
     (n%25<1?      //   If the input is divisible by 25:
             16    //    Check if its divisible by 16
            :      //   Else:
             4)    //    Check if its divisible by 4 instead


答:
jq, 69 characters

("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end
```

<p>Input is JSON, output is JSON, conditional syntax is pain.</p>

<p>Sample run:</p>

```bash-4.3$ jq '("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end' <<< '["Clyde"]'
[
  "Blinky",
  "Inky",
  "Pinky"
]

bash-4.3$ jq '("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end' <<< '["Pac-Man","Clyde"]'
[
  "Blinky",
  "Inky",
  "Pinky",
  "Clyde"
]
```

On-line test:

["Clyde"]

["Pac-Man","Clyde"]

Title: Which ghosts are missing?

Body:
In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can

Input

Input will consist of a string or list, which will include a number ghosts, which could include:

Blinky

Inky

Pinky

Clyde

However, input may also include Pac-Man (with that punctuation). So, the maximum amount of items in a list will be five, in any order. It can be assumed that no invalid items will be in the list

Output

Output will consist of a string, or list. This will include of all the ghosts that are not in the input, in any order. However, if Pac-Man is in the input, all ghosts will be considered missing (because he eats them).

Test cases

```<code>input: Clyde
output: Blinky, Inky, Pinky
alternate output: Inky, Pinky, Blinky
or one of the other 4 permutations

input: Clyde, Blinky # or however you delimit it
output: Inky, Pinky
alt: Pinky, Inky

input: Pac-Man, Clyde
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations

input:[null]
Output: Blinky, Inky, Pinky, Clyde
or you could output one of the other 23 permutations
</code>```

This is codegolf, so the lower the bytecount, the better.

Body:
jq, 69 characters

("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end

Input is JSON, output is JSON, conditional syntax is pain.

Sample run:

bash-4.3$ jq '("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end' <<< '["Clyde"]'
[
  "Blinky",
  "Inky",
  "Pinky"
]

bash-4.3$ jq '("Blinky Inky Pinky Clyde"/" ")as $a|if inside($a)then$a-. else$a end' <<< '["Pac-Man","Clyde"]'
[
  "Blinky",
  "Inky",
  "Pinky",
  "Clyde"
]

On-line test:

["Clyde"]

["Pac-Man","Clyde"]


答:
K, 1 byte

```<code>+
</code>```

Try it here!

Transpose

Title: Convert n strings of m length to m strings of n length

Body:
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition:

Every new string should contains the letters at the same index of the others strings

For example, the first output string must contain the first letter of all the input strings, the second output string must contain the second letter of all the input strings, and so on.

Examples (the numbers under the letters are the indexes of the strings):

```<code>input: "car", "dog", "man", "yay"
        012    012    012    012
output: "cdmy", "aoaa", "rgny"
         0000    1111    2222

input: "money", "taken", "trust"
        01234    01234    01234
output: "mtt", "oar", "nku", "ees", "ynt"
         000    111    222    333    444
</code>```

Assume that the input is correct everytime

Shortest bytes' code wins!

Edit:

Since there are many programming languages, and there could be many possible solutions for each of them, I will post the shortest solution for each programming language and the user who provided it. Keep coding!

Re-Edit:

Thanks to user Dennis I inserted a snippet for the leaderboards.

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
K, 1 byte

+

Try it here!

Transpose


问:
Make an HTML page goto infinite loop?
Write a code using HTML, JavaScript, jQuery to make the page go into infinite loop.

Restrictions:

No looping or control structures of javascript and jQuery allowed. You can only use alert, events, etc.

答:
This will reload the browser indefinitely:

```<code>location.reload()
</code>```

(Unless the browser specifically blocks repeated reloads.)

Title: Make an HTML page goto infinite loop?

Body:
This will reload the browser indefinitely:

location.reload()

(Unless the browser specifically blocks repeated reloads.)


答:
Perl 5.10, <s>21</s> 18 bytes (with -n flag)

```<code>say m/[^?.!]+\?/g
</code>```

Straightforward implementation of the question.

Try it here!

Title: What exactly was your question?

Body:
Perl 5.10, <s>21</s> 18 bytes (with -n flag)

say m/[^?.!]+\?/g

Straightforward implementation of the question.

Try it here!


问:
Dijkstra's Challenge

Presented in honor of APL as an interactive tool turning 50 this year

Background

Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on Mechanical Language Structures, Princeton, N.J. The list of conferees is full of famous and soon-to-be famous names, and a few future Turing Award winners (Backus, Curry, Dijkstra, Floyd, Iverson, Newell, Perlis, Wilkes). The paper also records the discussion that occurred after the presentation, ending with an exchange between Ken and [Edsger] Dijkstra, in which Ken’s reply to Dijkstra’s question was a one-liner.

Challenge

How would you represent a more complex operation, for example, the sum of all elements of a matrix M which are equal to the sum of the corresponding row and column indices?

Write a snippet or expression (no need for a full program or function) to calculate the sum of each element in a given integer matrix which is equal to the sum of its indices. Or, as FryAmTheEggman puts it: given a matrix M with elements aij return the sum of each aij where aij = i + j.

You may assume the matrix already being in a variable or memory location, or you may take it as an argument or input. You may use either 0 or 1 based indices.

Test cases

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

0 for empty matrix

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

0 for 0 based indices or 2 for 1-based

```<code>1 5 2
9 4 2
5 9 6
</code>```

2 for 0 based or 10 for 1 based

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

11

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

6 for 0 based or 3 for 1 based

Anecdote

Iverson's answer was ++/(M = ⍳¹ ⨢ ⍳¹)//M, which is neither valid in the Iverson Notation as defined in A Programming Language, nor in what eventually became APL. In Iverson notation, it would have been +/(M = ⍳¹(μ(M)) ⨢ ⍳¹(ν(M)))/M. In the very first versions of APL it was +/(,M=(⍳1↑⍴M)∘.+⍳1↓⍴M)/,M.

Title: Dijkstra's Challenge

Body:
Matlab/Octave, 48 bytes

1-indexed.

Will not handle the first test case because [1:0] has size 1x0 for some reason

sum(sum(M.*(M-[1:size(M,1)]'-[1:size(M,2)]==0)))

Tested in Octave 3.

Full program:

M = [2]
sum(sum(M.*(M-[1:size(M,1)]'-[1:size(M,2)]==0)))
M = [1 5 2; 9 4 2; 5 9 6]
sum(sum(M.*(M-[1:size(M,1)]'-[1:size(M,2)]==0)))
M = [ 0 3  0  4; 0 4  1  4; 4 3  1  2;-2 4 -2 -1]
sum(sum(M.*(M-[1:size(M,1)]'-[1:size(M,2)]==0)))
M = [ 3 -1 3 3; 3 -1 3 1]
sum(sum(M.*(M-[1:size(M,1)]'-[1:size(M,2)]==0)))


答:
Pyke, 6 bytes (noncompetitive)

```<code>G4m*_X
</code>```

Try it here!

Or 4 bytes without newline separation

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

Body:
Note that this is not the same as Print the alphabet four times.

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

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

etc.

The output should include newlines after each letter.

Lowercase letters and/or extra whitespace are acceptable.

The solution must be a complete program.

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

Body:
Pyke, 6 bytes (noncompetitive)

G4m*_X

Try it here!

Or 4 bytes without newline separation

G4m*


Title: Sort a list of unknown values with the least amount of comparisons

Body:
In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin.

The below protocol is line-based, so everytime you print to stdout or read from stdin it is assumed a newline follows. Throughout the question below it is assumed that the user (read: the scoring program) has an array it wants sorted in a 0-based indexed array called array. For technical reasons I suggest flushing after every print to stout.

As your first step your program must read the array size n from stdin.

Then, as often as you wish, you can print a < b to stdout, with two integers 0 <= a, b < n. Then the user will enter 1 in stdin if array[a] < array[b], and 0 otherwise.

Finally, once your program is convinced it has correctly deduced the order of the array, it must print a ... to stdout, where ... is a space separated list of integers indicating the order. So if your program outputs a 3 0 1 4 2 it means your program has deduced

```<code>array[3] <= array[0] <= array[1] <= array[4] <= array[2]
</code>```

Note that your program never knew the contents of array, and never will.

You can only ask for < on stdin to sort the array. You can get other comparison operations by these equivalencies:

```<code>a > b        b < a
a <= b       !(b < a)
a >= b       !(a < b)
a != b       (a < b) || (b < a)
a == b       !(a < b) && !(b < a)
</code>```

Finally, since your program interacts with the scoring program on stdout, print debug information to stderr.

Your program will be scored using the following Python program:

from __future__ import print_function
from subprocess import Popen, PIPE
import sys, random

def sort_test(size):
    array = [random.randrange(0, size) for _ in range(size)]
    pipe = Popen(sys.argv[1:], stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True)
    print(str(size), file=pipe.stdin); pipe.stdin.flush()
    num_comparisons = 0
    while True:
        args = pipe.stdout.readline().strip().split()
        if args and args[0] == "a":
            answer_array = [array[int(n)] for n in args[1:]]
            if list(sorted(array)) != answer_array:
                raise RuntimeError("incorrect sort for size {}, array was {}".format(size, array))
            return num_comparisons
        elif len(args) == 3 and args[1] == "<":
            a, b = int(args[0]), int(args[2])
            print(int(array[a] < array[b]), file=pipe.stdin); pipe.stdin.flush()
            num_comparisons += 1
        else:
            raise RuntimeError("unknown command")

random.seed(0)
total = 0
for i in range(101):
    num_comparisons = sort_test(i)
    print(i, num_comparisons)
    total += num_comparisons
print("total", total)
```

You score your program by typing python score.py yourprogram. The scoring is done by having your program sort one random array of each size 0 to 100 and counting the amount of comparisons your program asks for. These random arrays can have duplicates, your algorithm must be able to handle equal elements. In the event there are duplicates, there are no requirements on the order of the equal elements. So if the array is [0, 0] it doesn't matter if you output a 0 1 or a 1 0.

You may not optimize specifically for the particular arrays the scoring program generates. I may change the RNG seed at any point in time. Answers using built-in sorting algorithms are permitted to be posted for interest's sake, but are non-competing.

Program with lowest score wins.

Body:
Python 3, 28462 score

Quick sort. Pivot is leftmost item.

The score is expected, because:

from __future__ import print_function
import sys
size = int(input())

def less(a, b):
    print(a, "<", b); sys.stdout.flush()
    return bool(int(input()))

def quicksort(array):
    if len(array) < 2:
        return array
    pivot = array[0]
    left = []
    right = []
    for i in range(1,len(array)):
        if less(array[i],pivot):
            left.append(array[i])
        else:
            right.append(array[i])
    return quicksort(left)+[pivot]+quicksort(right)

array = list(range(size))
array = quicksort(array)

print("a", " ".join(str(i) for i in array)); sys.stdout.flush()

Scores for each size tested:

size score
0 0
1 0
2 1
3 3
4 6
5 8
6 11
7 12
8 15
9 17
10 23
11 33
12 29
13 32
14 37
15 45
16 58
17 47
18 52
19 79
20 72
21 60
22 85
23 138
24 87
25 98
26 112
27 107
28 128
29 142
30 137
31 136
32 158
33 143
34 145
35 155
36 169
37 209
38 163
39 171
40 177
41 188
42 167
43 260
44 208
45 210
46 230
47 276
48 278
49 223
50 267
51 247
52 263
53 293
54 300
55 259
56 319
57 308
58 333
59 341
60 306
61 295
62 319
63 346
64 375
65 344
66 346
67 370
68 421
69 507
70 363
71 484
72 491
73 417
74 509
75 495
76 439
77 506
78 484
79 458
80 575
81 505
82 476
83 500
84 535
85 501
86 575
87 547
88 522
89 536
90 543
91 551
92 528
93 647
94 530
95 655
96 580
97 709
98 671
99 594
100 637
total 28462


Body:
Python 2 (non-competing), 23471 score

from __future__ import print_function
import sys
size = int(input())

def cmp(a, b):
    print(a, "<", b); sys.stdout.flush()
    return [1,-1][bool(int(input()))]

array = list(range(size))
array = sorted(array,cmp=cmp)

print("a", " ".join(str(i) for i in array)); sys.stdout.flush()

Scores for each size tested:

size score
0 0
1 0
2 1
3 4
4 5
5 7
6 9
7 14
8 17
9 20
10 21
11 26
12 30
13 35
14 37
15 41
16 45
17 51
18 52
19 57
20 63
21 63
22 72
23 79
24 79
25 80
26 91
27 93
28 96
29 105
30 110
31 116
32 124
33 123
34 131
35 130
36 142
37 144
38 156
39 154
40 163
41 168
42 177
43 178
44 183
45 183
46 192
47 194
48 212
49 207
50 216
51 221
52 227
53 239
54 238
55 243
56 255
57 257
58 260
59 270
60 281
61 284
62 292
63 293
64 303
65 308
66 312
67 321
68 328
69 328
70 342
71 348
72 352
73 358
74 367
75 371
76 381
77 375
78 387
79 400
80 398
81 413
82 415
83 427
84 420
85 435
86 438
87 448
88 454
89 462
90 462
91 479
92 482
93 495
94 494
95 502
96 506
97 520
98 521
99 524
100 539
total 23471


答:
C#, 53 bytes

```<code>t=>t[0].Select((_,i)=>t.Aggregate("",(a,b)=>a+b[i]));
</code>```

C# lambda (Func) where the output is IList<string> and the output is IEnumerable<string>. I dont know how work zip in other language but I can't find a way to use the C#'s one here. Aggregate fit the need well. No transpose in C#, there is one in Excel but I wont use it.

Try it online!

Body:
C#, 53 bytes

t=>t[0].Select((_,i)=>t.Aggregate("",(a,b)=>a+b[i]));

C# lambda (Func) where the output is IList<string> and the output is IEnumerable<string>. I dont know how work zip in other language but I can't find a way to use the C#'s one here. Aggregate fit the need well. No transpose in C#, there is one in Excel but I wont use it.

Try it online!


答:
PowerShell, 31 bytes

I am excited to say that I golfed this shorter than the builtin!

```<code>param($a)!($a%(4,16)[!($a%25)])
</code>```

Outputs true for leap years and false otherwise.

Builtin:

```<code>[datetime]::IsLeapYear($args[0])
</code>```

Though, if I wanted to stretch the statement 'clearly tells the user if it is or isn't a leap year' and do something non-standard, I could save 3 bytes and use:

```<code>param($a)$a%(4,16)[!($a%25)]
</code>```

This outputs 0 for leap years and 1 or higher for non-leap years, which I don't like since I'd prefer to return a more standard truthy value for leap years.

Title: Is it a leap year?

Body:
PowerShell, 31 bytes

I am excited to say that I golfed this shorter than the builtin!

param($a)!($a%(4,16)[!($a%25)])

Outputs true for leap years and false otherwise.

Builtin:

[datetime]::IsLeapYear($args[0])

Though, if I wanted to stretch the statement 'clearly tells the user if it is or isn't a leap year' and do something non-standard, I could save 3 bytes and use:

param($a)$a%(4,16)[!($a%25)]

This outputs 0 for leap years and 1 or higher for non-leap years, which I don't like since I'd prefer to return a more standard truthy value for leap years.


答:
golfscript, 46 45

My first ever golf script program, took hours to complete.

```<code>{','/{'-'/{~}%.,1-{))+{,}/\-~}{~}if}%","*}:r;

# call:
"1,3-5,9,16,18-23"r

# return:
1,3,4,5,9,16,18,19,20,21,22,23
</code>```

You can try it at http://golfscript.apphb.com/

My best throw at explaining this atrocity:

```<code>{...}:r;     # makes a function block ... and names it r

','/         # slices the top element of stack from each ','
             # so we get ["1" "3-5" "9" "16" "18-23"]

{...}%       # makes a function block ... and calls it for
             # each element in the list

'-'/{~}%     # slices the list by '-' and evals each element
             # from string to int. ["1"] becomes [1],
             # ["3-5"] becomes [3 5]

.,1-         # adds the length of the list -1 on top of the stack
             # so for [1] the stack becomes [1] 0, for [3 5]
             # it becomes [3 5] 1

# next we add two function blocks, they, like the 0/1 just before
# are used by an if clause a tiny bit later. First block is for
# lists that have a 1 on top of them, the latter for ones with 0.

# First block, we have something like [3 5]

))+          # pops the top element of the array, increments
             # it and puts back. [3 6]

## It seems {...}%~ is same as {...}/
## this is why these two are not in the code any more

{,}%         # , makes a list from 0 to n-1, where n is the parameter
             # so we get [[0 1 2] [0 1 2 3 4 5]]

~            # Dumps the outer array, [0 1 2] [0 1 2 3 4 5]

\            # swaps the two arrays

-            # set complement [3 4 5]

~            # dumps the array, so the elements are left in the stack

# Second block, we have something like [16]

~            # just dumps the array, 16

# Blocks end

if           # takes the top three elements of the stack, evaluates the
             # first (0 or 1), runs second if true (anything but
             # [], "", 0 or {} ), otherwise the third.

","*         # joins an array with ","
</code>```

edit 1: changed the last {}%~ to {}/, also my description was likely wrong.

Title: Return each number from a group of numbers

Body:
The challenge

The program must return all numbers included into a group (comma and hyphen separated sequence) of numbers.

Rules

s is the sequence string;

all numbers included in s are positive;

numbers will always increase;

numbers will never repeat

when you answer, show the output for s="1,3-5,9,16,18-23"

Examples

```<code>input(s)    outputs
-----------------
1           1
1,2         1,2
1-4         1,2,3,4
1-4,6       1,2,3,4,6
1-4,8-11    1,2,3,4,8,9,10,11
</code>```

Good luck. =)

Body:
golfscript, 46 45

My first ever golf script program, took hours to complete.

{','/{'-'/{~}%.,1-{))+{,}/\-~}{~}if}%","*}:r;

# call:
"1,3-5,9,16,18-23"r

# return:
1,3,4,5,9,16,18,19,20,21,22,23

You can try it at http://golfscript.apphb.com/

My best throw at explaining this atrocity:

{...}:r;     # makes a function block ... and names it r

','/         # slices the top element of stack from each ','
             # so we get ["1" "3-5" "9" "16" "18-23"]

{...}%       # makes a function block ... and calls it for
             # each element in the list

'-'/{~}%     # slices the list by '-' and evals each element
             # from string to int. ["1"] becomes [1],
             # ["3-5"] becomes [3 5]

.,1-         # adds the length of the list -1 on top of the stack
             # so for [1] the stack becomes [1] 0, for [3 5]
             # it becomes [3 5] 1

# next we add two function blocks, they, like the 0/1 just before
# are used by an if clause a tiny bit later. First block is for
# lists that have a 1 on top of them, the latter for ones with 0.

# First block, we have something like [3 5]

))+          # pops the top element of the array, increments
             # it and puts back. [3 6]

## It seems {...}%~ is same as {...}/
## this is why these two are not in the code any more

{,}%         # , makes a list from 0 to n-1, where n is the parameter
             # so we get [[0 1 2] [0 1 2 3 4 5]]

~            # Dumps the outer array, [0 1 2] [0 1 2 3 4 5]

\            # swaps the two arrays

-            # set complement [3 4 5]

~            # dumps the array, so the elements are left in the stack

# Second block, we have something like [16]

~            # just dumps the array, 16

# Blocks end

if           # takes the top three elements of the stack, evaluates the
             # first (0 or 1), runs second if true (anything but
             # [], "", 0 or {} ), otherwise the third.

","*         # joins an array with ","

edit 1: changed the last {}%~ to {}/, also my description was likely wrong.


答:
C# <s>135 bytes</s>126 bytes

```<code>string[] g{"Blinky","Inky","Pinky","Clyde"};Console.WriteLine(String.Join(",",i.Contains("Pac-Man")?g:g.Except(i).ToArray()));
</code>```

(where i is a string array containing the input)

After looking at the other examples, I see that C# is rather a verbose language :)

Title: Which ghosts are missing?

Body:
C# <s>135 bytes</s>126 bytes

string[] g{"Blinky","Inky","Pinky","Clyde"};Console.WriteLine(String.Join(",",i.Contains("Pac-Man")?g:g.Except(i).ToArray()));

(where i is a string array containing the input)

After looking at the other examples, I see that C# is rather a verbose language :)