答:
Jelly, <s>13</s> 11 bytes

```<code>Ḷṗ2SÞ⁸ị1,0x
</code>```

The code does not work in the latest version of Jelly before the challenge was posted, but it did work in this version, which predates the challenge.

Indices are 1-based. Try it online! (takes a few seconds) or verify multiple inputs at once.

How it works

```<code>Ḷṗ2SÞ⁸ị1,0x  Main link. Argument: n (integer)

Ḷ            Unlength; yield [0, ..., n - 1].
 ṗ2          Take the second Cartesian power, i.e., generate the array of all
             pairs of elements of [0, ..., n - 1].
   SÞ        Sort the pairs by their sum. The sort is stable, so ties are broken
             by lexicographical order.
     ⁸ị      Retrieve the pair at index n.
       1,0x  Map [a, b] to a copies of 1 and b copies of 0.
</code>```

Title: Generate the Rummy Sequence

Body:
Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you).

Definition

Each element of the Rummy Sequence is a set of truthy or falsey values. Ex.: [true, false].

The steps to producing a member of the Rummy Sequence are quite simple:

Start out with the first index, [] (this is element 0).

Set the leftmost falsey to truthy. If there are no falseys to change, then increase the length of the list by 1 and set all members of the new list to falsey.

Repeat step 2 until reaching element n.

Example

Let's define our function as rummy(int n) (stuff in {} is a step taken to get to the answer):

```<code>>>> rummy(5)
{[]}
{[false]}
{[true]}
{[false, false]}
{[true, false]}
[true, true]
</code>```

Rules

Standard loopholes apply.

Must work for inputs 0 through your language's upper numerical bound.

You may output in any way you see fit, provided that it is clear that the output is a set of truthy/falseys.

Trivia

I call this the "Rummy Sequence" because, starting at index 2, it defines the sets you would need to lay down in each round of Progressive Rummy, where falsey is a book and truthy is a run.

Test Cases

```<code>>>> rummy(0)
[]

>>> rummy(1)
[false]

>>> rummy(6)
[false, false, false]

>>> rummy(20)
[true, true, true, true, true]

>>> rummy(1000)
[true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
</code>```

Body:
Jelly, <s>13</s> 11 bytes

Ḷṗ2SÞ⁸ị1,0x

The code does not work in the latest version of Jelly before the challenge was posted, but it did work in this version, which predates the challenge.

Indices are 1-based. Try it online! (takes a few seconds) or verify multiple inputs at once.

How it works

Ḷṗ2SÞ⁸ị1,0x  Main link. Argument: n (integer)

Ḷ            Unlength; yield [0, ..., n - 1].
 ṗ2          Take the second Cartesian power, i.e., generate the array of all
             pairs of elements of [0, ..., n - 1].
   SÞ        Sort the pairs by their sum. The sort is stable, so ties are broken
             by lexicographical order.
     ⁸ị      Retrieve the pair at index n.
       1,0x  Map [a, b] to a copies of 1 and b copies of 0.


问:
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, <s>66</s> <s>61</s> 96 bytes

```<code>g={"Blinky","Inky","Pinky","Clyde"};i=set(input());print",".join(g-i if not"Pac-Man"in i else g)
</code>```

Input must be a list, output will be a string of names separated by a ,.

61 bytes version that doesn't handle Pac-Man:

```<code>print",".join({"Blinky","Inky","Pinky","Clyde"}-set(input()))
</code>```

ContentLicense: CC BY-SA 4.0

Title: Which ghosts are missing?

Body:
Python 2, <s>66</s> <s>61</s> 96 bytes

g={"Blinky","Inky","Pinky","Clyde"};i=set(input());print",".join(g-i if not"Pac-Man"in i else g)

Input must be a list, output will be a string of names separated by a ,.

61 bytes version that doesn't handle Pac-Man:

print",".join({"Blinky","Inky","Pinky","Clyde"}-set(input()))

ContentLicense: CC BY-SA 3.0


问:
Generate the Rummy Sequence
Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you).

Definition

Each element of the Rummy Sequence is a set of truthy or falsey values. Ex.: [true, false].

The steps to producing a member of the Rummy Sequence are quite simple:

Start out with the first index, [] (this is element 0).

Set the leftmost falsey to truthy. If there are no falseys to change, then increase the length of the list by 1 and set all members of the new list to falsey.

Repeat step 2 until reaching element n.

Example

Let's define our function as rummy(int n) (stuff in {} is a step taken to get to the answer):

```<code>>>> rummy(5)
{[]}
{[false]}
{[true]}
{[false, false]}
{[true, false]}
[true, true]
</code>```

Rules

Standard loopholes apply.

Must work for inputs 0 through your language's upper numerical bound.

You may output in any way you see fit, provided that it is clear that the output is a set of truthy/falseys.

Trivia

I call this the "Rummy Sequence" because, starting at index 2, it defines the sets you would need to lay down in each round of Progressive Rummy, where falsey is a book and truthy is a run.

Test Cases

```<code>>>> rummy(0)
[]

>>> rummy(1)
[false]

>>> rummy(6)
[false, false, false]

>>> rummy(20)
[true, true, true, true, true]

>>> rummy(1000)
[true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
</code>```

答:
Python, 51 bytes

f=lambda n,i=0:n>i and f(n+~i,i+1)or[1]*n+[0]*(i-n)
```

Outputs a list of 1's and 0's.

Title: Generate the Rummy Sequence

Body:
Python, 51 bytes

f=lambda n,i=0:n>i and f(n+~i,i+1)or[1]*n+[0]*(i-n)

Outputs a list of 1's and 0's.


Title: Generate the Rummy Sequence

Body:
Python 2, <s>69</s> 63 bytes

a=b=0
exec'a,b=[a-1,b+1,0][a<1:][:2];'*input()
print[1]*b+[0]*a

Test it on Ideone.


答:
JavaScript ES6, <s>85</s> 78 bytes

As an anonymous function

```<code>a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))
</code>```

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

```<code>(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]
</code>```

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:
JavaScript ES6, <s>85</s> 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]


答:
Haskell, 91 bytes

```<code>import Data.List
p l=(if elem"Pac-Man"l then id else(\\l))["Blinky","Inky","Pinky","Clyde"]
</code>```

Input is a list of strings. It decides whether to use the list as-is or do a list-difference based on the presence of "Pac-Man".

For extra fun, here is no Pac-Man:

```<code>import Data.List
(["Blinky","Inky","Pinky","Clyde"]\\)
</code>```

Will be improving this answer soon, did it super late at night.

Title: Which ghosts are missing?

Body:
Haskell, 91 bytes

import Data.List
p l=(if elem"Pac-Man"l then id else(\\l))["Blinky","Inky","Pinky","Clyde"]

Input is a list of strings. It decides whether to use the list as-is or do a list-difference based on the presence of "Pac-Man".

For extra fun, here is no Pac-Man:

import Data.List
(["Blinky","Inky","Pinky","Clyde"]\\)

Will be improving this answer soon, did it super late at night.


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

答:
JavaScript, <s>545</s> <s>541</s> 497 bytes

```<code>a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;a.map((m,n)=>{console.log(m+", "+m+", what do you hear?\n "+((n>9)?"I hear children...\n":"I hear a"+(n==5?"n ":" ")+a[n+1].toLowerCase()+" "+s[n+1]+"ing in my ear.\n"))});p="...";a.map((m,n)=>{if(n>9)return;p+=s[n]+"ing like a"+(n==6?"n ":" ")+m.toLowerCase()+(n>8?"...\nthat's what I hear.":",\n")});console.log(p)
</code>```

Quite a fun challenge!

Thanks Downgoat for saving me <s>27</s> a ton of bytes using atob, and Titus for 4 bytes!

Ungolfed:

```<code>a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;
s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;
a.map((m,n)=>{
  console.log(m+", "+m+", what do you hear?\n "+((n==10)?"I hear children...\n":"I hear a" + (n==5?"n ":" ") + a[n+1].toLowerCase() + " " + s[n+1] + "ing in my ear.\n"))
});
p="...";a.map((m,n)=>{
  if(n==10) return;
  p+=s[n] + "ing like a" + (n==6?"n ":" ") + m.toLowerCase() + (n==9?"...\nthat's what I hear.":",\n")
});
console.log(p);
</code>```

Body:
JavaScript, <s>545</s> <s>541</s> 497 bytes

a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;a.map((m,n)=>{console.log(m+", "+m+", what do you hear?\n "+((n>9)?"I hear children...\n":"I hear a"+(n==5?"n ":" ")+a[n+1].toLowerCase()+" "+s[n+1]+"ing in my ear.\n"))});p="...";a.map((m,n)=>{if(n>9)return;p+=s[n]+"ing like a"+(n==6?"n ":" ")+m.toLowerCase()+(n>8?"...\nthat's what I hear.":",\n")});console.log(p)

Quite a fun challenge!

Thanks Downgoat for saving me <s>27</s> a ton of bytes using atob, and Titus for 4 bytes!

Ungolfed:

a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;
s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;
a.map((m,n)=>{
  console.log(m+", "+m+", what do you hear?\n "+((n==10)?"I hear children...\n":"I hear a" + (n==5?"n ":" ") + a[n+1].toLowerCase() + " " + s[n+1] + "ing in my ear.\n"))
});
p="...";a.map((m,n)=>{
  if(n==10) return;
  p+=s[n] + "ing like a" + (n==6?"n ":" ") + m.toLowerCase() + (n==9?"...\nthat's what I hear.":",\n")
});
console.log(p);


问:
Binary Recurrence Sequences
A binary recurrence sequence is a recursively-defined sequence of the following form:

$$F(1) = a_1 \\ \vdots \\ F(y) = a_y \\
F(n) = \alpha F(n-x) + \beta F(n-y), n > y$$

This is a generalization of the Fibonacci (\$x = 1, y = 2, a = [1, 1], \alpha = 1, \beta = 1\$) sequence and the Lucas (\$x = 1, y = 2, a = [2, 1], \alpha = 1, \beta = 1\$) sequence.

The Challenge

Given \$n, x, y, a, \alpha\$, and \$\beta\$, in any reasonable format, output the \$n\$th term of the corresponding binary recurrence sequence.

Rules

You may choose for the sequence to be either 1-indexed or 0-indexed, but your choice must be consistent across all inputs, and you must make note of your choice in your answer.

You may assume that no invalid inputs would be given (such as a sequence that terminates prior to \$n\$, or a sequence that references undefined terms, like \$F(-1)\$ or \$F(k)\$ where \$k > n\$). As a result of this, \$x\$ and \$y\$ will always be positive.

The inputs and outputs will always be integers, within the boundaries of your language's natural integer type. If your language has unbounded integers, the inputs and outputs will be within the range \$[-2^{31}, 2^{31}-1]\$ (i.e. the range for a 32-bit signed two's complement integer).

\$a\$ will always contain exactly \$y\$ values (as per the definition).

Test Cases

Note: all test cases are 0-indexed.

```<code>x = 1, y = 2, a = [1, 1], alpha = 1, beta = 1, n = 6 => 13
x = 1, y = 2, a = [2, 1], alpha = 1, beta = 1, n = 8 => 47
x = 3, y = 5, a = [2, 3, 5, 7, 11], alpha = 2, beta = 3, n = 8 => 53
x = 1, y = 3, a = [-5, 2, 3], alpha = 1, beta = 2, n = 10 => -67
x = 5, y = 7, a = [-5, 2, 3, -7, -8, 1, -9], alpha = -10, beta = -7, n = 10 => 39
</code>```

答:
Jelly, 11 bytes

```<code>⁴Cịæ.⁵ṭµ¡⁶ị
</code>```

Try it online!  1  |  2  |  3  |  4  |  5

How it works

```<code>⁴Cịæ.⁵ṭµ¡⁶ị  Main link. Arguments: a; [x, y]; [α, β]; n (1-based)

       µ     Combine the links to the left into a chain.
        ¡    Execute that chain n times, updating a after each execution.
⁴              Yield [x, y].
 C             Complement; yield [1 - x, 1 - y].
  ị            Retrieve the elements of a at those indices.
               Indexing is 1-based and modular in Jelly, so this retrieves
               [a[-x], a[-y]] (Python syntax).
     ⁵         Yield [α, β].
   æ.          Take the dot product of [a[-x], a[-y]] and [α, β].
         ⁶   Yield n.
          ị  Retrieve the element of a at index n.
</code>```

Title: Binary Recurrence Sequences

Body:
Jelly, 11 bytes

⁴Cịæ.⁵ṭµ¡⁶ị

Try it online!  1  |  2  |  3  |  4  |  5

How it works

⁴Cịæ.⁵ṭµ¡⁶ị  Main link. Arguments: a; [x, y]; [α, β]; n (1-based)

       µ     Combine the links to the left into a chain.
        ¡    Execute that chain n times, updating a after each execution.
⁴              Yield [x, y].
 C             Complement; yield [1 - x, 1 - y].
  ị            Retrieve the elements of a at those indices.
               Indexing is 1-based and modular in Jelly, so this retrieves
               [a[-x], a[-y]] (Python syntax).
     ⁵         Yield [α, β].
   æ.          Take the dot product of [a[-x], a[-y]] and [α, β].
         ⁶   Yield n.
          ị  Retrieve the element of a at index n.


答:
Pyth - 45 38  35 Bytes

```<code>=GwI!:G"a")j-["inky""pinky""blinky""clyde")cG
</code>```

```<code>I!:=Gw"a")j-c:" p bl clyde"d"inky "dcG
</code>```

```<code>j-c:" p bl clyde"d"inky "d?:z\aZYcz
</code>```

-1 more byte thanks to Leaky Nun!

Input must be space delimited, all lowercase; outputs missing ghosts on separate lines unless pac-man is in the input.

Title: Which ghosts are missing?

Body:
Pyth - 45 38  35 Bytes

=GwI!:G"a")j-["inky""pinky""blinky""clyde")cG

I!:=Gw"a")j-c:" p bl clyde"d"inky "dcG

j-c:" p bl clyde"d"inky "d?:z\aZYcz

-1 more byte thanks to Leaky Nun!

Input must be space delimited, all lowercase; outputs missing ghosts on separate lines unless pac-man is in the input.


问:
Print all alphanumeric characters plus underscore
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more:

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

When printing to stdout, an optional trailing newline after your output is permitted.

Built-in constants that contain 9 or more of the above characters are disallowed.

Shortest code in bytes wins.

This is a very simple challenge, which I believe will generate some interesting answers nevertheless.

Leaderboards

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

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

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

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

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

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

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

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

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

var QUESTION_ID=85666,OVERRIDE_USER=4162;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;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:
Erlang, 56 bytes

f()->[X||X<-lists:seq(1,$z),re:run([X],"\\w")/=nomatch].

Erlang, 57 bytes

f()->S=fun lists:seq/2,[$_|S($0,$9)]++S($A,$Z)++S($a,$z).


答:
PHP, <s>420</s> <s>414</s> <s>434</s> <s>414</s> 412 bytes

call from CLI or prepend ```</code> to output.</p>
```$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];$a[6]=n;foreach($n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper]as$i=>$p)echo$i?"I hear a$a[$i] $p $v[$i]ing in my ear.

":"",$q=ucwords($p),", $q, what do you hear?
",$i>9?"I hear children...

...":""&$z[]="$v[$i]ing like a$a[$i] $p";echo join(",
",$z),"...
that's what I hear.";
```
<ul>
<li>a couple of notices for undefined constants; PHP´s implicit cast to literal string kicks in again</li>
<li>adding the "n" for "an elephant" took 20 bytes ... hmpf.</li>
<li>got the 20 bytes back by reordering stuff :)</li>
</ul>
<p><strong>breakdown</strong></p>
```$n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper];
$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];
$a[6]=n;
// loop through nouns with index $i
foreach($n as$i=>$p) echo
    // print first part:
        // not first noun: print second line to previous step
        $i?"I hear a$a[$i] $p $v[$i]ing in my ear.\n\n":"",
        // uppercase the first letter of each word in the noun, print
        $q=ucwords($p),
        // print uppercase noun again and the rest of the line
        ", $q, what do you hear?\n",
        // for last noun print bridge, else print nothing
        $i>9?"I hear children...\n\n...":""
    // ... AND add line to second part
        &$z[]="$v[$i]ing like a$a[$i] $p"
;
// print second part and final line
echo join(",\n",$z),"...\nthat's what I hear.";
```

Body:
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>```

Body:
PHP, <s>420</s> <s>414</s> <s>434</s> <s>414</s> 412 bytes

call from CLI or prepend <pre> to output.

$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];$a[6]=n;foreach($n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper]as$i=>$p)echo$i?"I hear a$a[$i] $p $v[$i]ing in my ear.

":"",$q=ucwords($p),", $q, what do you hear?
",$i>9?"I hear children...

...":""&$z[]="$v[$i]ing like a$a[$i] $p";echo join(",
",$z),"...
that's what I hear.";

a couple of notices for undefined constants; PHP´s implicit cast to literal string kicks in again

adding the "n" for "an elephant" took 20 bytes ... hmpf.

got the 20 bytes back by reordering stuff :)

breakdown

$n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper];
$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];
$a[6]=n;
// loop through nouns with index $i
foreach($n as$i=>$p) echo
    // print first part:
        // not first noun: print second line to previous step
        $i?"I hear a$a[$i] $p $v[$i]ing in my ear.\n\n":"",
        // uppercase the first letter of each word in the noun, print
        $q=ucwords($p),
        // print uppercase noun again and the rest of the line
        ", $q, what do you hear?\n",
        // for last noun print bridge, else print nothing
        $i>9?"I hear children...\n\n...":""
    // ... AND add line to second part
        &$z[]="$v[$i]ing like a$a[$i] $p"
;
// print second part and final line
echo join(",\n",$z),"...\nthat's what I hear.";


答:
Jelly, <s>25</s> 22 bytes

```<code>Ff”-ȯ⁸“JLKqḤṢ&F⁻ı»ṣ⁶¤ḟ
</code>```

This is a monadic function. I/O is in form of lists. Try it online!

How it works

```<code>Ff”-ȯ⁸“JLKqḤṢ&F⁻ı»ṣ⁶¤ḟ  Monadic link. Argument: A (list of strings)

F                       Flatten A.
 f”-                    Filter it with the string "-" to detect "Pac-Man".
    ȯ⁸                  Flat logical OR with A. This yields A if there is no '-'
                        in the input, the string "-" otherwise.
                    ¤   Combine the three links to the left into a niladic chain.
      “JLKqḤṢ&F⁻ı»        Yield "Blinky Inky Pinky Clyde", using Jelly's built-in
                          English dictionary.
                  ṣ⁶      Split at spaces to yield
                          ["Blinky", "Inky", "Pinky", "Clyde"].
                     ḟ  Filter-false; removing all elements from that list that
                        appear in A or "-". This is a noop if A contains "Pac-Man".
</code>```

Title: Which ghosts are missing?

Body:
Jelly, <s>25</s> 22 bytes

Ff”-ȯ⁸“JLKqḤṢ&F⁻ı»ṣ⁶¤ḟ

This is a monadic function. I/O is in form of lists. Try it online!

How it works

Ff”-ȯ⁸“JLKqḤṢ&F⁻ı»ṣ⁶¤ḟ  Monadic link. Argument: A (list of strings)

F                       Flatten A.
 f”-                    Filter it with the string "-" to detect "Pac-Man".
    ȯ⁸                  Flat logical OR with A. This yields A if there is no '-'
                        in the input, the string "-" otherwise.
                    ¤   Combine the three links to the left into a niladic chain.
      “JLKqḤṢ&F⁻ı»        Yield "Blinky Inky Pinky Clyde", using Jelly's built-in
                          English dictionary.
                  ṣ⁶      Split at spaces to yield
                          ["Blinky", "Inky", "Pinky", "Clyde"].
                     ḟ  Filter-false; removing all elements from that list that
                        appear in A or "-". This is a noop if A contains "Pac-Man".


答:
Dyalog APL, 387 bytes

```<code>⎕UCS¯2(219⌶)¯128+⎕UCS'øZýÓÁî°üÁ~`Û¯ß(4Õ+ÖjáïvXô ¶Dhkë ©4¹³`LxÖ4¢gÍ¼4ªBáDÚN¼ùV ÂÅF]@¸hÆà bKÚ¸_oQãÔÝ ¸$8§ú_ÔÈxÖ ~6*ãªd ¿ð>¥ÐB8þôÍxwÄ6Å
ô¡é¢wBlDµ¯ë
Ãbqè+ý+ÜÈýgu!gWËØ#0="«ë"HDÝÀV·¦/ÕMÆí}h<àì7å ÝÒëëñX³ýM <dÄ<ëmµñqP]¥c¬l¾¤ìÚã/$ÝÕqÙÞîCLéMÝÏ}OÔÏ¤r$¤è©~ì2[¢{·YWÒä¿¦à¶)YØ©;s÷¬¥+ó&¿ÉâgËr
,Ýî©)¥Ö2è´ÝÅd{úK5·Õ}ýÚ'
</code>```

To ease reading: ⎕UCS¯2(219⌶)¯128+⎕UCS'...'

⎕UCS '...' convert string to Unicode code points

¯128+ subtract 128 to get -128 ≤ n ≤ 127

¯2(219⌶) un-zlib

⎕UCS convert Unicode code points to string

The source string is the following 365 bytes of zlib'ed Unicode code points:

```<code>F8 5A FD D3 C1 EE 04 B0 8C FC C1 7E 60 DB AF 91 DF 28 34 D5 2B D6 6A E1 EF 15 76 96 58 F4 09 B6 44 11 93 04 68 6B EB A0 A9 94 34 B9 10 98 0F B3 60 4C 78 0C D6 91 1C 34 A2 89 67 CD BC 34 AA 42 95 E1 44 9E DA 4E BC 0B 0F F9 87 85 56 20 83 C2 C5 46 5D 40 B8 68 C6 E0 20 92 62 13 81 89 4B DA B8 5F 9A 6F 51 E3 D4 DD 9F A0 B8 24 38 A7 FA 5F D4 C8 78 7F D6 A0 7E 36 2A E3 AA 64 20 BF F0 3E A5 D0 42 9A 95 38 FE F4 CD 8A 78 99 77 C4 17 89 11 10 36 82 C5 0D 8A 9A F4 A1 12 E9 A2 92 77 9D 42 1E 6C 44 B5 AF EB 0D 04 C3 62 71 87 9C E8 2B FD 2B DC 04 C8 FD 67 75 21 67 57 04 CB D8 23 12 30 9A 3D 22 AB EB 22 48 9E 44 DD C0 56 B7 87 85 A6 2F D5 03 4D 9D C6 ED 7D 1E 68 3C E0 EC 37 9C 94 08 86 E5 09 DD D2 EB EB F1 58 B3 FD 4D 20 04 3C 17 64 C4 3C EB 6D B5 F1 11 89 71 50 5D A5 63 AC 6C 9A BE A4 EC DA E3 2F 24 DD D5 71 D9 DE EE 04 43 4C E9 4D DD CF 7D 4F 13 D4 CF 13 A4 72 24 A4 E8 1A 9E A9 7E EC 1F 32 5B 19 10 A2 7B B7 01 59 57 D2 E4 BF A6 E0 B6 29 94 59 D8 A9 3B 73 1D 94 9B F7 AC A5 2B F3 26 BF C9 E2 67 7F CB 72 0A 2C DD EE A9 29 A5 D6 AD 92 32 E8 B4 DD C5 64 7B FA 8A 4B 35 AD B7 D5 7D 82 0F FD 1 DA
</code>```

Title: Polar Bear, Polar Bear, what do you hear?

Body:
Dyalog APL, 387 bytes

⎕UCS¯2(219⌶)¯128+⎕UCS'øZýÓÁî°üÁ~`Û¯ß(4Õ+ÖjáïvXô ¶Dhkë ©4¹³`LxÖ4¢gÍ¼4ªBáDÚN¼ùV ÂÅF]@¸hÆà bKÚ¸_oQãÔÝ ¸$8§ú_ÔÈxÖ ~6*ãªd ¿ð>¥ÐB8þôÍxwÄ6Å
ô¡é¢wBlDµ¯ë
Ãbqè+ý+ÜÈýgu!gWËØ#0="«ë"HDÝÀV·¦/ÕMÆí}h<àì7å ÝÒëëñX³ýM <dÄ<ëmµñqP]¥c¬l¾¤ìÚã/$ÝÕqÙÞîCLéMÝÏ}OÔÏ¤r$¤è©~ì2[¢{·YWÒä¿¦à¶)YØ©;s÷¬¥+ó&¿ÉâgËr
,Ýî©)¥Ö2è´ÝÅd{úK5·Õ}ýÚ'

To ease reading: ⎕UCS¯2(219⌶)¯128+⎕UCS'...'

⎕UCS '...' convert string to Unicode code points

¯128+ subtract 128 to get -128 ≤ n ≤ 127

¯2(219⌶) un-zlib

⎕UCS convert Unicode code points to string

The source string is the following 365 bytes of zlib'ed Unicode code points:

F8 5A FD D3 C1 EE 04 B0 8C FC C1 7E 60 DB AF 91 DF 28 34 D5 2B D6 6A E1 EF 15 76 96 58 F4 09 B6 44 11 93 04 68 6B EB A0 A9 94 34 B9 10 98 0F B3 60 4C 78 0C D6 91 1C 34 A2 89 67 CD BC 34 AA 42 95 E1 44 9E DA 4E BC 0B 0F F9 87 85 56 20 83 C2 C5 46 5D 40 B8 68 C6 E0 20 92 62 13 81 89 4B DA B8 5F 9A 6F 51 E3 D4 DD 9F A0 B8 24 38 A7 FA 5F D4 C8 78 7F D6 A0 7E 36 2A E3 AA 64 20 BF F0 3E A5 D0 42 9A 95 38 FE F4 CD 8A 78 99 77 C4 17 89 11 10 36 82 C5 0D 8A 9A F4 A1 12 E9 A2 92 77 9D 42 1E 6C 44 B5 AF EB 0D 04 C3 62 71 87 9C E8 2B FD 2B DC 04 C8 FD 67 75 21 67 57 04 CB D8 23 12 30 9A 3D 22 AB EB 22 48 9E 44 DD C0 56 B7 87 85 A6 2F D5 03 4D 9D C6 ED 7D 1E 68 3C E0 EC 37 9C 94 08 86 E5 09 DD D2 EB EB F1 58 B3 FD 4D 20 04 3C 17 64 C4 3C EB 6D B5 F1 11 89 71 50 5D A5 63 AC 6C 9A BE A4 EC DA E3 2F 24 DD D5 71 D9 DE EE 04 43 4C E9 4D DD CF 7D 4F 13 D4 CF 13 A4 72 24 A4 E8 1A 9E A9 7E EC 1F 32 5B 19 10 A2 7B B7 01 59 57 D2 E4 BF A6 E0 B6 29 94 59 D8 A9 3B 73 1D 94 9B F7 AC A5 2B F3 26 BF C9 E2 67 7F CB 72 0A 2C DD EE A9 29 A5 D6 AD 92 32 E8 B4 DD C5 64 7B FA 8A 4B 35 AD B7 D5 7D 82 0F FD 1 DA


问:
Visualize a Difference Pyramid
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array

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

Now, we arrange these in a diagonal column:

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

Now, we fill in the next diagonal. The absolute differences between the consecutive elements of this array are:

```<code>3 1 5 6 1
</code>```

So that is our next diagonal.

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

Repeat until the pyramid is filled in:

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

The Challenge

Given a list of positive integers in the range [0, 9], generate this ASCII-art representation of the difference pyramid for that particular array. The input is guaranteed to contain at least two elements. You may take these numbers in any reasonable format. (Array/list/whatever you call it, a string, command line arguments, etc.) Trailing spaces on each line and up to one trailing newline are allowed.

Test IO

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

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

[4, 7]

 4
3 7

[3, 3, 3]

  3
 0 3
0 0 3

[1, 3, 6, 3, 4, 9]

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

[8, 7, 3, 2, 4, 5, 9, 1, 6]

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

As usual, this is code-golf, so standard loopholes apply, and shortest answer in bytes wins!

Inspired by this OEIS and this conjecture.

答:
J, <s>46</s> <s>42</s> <s>39</s> 36 bytes

```<code>(#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]
</code>```

A straight-forward implementation. Generates a table of successive differences between each pair and repeats it a number of times equal to the length of the input array. Then traverses each diagonal of that table to form the rows of the triangle. The rest is formatting the rows into a pyramid.

Usage

```<code>   f =: (#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]
   f 2 5 4 9 3 4
     2
    3 5
   2 1 4
  2 4 5 9
 1 3 1 6 3
0 1 4 5 1 4
   f 4 7
 4
3 7
   f 8 7 3 2 4 5 9 1 6
        8
       1 7
      3 4 3
     0 3 1 2
    2 2 1 2 4
   0 2 0 1 1 5
  0 0 2 2 3 4 9
 1 1 1 1 1 4 8 1
0 1 0 1 0 1 3 5 6
</code>```

Explanation

```<code>(#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]  Input: list A
                         #            Get len(A)
                       <@             Box it
                                   ]  Get A
                          2&(     )   Repeat len(A) times on A initially
                          2      \      Get each iverlapping sublist of size 2
                                /       Reduce it using
                             |@-          The absolute value of the difference

                                      This will form a table where each row contains the
                                      successive differences
              [:     /.               Operate on the diagonals of that table
                   |.                 Reverse each diagonal
                ":@                   Format each into a string
           #                          Get len(A)
            {.                        Take that many from the strings of diagonals
 #\                                   Get the length of each prefix of A
                                      Makes the range [1, 2, ..., len(A)]
    #                                 Get len(A)
   -                                  Subtract the len(A) from each in the prefix range
                                      Makes [-len(A)+1, ..., -1, 0]
      |."_1                           Rotate each string left using each value
                                      A negative rotate left = rotate right
                                      Output the pyramid
</code>```

Title: Visualize a Difference Pyramid

Body:
J, <s>46</s> <s>42</s> <s>39</s> 36 bytes

(#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]

A straight-forward implementation. Generates a table of successive differences between each pair and repeats it a number of times equal to the length of the input array. Then traverses each diagonal of that table to form the rows of the triangle. The rest is formatting the rows into a pyramid.

Usage

   f =: (#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]
   f 2 5 4 9 3 4
     2
    3 5
   2 1 4
  2 4 5 9
 1 3 1 6 3
0 1 4 5 1 4
   f 4 7
 4
3 7
   f 8 7 3 2 4 5 9 1 6
        8
       1 7
      3 4 3
     0 3 1 2
    2 2 1 2 4
   0 2 0 1 1 5
  0 0 2 2 3 4 9
 1 1 1 1 1 4 8 1
0 1 0 1 0 1 3 5 6

Explanation

(#\-#)|."_1#{.[:":@|./.<@#2&(|@-/\)]  Input: list A
                         #            Get len(A)
                       <@             Box it
                                   ]  Get A
                          2&(     )   Repeat len(A) times on A initially
                          2      \      Get each iverlapping sublist of size 2
                                /       Reduce it using
                             |@-          The absolute value of the difference

                                      This will form a table where each row contains the
                                      successive differences
              [:     /.               Operate on the diagonals of that table
                   |.                 Reverse each diagonal
                ":@                   Format each into a string
           #                          Get len(A)
            {.                        Take that many from the strings of diagonals
 #\                                   Get the length of each prefix of A
                                      Makes the range [1, 2, ..., len(A)]
    #                                 Get len(A)
   -                                  Subtract the len(A) from each in the prefix range
                                      Makes [-len(A)+1, ..., -1, 0]
      |."_1                           Rotate each string left using each value
                                      A negative rotate left = rotate right
                                      Output the pyramid


答:
Python 2, 59 bytes

x,y,A,a,b,n=input()
exec'A+=a*A[-x]+b*A[-y],;'*n
print A[n]
```

Test it on Ideone.

Title: Binary Recurrence Sequences

Body:
A binary recurrence sequence is a recursively-defined sequence of the following form:

$$F(1) = a_1 \\ \vdots \\ F(y) = a_y \\
F(n) = \alpha F(n-x) + \beta F(n-y), n > y$$

This is a generalization of the Fibonacci (\$x = 1, y = 2, a = [1, 1], \alpha = 1, \beta = 1\$) sequence and the Lucas (\$x = 1, y = 2, a = [2, 1], \alpha = 1, \beta = 1\$) sequence.

The Challenge

Given \$n, x, y, a, \alpha\$, and \$\beta\$, in any reasonable format, output the \$n\$th term of the corresponding binary recurrence sequence.

Rules

You may choose for the sequence to be either 1-indexed or 0-indexed, but your choice must be consistent across all inputs, and you must make note of your choice in your answer.

You may assume that no invalid inputs would be given (such as a sequence that terminates prior to \$n\$, or a sequence that references undefined terms, like \$F(-1)\$ or \$F(k)\$ where \$k > n\$). As a result of this, \$x\$ and \$y\$ will always be positive.

The inputs and outputs will always be integers, within the boundaries of your language's natural integer type. If your language has unbounded integers, the inputs and outputs will be within the range \$[-2^{31}, 2^{31}-1]\$ (i.e. the range for a 32-bit signed two's complement integer).

\$a\$ will always contain exactly \$y\$ values (as per the definition).

Test Cases

Note: all test cases are 0-indexed.

```<code>x = 1, y = 2, a = [1, 1], alpha = 1, beta = 1, n = 6 => 13
x = 1, y = 2, a = [2, 1], alpha = 1, beta = 1, n = 8 => 47
x = 3, y = 5, a = [2, 3, 5, 7, 11], alpha = 2, beta = 3, n = 8 => 53
x = 1, y = 3, a = [-5, 2, 3], alpha = 1, beta = 2, n = 10 => -67
x = 5, y = 7, a = [-5, 2, 3, -7, -8, 1, -9], alpha = -10, beta = -7, n = 10 => 39
</code>```

Body:
Python 2, 59 bytes

x,y,A,a,b,n=input()
exec'A+=a*A[-x]+b*A[-y],;'*n
print A[n]

Test it on Ideone.


Title: Visualize a Difference Pyramid

Body:
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array

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

Now, we arrange these in a diagonal column:

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

Now, we fill in the next diagonal. The absolute differences between the consecutive elements of this array are:

```<code>3 1 5 6 1
</code>```

So that is our next diagonal.

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

Repeat until the pyramid is filled in:

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

The Challenge

Given a list of positive integers in the range [0, 9], generate this ASCII-art representation of the difference pyramid for that particular array. The input is guaranteed to contain at least two elements. You may take these numbers in any reasonable format. (Array/list/whatever you call it, a string, command line arguments, etc.) Trailing spaces on each line and up to one trailing newline are allowed.

Test IO

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

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

[4, 7]

 4
3 7

[3, 3, 3]

  3
 0 3
0 0 3

[1, 3, 6, 3, 4, 9]

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

[8, 7, 3, 2, 4, 5, 9, 1, 6]

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

As usual, this is code-golf, so standard loopholes apply, and shortest answer in bytes wins!

Inspired by this OEIS and this conjecture.

Body:
Jelly, 16 bytes

IA$ṖÐ¿UṚz”@ṚGḟ”@

Try it online!

Background

Generating the differences is quite straightforward. For input

[1, 2, 3, 4, 5, 6, 7, 8, 9]

IA$ṖÐ¿ (absolute value of increments while there is more than one element) yields the following ragged 2D array.

[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 1, 1, 1, 1, 1, 1, 1]
[0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0]
[0, 0, 0]
[0, 0]
[0]

U reverses the order of the columns and Ṛ the order of the rows, yielding the following.

[0]
[0, 0]
[0, 0, 0]
[0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0]
[1, 1, 1, 1, 1, 1, 1, 1]
[9, 8, 7, 6, 5, 4, 3, 2, 1]

Now, we transpose rows and columns with z”@, which pads all rows to the same length before transposing. The result is the following.

[0, 0, 0, 0, 0, 0, 0, 1, 9]
[@, 0, 0, 0, 0, 0, 0, 1, 8]
[@, @, 0, 0, 0, 0, 0, 1, 7]
[@, @, @, 0, 0, 0, 0, 1, 6]
[@, @, @, @, 0, 0, 0, 1, 5]
[@, @, @, @, @, 0, 0, 1, 4]
[@, @, @, @, @, @, 0, 1, 3]
[@, @, @, @, @, @, @, 1, 2]
[@, @, @, @, @, @, @, @, 1]

Reversing the rows gives

[@, @, @, @, @, @, @, @, 1]
[@, @, @, @, @, @, @, 1, 2]
[@, @, @, @, @, @, 0, 1, 3]
[@, @, @, @, @, 0, 0, 1, 4]
[@, @, @, @, 0, 0, 0, 1, 5]
[@, @, @, 0, 0, 0, 0, 1, 6]
[@, @, 0, 0, 0, 0, 0, 1, 7]
[@, 0, 0, 0, 0, 0, 0, 1, 8]
[0, 0, 0, 0, 0, 0, 0, 1, 9]

To turn the 2D array into a whitespace-separated string, we use the built-in grid atom (G). It joins columns by spaces and rows by linefeeds, yielding the following result.

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

All that's left to do is removing the padding character with ḟ”@, yielding

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

which is the desired output.


答:
Pyth - 427 384 Bytes

```<code>=G"1, 1, what do you hear?\nI hear a 2 in my ear.\n"=Hc"growling/Polar Bear/roaring/Lion/snorting/Hippopotamus/fluting/Flamingo/braying/Zebra/hissing/Boa Constrictor/trumpeting/Elephant/snarling/Leopard/yelping/Peacock/bellowing/Walrus/whistling/Zookeeper"\/FNT
::G\1@H+yN1\2++r@H+yN3Zd@H+yN2)p+::G"I(.|\n)*"k\1@H20"I hear children...\n\n..."FN9
::"1 like a 2,"\1@HyN\2r@H+yN1Z)p"bellowing like a walrus...\nthat's what I hear.
</code>```

```<code>J"%s, %s, what do you hear?"K"I hear a%sing in my ear.\n"=Hc"Polar Bear/roar/Lion/snort/Hippopotamus/flut/Flamingo/bray/Zebra/hiss/Boa Constrictor/trumpet/Elephant/snarl/Leopard/yelp/Peacock/bellow/Walrus/whistl/Zookeeper/growl"\/FN11
%J*2[@HyN)?qNT"I hear children...\n"%Kjd[?qN5\nkr@H+yN2Z@HhyN))p"..."FN9
+%=J"%sing like a%s"[@HtyN+?qN5\nk+dr@HyNZ)?qN8"..."\,)
"that's what I hear"
</code>```

Try it here - permalink

Body:
Pyth - 427 384 Bytes

=G"1, 1, what do you hear?\nI hear a 2 in my ear.\n"=Hc"growling/Polar Bear/roaring/Lion/snorting/Hippopotamus/fluting/Flamingo/braying/Zebra/hissing/Boa Constrictor/trumpeting/Elephant/snarling/Leopard/yelping/Peacock/bellowing/Walrus/whistling/Zookeeper"\/FNT
::G\1@H+yN1\2++r@H+yN3Zd@H+yN2)p+::G"I(.|\n)*"k\1@H20"I hear children...\n\n..."FN9
::"1 like a 2,"\1@HyN\2r@H+yN1Z)p"bellowing like a walrus...\nthat's what I hear.

J"%s, %s, what do you hear?"K"I hear a%sing in my ear.\n"=Hc"Polar Bear/roar/Lion/snort/Hippopotamus/flut/Flamingo/bray/Zebra/hiss/Boa Constrictor/trumpet/Elephant/snarl/Leopard/yelp/Peacock/bellow/Walrus/whistl/Zookeeper/growl"\/FN11
%J*2[@HyN)?qNT"I hear children...\n"%Kjd[?qN5\nkr@H+yN2Z@HhyN))p"..."FN9
+%=J"%sing like a%s"[@HtyN+?qN5\nk+dr@HyNZ)?qN8"..."\,)
"that's what I hear"

Try it here - <a href="http://pyth.herokuapp.com/?code=J%22%25s%2C+%25s%2C+what+do+you+hear%3F%22K%22I+hear+a%25sing+in+my+ear.%5Cn%22%3DHc%22Polar+Bear%2Froar%2FLion%2Fsnort%2FHippopotamus%2Fflut%2FFlamingo%2Fbray%2FZebra%2Fhiss%2FBoa+Constrictor%2Ftrumpet%2FElephant%2Fsnarl%2FLeopard%2Fyelp%2FPeacock%2Fbellow%2FWalrus%2Fwhistl%2FZookeeper%2Fgrowl%22%5C%2FFN11%0A%25J%2a2%5B%40HyN%29%3FqNT%22I+hear+children...%5Cn%22%25Kjd%5B%3FqN5%5Cnkr%40H%2ByN2Z%40HhyN%29%29p%22...%22FN9%0A%2B%25%3DJ%22%25sing+like+a%25s%22%5B%40HtyN%2B%3FqN5%5Cnk%2Bdr%40HyNZ%29%3FqN8%22...%22%5C%2C%29%0A%22that%27s+what+I+hear%22&debug=0" rel="nofollow">permalink


答:
CJam, 29 bytes

```<code>q~{_2ew::-:z}h]W%zzeeSff*W%N*
</code>```

Try it online! (The first and last line enable a linefeed-separated test suite.)

This uses the triangle-rotation and layouting code from this answer and the triangle itself is generated with the same principle as in this answer.

Title: Visualize a Difference Pyramid

Body:
CJam, 29 bytes

q~{_2ew::-:z}h]W%zzeeSff*W%N*

Try it online! (The first and last line enable a linefeed-separated test suite.)

This uses the triangle-rotation and layouting code from this answer and the triangle itself is generated with the same principle as in this answer.


问:
Select the word around the given index in a given string
In Windows, when you perform double-click in a text, the word around your cursor in the text will be selected.

(This feature has more complicated properties, but they will not be required to be implemented for this challenge.)

For example, let | be your cursor in abc de|f ghi.

Then, when you double click, the substring def will be selected.

Input/Output

You will be given two inputs: a string and an integer.

Your task is to return the word-substring of the string around the index specified by the integer.

Your cursor can be right before or right after the character in the string at the index specified.

If you use right before, please specify in your answer.

Specifications (Specs)

The index is guaranteed to be inside a word, so no edge cases like abc |def ghi or abc def| ghi.

The string will only contain printable ASCII characters (from U+0020 to U+007E).

The word "word" is defined by the regex (?<!\w)\w+(?!\w), where \w is defined by [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], or "alphanumeric characters in ASCII including underscore".

The index can be 1-indexed or 0-indexed.

If you use 0-indexed, please specify it in your answer.

Testcases

The testcases are 1-indexed, and the cursor is right after the index specified.

The cursor position is for demonstration purpose only, which will not be required to be outputted.

```<code>string    index     output    cursor position
abc def   2         abc       ab|c def
abc def   5         def       abc d|ef
abc abc   2         abc       ab|c abc
ab cd ef  4         cd        ab c|d ef
ab   cd   6         cd        ab   c|d
ab!cd     1         ab        a|b!cd
</code>```

答:
Lua, <s>71</s> 67 Bytes

Woohoo, Lua isn't the longest solution! Still one byte behind python, but don't know how to golf this down. Indexes are 1-based.

Thanks to @LeakyNun reminding me the existence of string.match, saved 4 bytes

g,h=...print(g:sub(1,h):match"[%a_]*$"..g:sub(h+1):match("[%a_]+"))
```

<h3>Old 71</h3>

<p><strong>Note: the explanations are still based on this one, because it also applies to the new one, but contains some extra informations on <code>gmatch</code></strong></p>

<pre class="lang-lua prettyprint-override"><code>g,h=...print(g:sub(1,h):gmatch"[%a_]*$"()..g:sub(h+1):gmatch"[%a_]*"())
</code>```

Explanation

First, we unpack the arguments into g and h because they are shorter than arg[x]

g,h=...
```

<p>Then, we construct our output, which is the concatanation of the part before the cursor and after it.</p>

<p>The first part of the string is </p>

<pre class="lang-lua prettyprint-override"><code>g:sub(1,h)
</code>```

We want to find the word at the end of this one, so we use the function string.gmatch

:gmatch"[%a_]*$"
```

<p>This pattern match <code>0..n</code> times the character set of alphabet+underscore at the end of the string. <code>gmatch</code> returns an iterator on its list of match in the form of a function (using the principle of closure), so we execute it once to get the first part of our word</p>

<pre class="lang-lua prettyprint-override"><code>g:sub(1,h):gmatch"[%a_]*$"()
</code>```

We get the second part of our word by the same way

g:sub(h+1):gmatch"[%a_]*"())
```

The only difference being we don't have to specify we want to match at the start of the string (using [^%a_]*), as it will be the match returned by the iterator when it's called the first time.

Body:
Lua, <s>71</s> 67 Bytes

Woohoo, Lua isn't the longest solution! Still one byte behind python, but don't know how to golf this down. Indexes are 1-based.

Thanks to @LeakyNun reminding me the existence of string.match, saved 4 bytes

g,h=...print(g:sub(1,h):match"[%a_]*$"..g:sub(h+1):match("[%a_]+"))

Old 71

Note: the explanations are still based on this one, because it also applies to the new one, but contains some extra informations on gmatch

g,h=...print(g:sub(1,h):gmatch"[%a_]*$"()..g:sub(h+1):gmatch"[%a_]*"())

Explanation

First, we unpack the arguments into g and h because they are shorter than arg[x]

g,h=...

Then, we construct our output, which is the concatanation of the part before the cursor and after it.

The first part of the string is

g:sub(1,h)

We want to find the word at the end of this one, so we use the function string.gmatch

:gmatch"[%a_]*$"

This pattern match 0..n times the character set of alphabet+underscore at the end of the string. gmatch returns an iterator on its list of match in the form of a function (using the principle of closure), so we execute it once to get the first part of our word

g:sub(1,h):gmatch"[%a_]*$"()

We get the second part of our word by the same way

g:sub(h+1):gmatch"[%a_]*"())

The only difference being we don't have to specify we want to match at the start of the string (using [^%a_]*), as it will be the match returned by the iterator when it's called the first time.


答:
Retina, 45 bytes

```<code>A`-
$
,;BliNClyde,INPiN
N
nky,
D`\w+,
.*;|,$

</code>```

The trailing linefeed is significant. Input and output are comma separated.

Try it online! (The first line enables a linefeed-separated test suite.)

Explanation

I did not expect to be able to show off Retina's latest addition (deduplication stages) so soon, but it's really helpful for this challenge. :)

Stage 1: Anti-Grep

```<code>A`-
</code>```

Anti-grep stages discard all lines that match the given regex. The regex is just - and the input is always a single line, so this discards all ghosts if the input contains Pac-Man.

Stage 2: Substitution

```<code>$
,;BliNClyde,INPiN
</code>```

This simply appends the fixed string ,;BliNClyde,INPiN. This will be the list of ghosts in the output after some clean-up.

Stage 3: Substitution

```<code>N
nky,
</code>```

Note that we've written the three *nky ghosts with an N in the previous stage (and omitted the comma after them), and we now expand this shorthand, which saves a couple of bytes. There is now a comma after every single ghost, and we've got the input ghosts and list of all ghosts separated by a semicolon.

Stage 3: Deduplication

```<code>D`\w+,
</code>```

This is the new part. Deduplication stages find all instances of the given regex and discard all matched substrings which are equal to an earlier matched substring. The regex simply matches all the ghosts, both in the input and in the list of potential outputs. If the input contains a ghost, then the same ghost will be matched again in the second list and is discarded. Otherwise, the ghost is matched for the first time in the second list and kept. So after this, the list after the semicolon is our desired output. All that's left is a bit of clean-up:

Stage 5: Substitution

```<code>.*;|,$

</code>```

We simply match everything up to the semicolon as well as the comma at the end of the string and remove them.

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:
Retina, 45 bytes

A`-
$
,;BliNClyde,INPiN
N
nky,
D`\w+,
.*;|,$

The trailing linefeed is significant. Input and output are comma separated.

Try it online! (The first line enables a linefeed-separated test suite.)

Explanation

I did not expect to be able to show off Retina's latest addition (deduplication stages) so soon, but it's really helpful for this challenge. :)

Stage 1: Anti-Grep

A`-

Anti-grep stages discard all lines that match the given regex. The regex is just - and the input is always a single line, so this discards all ghosts if the input contains Pac-Man.

Stage 2: Substitution

$
,;BliNClyde,INPiN

This simply appends the fixed string ,;BliNClyde,INPiN. This will be the list of ghosts in the output after some clean-up.

Stage 3: Substitution

N
nky,

Note that we've written the three *nky ghosts with an N in the previous stage (and omitted the comma after them), and we now expand this shorthand, which saves a couple of bytes. There is now a comma after every single ghost, and we've got the input ghosts and list of all ghosts separated by a semicolon.

Stage 3: Deduplication

D`\w+,

This is the new part. Deduplication stages find all instances of the given regex and discard all matched substrings which are equal to an earlier matched substring. The regex simply matches all the ghosts, both in the input and in the list of potential outputs. If the input contains a ghost, then the same ghost will be matched again in the second list and is discarded. Otherwise, the ghost is matched for the first time in the second list and kept. So after this, the list after the semicolon is our desired output. All that's left is a bit of clean-up:

Stage 5: Substitution

.*;|,$

We simply match everything up to the semicolon as well as the comma at the end of the string and remove them.


答:
Pascal (FPC),  <s>85</s> <s>83</s> 73 bytes

Just plain object pascal using a set of chars. Writing a full program instead of a procedure shaves off 2 bytes. Removing the program keyword shaves 10 more bytes.

var c:char;begin for c in['a'..'z','A'..'Z','0'..'9','_']do write(c);end.
```

Try it online!

Title: Print all alphanumeric characters plus underscore

Body:
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more:

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

When printing to stdout, an optional trailing newline after your output is permitted.

Built-in constants that contain 9 or more of the above characters are disallowed.

Shortest code in bytes wins.

This is a very simple challenge, which I believe will generate some interesting answers nevertheless.

Leaderboards

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

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

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

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

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

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

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

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

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

var QUESTION_ID=85666,OVERRIDE_USER=4162;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;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:
Pascal (FPC),  <s>85</s> <s>83</s> 73 bytes

Just plain object pascal using a set of chars. Writing a full program instead of a procedure shaves off 2 bytes. Removing the program keyword shaves 10 more bytes.

var c:char;begin for c in['a'..'z','A'..'Z','0'..'9','_']do write(c);end.

Try it online!


答:
J, 43 bytes

```<code>{:{](],(2>@{[)+/ .*]{~1-@>@{[)^:(3>@{[)>@{.
</code>```

Given an initial sequence of terms A, computes the next term n times using the parameters of x, y, α, and β. Afterwards, it selects the nth term in the extended sequence and outputs it as the result.

Usage

Since J only supports 1 or 2 arguments, I group up all the parameters as a list of boxed lists. The initial seed values A are first, followed by the parameters of x and y as a list, followed by the parameters of α and β as a list, and ending with the value n.

```<code>   f =: {:{](],(2>@{[)+/ .*]{~1-@>@{[)^:(3>@{[)>@{.
   2 3 5 7 11;3 5;2 3;8
┌──────────┬───┬───┬─┐
│2 3 5 7 11│3 5│2 3│8│
└──────────┴───┴───┴─┘
   f 2 3 5 7 11;3 5;2 3;8
53
   f _5 2 3 _7 _8 1 _9;5 7;_10 _7;10
39
</code>```

Title: Binary Recurrence Sequences

Body:
J, 43 bytes

{:{](],(2>@{[)+/ .*]{~1-@>@{[)^:(3>@{[)>@{.

Given an initial sequence of terms A, computes the next term n times using the parameters of x, y, α, and β. Afterwards, it selects the nth term in the extended sequence and outputs it as the result.

Usage

Since J only supports 1 or 2 arguments, I group up all the parameters as a list of boxed lists. The initial seed values A are first, followed by the parameters of x and y as a list, followed by the parameters of α and β as a list, and ending with the value n.

   f =: {:{](],(2>@{[)+/ .*]{~1-@>@{[)^:(3>@{[)>@{.
   2 3 5 7 11;3 5;2 3;8
┌──────────┬───┬───┬─┐
│2 3 5 7 11│3 5│2 3│8│
└──────────┴───┴───┴─┘
   f 2 3 5 7 11;3 5;2 3;8
53
   f _5 2 3 _7 _8 1 _9;5 7;_10 _7;10
39


Title: Binary Recurrence Sequences

Body:
Haskell, <s>54</s> 48 bytes

l@(x,y,a,p,q)%n|n<y=a!!n|k<-(n-)=p*l%k x+q*l%k y


问:
Sum It Up with a Digital Triangle
Well, sum it down really.

Write a program or function that takes in a nonempty list of decimal integers (0-9) and outputs a downward pointing "triangle" of digits with the input list at the top where every digit after the first line is the sum of the two digits above it modulo 10.

For example, the input [7, 5, 0, 9] has output

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

because 2 is (7 + 5) mod 10, 5 is (5 + 0) mod 10, 9 is (0 + 9) mod 10, etc. all the way to 1 being (7 + 4) mod 10.

If the list has only one item, then the output matches the input; e.g. an input of [4] will yield

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

Here are some additional examples:

```<code>[0]

0

[1, 2]

1 2
 3

[8, 7]

8 7
 5

[0, 0]

0 0
 0

[1, 4, 2]

1 4 2
 5 6
  1

[0, 1, 0]

0 1 0
 1 1
  2

[1, 0, 0, 0]

1 0 0 0
 1 0 0
  1 0
   1

[1, 2, 3, 4]

1 2 3 4
 3 5 7
  8 2
   0

[1, 2, 3, 5, 8]

1 2 3 5 8
 3 5 8 3
  8 3 1
   1 4
    5

[9, 2, 4, 5, 3, 2, 2]

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

Note that in the output:

The first line does not have leading spaces.

Each subsequent line has one more leading space than the line previous.

Digits are separated by a single space.

Each line is allowed to have up to one trailing space.

There may be a single optional trailing newline.

You must use the characters for normal decimal digits (0 through 9).

The shortest code in bytes wins. Tiebreaker is earlier answer.

Title: Sum It Up with a Digital Triangle

Body:
J, 44 bytes

(#\.-#)|."_1#\.(":@{."_1)2(10|+/)\^:(]i.@#)]

Based on this solution.


答:
Emacs Lisp, 576 (621) bytes

```<code>(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))
</code>```

When fixing "an elephant", it takes slightly longer:

```<code>(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a"(and(string-match-p"^[aeiou]"(nth j a))"n")" %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))
</code>```

Ungolfed:

```<code>(let* ((animals '("polar bear"
                  "lion"
                  "hippopotamus"
                  "flamingo"
                  "zebra"
                  "boa constrictor"
                  "elephant"
                  "leopard"
                  "peacock"
                  "walrus"
                  "zookeeper"))
       (l (length animals))
       (m(- l 1))
       (sounds '("growl"
                 "roar"
                 "snort"
                 "flut"
                 "bray"
                 "hiss"
                 "trumpet"
                 "snarl"
                 "yelp"
                 "bellow"
                 "whistl")))
  (dotimes (i l)
    (message "%s, what do you hear?"
             (let ((animal (capitalize (nth i animals))))
               (concat animal ", " animal)))
    (if (not (eq i m))
        (message "I hear a %s %sing in my ear.\n"
                 (nth (1+ i) animals)
                 (nth (1+ i) sounds))
      (message "I hear children...\n")
      (dotimes (j m)
        (message
         (concat
          (when (eq j 0) "...")
          "%sing like a"
          (and (string-match-p"^[aeiou]" (nth j animals)) "n")
          " %s"
          (if (eq (1+ j) m) "..." ","))
         (nth j sounds )
         (nth j animals)))
      (message"That's what I hear."))))
</code>```

Body:
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>```

Body:
Emacs Lisp, 576 (621) bytes

(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))

When fixing "an elephant", it takes slightly longer:

(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a"(and(string-match-p"^[aeiou]"(nth j a))"n")" %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))

Ungolfed:

(let* ((animals '("polar bear"
                  "lion"
                  "hippopotamus"
                  "flamingo"
                  "zebra"
                  "boa constrictor"
                  "elephant"
                  "leopard"
                  "peacock"
                  "walrus"
                  "zookeeper"))
       (l (length animals))
       (m(- l 1))
       (sounds '("growl"
                 "roar"
                 "snort"
                 "flut"
                 "bray"
                 "hiss"
                 "trumpet"
                 "snarl"
                 "yelp"
                 "bellow"
                 "whistl")))
  (dotimes (i l)
    (message "%s, what do you hear?"
             (let ((animal (capitalize (nth i animals))))
               (concat animal ", " animal)))
    (if (not (eq i m))
        (message "I hear a %s %sing in my ear.\n"
                 (nth (1+ i) animals)
                 (nth (1+ i) sounds))
      (message "I hear children...\n")
      (dotimes (j m)
        (message
         (concat
          (when (eq j 0) "...")
          "%sing like a"
          (and (string-match-p"^[aeiou]" (nth j animals)) "n")
          " %s"
          (if (eq (1+ j) m) "..." ","))
         (nth j sounds )
         (nth j animals)))
      (message"That's what I hear."))))


答:
Pyth, 16 bytes

```<code>+e=:.<+QbE"\W"3h

       Q            first input (string)
      + b           plus newline
    .<   E          rotate left by second input (number)
   :      "\W"3     split on regex \W, non-word characters
  =                 assign to Q
 e                  last element
+              hQ   plus first element
</code>```

Try it online

Title: Select the word around the given index in a given string

Body:
In Windows, when you perform double-click in a text, the word around your cursor in the text will be selected.

(This feature has more complicated properties, but they will not be required to be implemented for this challenge.)

For example, let | be your cursor in abc de|f ghi.

Then, when you double click, the substring def will be selected.

Input/Output

You will be given two inputs: a string and an integer.

Your task is to return the word-substring of the string around the index specified by the integer.

Your cursor can be right before or right after the character in the string at the index specified.

If you use right before, please specify in your answer.

Specifications (Specs)

The index is guaranteed to be inside a word, so no edge cases like abc |def ghi or abc def| ghi.

The string will only contain printable ASCII characters (from U+0020 to U+007E).

The word "word" is defined by the regex (?<!\w)\w+(?!\w), where \w is defined by [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], or "alphanumeric characters in ASCII including underscore".

The index can be 1-indexed or 0-indexed.

If you use 0-indexed, please specify it in your answer.

Testcases

The testcases are 1-indexed, and the cursor is right after the index specified.

The cursor position is for demonstration purpose only, which will not be required to be outputted.

```<code>string    index     output    cursor position
abc def   2         abc       ab|c def
abc def   5         def       abc d|ef
abc abc   2         abc       ab|c abc
ab cd ef  4         cd        ab c|d ef
ab   cd   6         cd        ab   c|d
ab!cd     1         ab        a|b!cd
</code>```

Body:
Pyth, 16 bytes

+e=:.<+QbE"\W"3h

       Q            first input (string)
      + b           plus newline
    .<   E          rotate left by second input (number)
   :      "\W"3     split on regex \W, non-word characters
  =                 assign to Q
 e                  last element
+              hQ   plus first element

Try it online


问:
#Hashtag_or_not
In this code golf challenge, you will verify hashtags!

#What_your_code_should_do

Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise.

We define a string as a valid Hashtag if ...

It starts with a hash (#).

It doesn't have a number right after the hashtag (e.g. #2016USElection isn't a  valid hashtag).

It doesn't have any "special characters" (i.e. any character that isn't an alphabet, underscore (_) or a number).

You can assume that the input only contains ASCII characters. (It would be unfair if we did Unicode too.)

#Rules

Basic code-golf rules apply.

#Examples

Truthy:

```<code>#
#e
#_ABC
#thisisanunexpectedlylongstringxoxoxoxo
#USElection2016
</code>```

Falsy:

```<code>Hello, World!
#12thBday
#not-valid
#alsoNotValid!
#!not_a_hash
</code>```

答:
Lua, <s>59</s> <s>55</s> 54 bytes

Code

```<code>s=arg[1]print(load(s:sub(2).."=0")and s:sub(1,1)=="#")
</code>```

How it works:

Check if the rest of the characters can be a valud Lua identifier (identifiers in Lua follow the same rules as hashtags.)

Check if the first character is a #.

Takes input from the command line. Prints true if the string is a valid hashtag, otherwise, it prints nil.

Title: #Hashtag_or_not

Body:
Lua, <s>59</s> <s>55</s> 54 bytes

Code

s=arg[1]print(load(s:sub(2).."=0")and s:sub(1,1)=="#")

How it works:

Check if the rest of the characters can be a valud Lua identifier (identifiers in Lua follow the same rules as hashtags.)

Check if the first character is a #.

Takes input from the command line. Prints true if the string is a valid hashtag, otherwise, it prints nil.


答:
Ruby, <s>55</s> 49 bytes

Try it online!

-6 bytes from @MartinEnder

```<code>->a{%w"Blinky Inky Pinky Clyde"-(a*''=~/-/?[]:a)}
</code>```

Ruby arrays can undergo set subtraction, making it very easy to remove the appropriate ghosts.

Title: Which ghosts are missing?

Body:
Ruby, <s>55</s> 49 bytes

Try it online!

-6 bytes from @MartinEnder

->a{%w"Blinky Inky Pinky Clyde"-(a*''=~/-/?[]:a)}

Ruby arrays can undergo set subtraction, making it very easy to remove the appropriate ghosts.


答:
05AB1E, <s>47</s> 44 bytes

```<code>•1g!Z~÷kÅ]°%Ï0›K/•35B0¡™svy'-åi,q}}v¹ykÌiy)˜
</code>```

Explaination

```<code>•1g!Z~÷kÅ]°%Ï0›K/•35B0¡™                      # push list of the 4 ghosts
                        svy'-åi,q}}           # if Pac-Man is in input, quit and output list of all 4 ghosts
                                  v¹ykÌiy)˜   # otherwise, generate the list of ghosts missing from input
</code>```

Try it online

Title: Which ghosts are missing?

Body:
05AB1E, <s>47</s> 44 bytes

•1g!Z~÷kÅ]°%Ï0›K/•35B0¡™svy'-åi,q}}v¹ykÌiy)˜

Explaination

•1g!Z~÷kÅ]°%Ï0›K/•35B0¡™                      # push list of the 4 ghosts
                        svy'-åi,q}}           # if Pac-Man is in input, quit and output list of all 4 ghosts
                                  v¹ykÌiy)˜   # otherwise, generate the list of ghosts missing from input

Try it online


答:
PHP program, 84 bytes

```<code><?print_r(array_diff([Blinky,Inky,Pinky,Clyde],in_array('Pac-Man',$argv)?[]:$argv));
</code>```

takes arguments from command line, prints result as an array.

filename must not be any of the ghosts or 'Pac-Man'!

short breakdown: remove (if 'Pac-Man' is in arguments: nothing, else all arguments) from all ghosts; print result recursively

examples:

```<code>>php -d error_reporting=0 ghosts.php Clyde
Array
(
    [0] => Blinky
    [1] => Inky
    [2] => Pinky
)
>php -d error_reporting=0 ghosts.php Clyde Blinky
Array
(
    [0] => Inky
    [1] => Pinky
)
>php -d error_reporting=0 ghosts.php Pac-Man Clyde
Array
(
    [0] => Blinky
    [1] => Inky
    [2] => Pinky
    [3] => Clyde
)
</code>```

PHP function, 90 bytes

```<code>function p($a){return array_diff([Blinky,Inky,Pinky,Clyde],in_array('Pac-Man',$a)?[]:$a);}
</code>```

takes and returns an array, use empty array for empty input, no other falsy value!

further thoughts

replace in_array(...) with strstr(join($argv),'-') to detect - instead of Pac-Man (-2)

use ereg('-',join($argv)) instead (another -2)

program could lose another 6 bytes in PHP<5.4 with register_globals on

to make the program print a comma-separated list: replace <?print_r( with <?=join(',', (+2). You may want to add ;echo"" to the call for a line break

Title: Which ghosts are missing?

Body:
PHP program, 84 bytes

<?print_r(array_diff([Blinky,Inky,Pinky,Clyde],in_array('Pac-Man',$argv)?[]:$argv));

takes arguments from command line, prints result as an array.

filename must not be any of the ghosts or 'Pac-Man'!

short breakdown: remove (if 'Pac-Man' is in arguments: nothing, else all arguments) from all ghosts; print result recursively

examples:

>php -d error_reporting=0 ghosts.php Clyde
Array
(
    [0] => Blinky
    [1] => Inky
    [2] => Pinky
)
>php -d error_reporting=0 ghosts.php Clyde Blinky
Array
(
    [0] => Inky
    [1] => Pinky
)
>php -d error_reporting=0 ghosts.php Pac-Man Clyde
Array
(
    [0] => Blinky
    [1] => Inky
    [2] => Pinky
    [3] => Clyde
)

PHP function, 90 bytes

function p($a){return array_diff([Blinky,Inky,Pinky,Clyde],in_array('Pac-Man',$a)?[]:$a);}

takes and returns an array, use empty array for empty input, no other falsy value!

further thoughts

replace in_array(...) with strstr(join($argv),'-') to detect - instead of Pac-Man (-2)

use ereg('-',join($argv)) instead (another -2)

program could lose another 6 bytes in PHP<5.4 with register_globals on

to make the program print a comma-separated list: replace <?print_r( with <?=join(',', (+2). You may want to add ;echo"" to the call for a line break


答:
Perl, 51 bytes

50 bytes code + 1 for -n

for$@(Blinky,Inky,Pinky,Clyde){print$@if/-/|!/$@/}g}
```

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>perl -ne 'for$@(Blinky,Inky,Pinky,Clyde){print$@if/-/|!/$@/}' <<< 'Pac-Man, Clyde'
BlinkyInkyPinkyClyde
</code>```

I can amend the output if necessary, adding a space after each ghost, for + 3 bytes replacing print$@ with print"$@ ".

-6 bytes thanks to @MartinEnder!

Perl, 53 bytes

51 bytes code + 2 for -na

An alternative solution, using the smartmatch operator:

print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde
```

<h3>Usage</h3>

<p>Requires a space separated list of input:</p>

<pre class="lang-pl prettyprint-override"><code>perl -nae 'print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde' <<< 'Clyde Pinky Inky'
Blinky
perl -nae 'print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde' <<< 'Clyde Pinky Inky Pac-Man'
BlinkyInkyPinkyClyde'
</code>```

Title: Which ghosts are missing?

Body:
Perl, 51 bytes

50 bytes code + 1 for -n

for$@(Blinky,Inky,Pinky,Clyde){print$@if/-/|!/$@/}g}

Usage

perl -ne 'for$@(Blinky,Inky,Pinky,Clyde){print$@if/-/|!/$@/}' <<< 'Pac-Man, Clyde'
BlinkyInkyPinkyClyde

I can amend the output if necessary, adding a space after each ghost, for + 3 bytes replacing print$@ with print"$@ ".

-6 bytes thanks to @MartinEnder!

Perl, 53 bytes

51 bytes code + 2 for -na

An alternative solution, using the smartmatch operator:

print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde

Usage

Requires a space separated list of input:

perl -nae 'print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde' <<< 'Clyde Pinky Inky'
Blinky
perl -nae 'print grep/-/~~@F|!($_~~@F),Blinky,Inky,Pinky,Clyde' <<< 'Clyde Pinky Inky Pac-Man'
BlinkyInkyPinkyClyde'


答:
Ruby, <s>41</s> 31 bytes

Try it online!

-10 bytes from @MartinEnder

```<code>->s,i{s[/\w*(?<=^.{#{i}})\w*/]}
</code>```

Body:
Ruby, <s>41</s> 31 bytes

Try it online!

-10 bytes from @MartinEnder

->s,i{s[/\w*(?<=^.{#{i}})\w*/]}


答:
Pyth, 22 bytes

```<code>jmX-jN_Pd;N;_.t_M.uaVt
</code>```

Try it online!

Title: Visualize a Difference Pyramid

Body:
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array

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

Now, we arrange these in a diagonal column:

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

Now, we fill in the next diagonal. The absolute differences between the consecutive elements of this array are:

```<code>3 1 5 6 1
</code>```

So that is our next diagonal.

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

Repeat until the pyramid is filled in:

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

The Challenge

Given a list of positive integers in the range [0, 9], generate this ASCII-art representation of the difference pyramid for that particular array. The input is guaranteed to contain at least two elements. You may take these numbers in any reasonable format. (Array/list/whatever you call it, a string, command line arguments, etc.) Trailing spaces on each line and up to one trailing newline are allowed.

Test IO

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

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

[4, 7]

 4
3 7

[3, 3, 3]

  3
 0 3
0 0 3

[1, 3, 6, 3, 4, 9]

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

[8, 7, 3, 2, 4, 5, 9, 1, 6]

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

As usual, this is code-golf, so standard loopholes apply, and shortest answer in bytes wins!

Inspired by this OEIS and this conjecture.

Body:
Pyth, 22 bytes

jmX-jN_Pd;N;_.t_M.uaVt

Try it online!


答:
R 518 509 482 477 474 465 452 456 bytes

Link to R-Fiddle to try code

```<code>a=c("Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Constrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper")
b=c("...growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl")
d=c(rep("a ",6),"an ")
f=tolower(a)
cat(c(paste0(a,", ",a,", what do you hear?\nI hear ",c(paste0(d,f," ",b,"ing in my ear.")[-1],"children..."),"\n\n"),paste0(b,"ing like ",d,f,c(rep(",\n",9),"...\nthat's what I hear."))[-11]))
</code>```

Moved children out of the vector a, and got rid of corresponding entry in the d vector to save 8 bytes

More tidying up and removing of subscripts made redundant by moving children, saved further 27 bytes.

Globalised the tolower function, saved 5 bytes

Replace writeLines with cat and reformatted appropriately (added \n in places) saved 3 bytes

Realised that if d is only 7 elements not the full 11, R will just loop back to the start again. As 11 < 14 then this works for us. Saved 9 bytes.

globalised subscripts, saved 13 bytes.

cat function was separating with " ", changed back to writeLines. Added 4 bytes (cat can be fixed by adding    ,sep="" to the function)

Body:
R 518 509 482 477 474 465 452 456 bytes

Link to R-Fiddle to try code

a=c("Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Constrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper")
b=c("...growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl")
d=c(rep("a ",6),"an ")
f=tolower(a)
cat(c(paste0(a,", ",a,", what do you hear?\nI hear ",c(paste0(d,f," ",b,"ing in my ear.")[-1],"children..."),"\n\n"),paste0(b,"ing like ",d,f,c(rep(",\n",9),"...\nthat's what I hear."))[-11]))

Moved children out of the vector a, and got rid of corresponding entry in the d vector to save 8 bytes

More tidying up and removing of subscripts made redundant by moving children, saved further 27 bytes.

Globalised the tolower function, saved 5 bytes

Replace writeLines with cat and reformatted appropriately (added \n in places) saved 3 bytes

Realised that if d is only 7 elements not the full 11, R will just loop back to the start again. As 11 < 14 then this works for us. Saved 9 bytes.

globalised subscripts, saved 13 bytes.

cat function was separating with " ", changed back to writeLines. Added 4 bytes (cat can be fixed by adding    ,sep="" to the function)


答:
Python 3, 41 bytes

```<code>import re
re.compile('#(?!\d)\w*$').match
</code>```

Title: #Hashtag_or_not

Body:
In this code golf challenge, you will verify hashtags!

#What_your_code_should_do

Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise.

We define a string as a valid Hashtag if ...

It starts with a hash (#).

It doesn't have a number right after the hashtag (e.g. #2016USElection isn't a  valid hashtag).

It doesn't have any "special characters" (i.e. any character that isn't an alphabet, underscore (_) or a number).

You can assume that the input only contains ASCII characters. (It would be unfair if we did Unicode too.)

#Rules

Basic code-golf rules apply.

#Examples

Truthy:

```<code>#
#e
#_ABC
#thisisanunexpectedlylongstringxoxoxoxo
#USElection2016
</code>```

Falsy:

```<code>Hello, World!
#12thBday
#not-valid
#alsoNotValid!
#!not_a_hash
</code>```

Body:
Python 3, 41 bytes

import re
re.compile('#(?!\d)\w*$').match


Body:
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more:

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

When printing to stdout, an optional trailing newline after your output is permitted.

Built-in constants that contain 9 or more of the above characters are disallowed.

Shortest code in bytes wins.

This is a very simple challenge, which I believe will generate some interesting answers nevertheless.

Leaderboards

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

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

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

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

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

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

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

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

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

var QUESTION_ID=85666,OVERRIDE_USER=4162;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;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:
Golfscript, 18 bytes

10,123,65>'[\]^`'^


答:
Pyke, <s>45</s> <s>39</s> <s>38</s> <s>37</s> 32 bytes

```<code>.d膎㧫l4dc].^D`\-R{!*
</code>```

Try it here!

```<code>.d膎㧫l4dc - dictionary_lookup('blinky inky pinky clyde').title().split()
].^ - xor(^, input)
D`\-R{!* - ^*("-" not in input)
</code>```

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:
Pyke, <s>45</s> <s>39</s> <s>38</s> <s>37</s> 32 bytes

.d膎㧫l4dc].^D`\-R{!*

Try it here!

.d膎㧫l4dc - dictionary_lookup('blinky inky pinky clyde').title().split()
].^ - xor(^, input)
D`\-R{!* - ^*("-" not in input)