答:
JavaScript (ES6), 204 <s>229 238</s>

An anonymous function returning an array of strings

s=>[...s].map(v=>{T=(x,y)=>((r=[...c[y+z]||' '.repeat(z+z)])[z+x]=r[z-x]=v,c[z+y]=c[z-y]=r.join``);for(y=o-~o,o*=++i%2+1;y--;i%2?T(q,y):T(o,q,T(q,o)))q=y-o;++o},l=s.length,z=(2<<-~l/2)-3-l%2,c=[i=o=0])&&c
```
<p><em>Less golfed</em></p>
<pre class="lang-js prettyprint-override"><code>s=>(
  l = s.length,
  z = (2 << l/2 + .5) - 3 - l%2, // zero position, total width and height are z+z+1
  c = [], // output canvas
  o = 0, // base drawing offset from z
  [...s].map( (v, i) => {
    // execute for each char v at position i in input string
    // helper function to put current char v at position (z+y, z+x),(z+y,z-x),(z-y,z+x),(z-y,z-x)
    // as the image has vertical and horizontal symmetry
    T=(x,y) =>(
      r = [...c[y+z]||' '.repeat(z+z)]), // convert string to array to set char at given pos
      r[z+x] = v,
      r[z-x] = v,
      c[z+y] = c[z-y] = r.join`` // array to string again
    );
    // shorter than if(i%2) {for ...}else{for ...}
    // o is doubled at every other step
    //   and incremented (below) at each step
    for(y=o+o, i % 2 ? 0 : o=o*2; y >= 0; y--)
      q = y-o,
      i % 2 // even and odd steps have different shapes
        ? ( T(o,q), T(q,o))
        : T(q,y);
    ++o
  }),
  c
)
</code>```

Test

f=
s=>[...s].map(v=>{T=(x,y)=>((r=[...c[y+z]||' '.repeat(z+z)])[z+x]=r[z-x]=v,c[z+y]=c[z-y]=r.join``);for(y=o-~o,o*=++i%2+1;y--;i%2?T(q,y):T(o,q,T(q,o)))q=y-o;++o},l=s.length,z=(2<<-~l/2)-3-l%2,c=[i=o=0])&&c

function update()
{
  O.textContent=f(I.value).join`\n`
}

update()```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input id=I value=CodeGolf oninput='update()'>
<pre id=O>``````

Title: Square, diamond, square, diamond

Body:
Task

Given a non-empty string of lowercase ASCII letters a-z, take its first character, and:

Surround it with a square of copies of the second character,

Surround that with a diamond of copies of the third character,

Surround that with a square of copies of the fourth character…

…alternating between square and diamond borders until the end of the string. Empty space between the borders should be represented by ASCII spaces ().

To add a square border, draw a square exactly around the entire current “working array”:

```<code>                                               sssssssssss
                                t              s    t    s
                               t t             s   t t   s
                              t   t            s  t   t  s
                             t aaa t           s t aaa t s
                            t  aca  t    =>    st  aca  ts
                             t aaa t           s t aaa t s
                              t   t            s  t   t  s
                               t t             s   t t   s
                                t              s    t    s
                                               sssssssssss
</code>```

To add a diamond border, draw a centered diamond shape that touches the outermost square diagonally, but not orthogonally:

```<code>                                                     s
                                                    s s
                                                   s   s
                                                  s     s
                                                 s       s
                                                s         s
                                               s           s
                    wwwwwwwwwww               s wwwwwwwwwww s
                    w    o    w              s  w    o    w  s
                    w   o o   w             s   w   o o   w   s
                    w  o   o  w            s    w  o   o  w    s
                    w o eee o w           s     w o eee o w     s
                    wo  eme  ow    =>    s      wo  eme  ow      s
                    w o eee o w           s     w o eee o w     s
                    w  o   o  w            s    w  o   o  w    s
                    w   o o   w             s   w   o o   w   s
                    w    o    w              s  w    o    w  s
                    wwwwwwwwwww               s wwwwwwwwwww s
                                               s           s
                                                s         s
                                                 s       s
                                                  s     s
                                                   s   s
                                                    s s
                                                     s
</code>```

Your program must output the final array.

Each line may contain any amount of trailing spaces.

You may output a list of strings representing lines, or a single newline-separated string with an optional trailing newline.

Leading/trailing blank lines are disallowed.

Leading columns of spaces are also disallowed.

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

Test cases

The above examples are expected outputs for cat, cats, meow, and meows, in reading order. Some other cases worth handling:

For the input a, your program should output:

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

For the input ab, your program should output:

```<code>bbb
bab
bbb
</code>```

For the input codegolf, your program should output:

```<code>fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
f                            l                            f
f                           l l                           f
f                          l   l                          f
f                         l     l                         f
f                        l       l                        f
f                       l         l                       f
f                      l           l                      f
f                     l             l                     f
f                    l               l                    f
f                   l                 l                   f
f                  l                   l                  f
f                 l                     l                 f
f                l                       l                f
f               l                         l               f
f              l                           l              f
f             l ooooooooooooooooooooooooooo l             f
f            l  o            g            o  l            f
f           l   o           g g           o   l           f
f          l    o          g   g          o    l          f
f         l     o         g     g         o     l         f
f        l      o        g       g        o      l        f
f       l       o       g         g       o       l       f
f      l        o      g           g      o        l      f
f     l         o     g eeeeeeeeeee g     o         l     f
f    l          o    g  e    d    e  g    o          l    f
f   l           o   g   e   d d   e   g   o           l   f
f  l            o  g    e  d   d  e    g  o            l  f
f l             o g     e d ooo d e     g o             l f
fl              og      ed  oco  de      go              lf
f l             o g     e d ooo d e     g o             l f
f  l            o  g    e  d   d  e    g  o            l  f
f   l           o   g   e   d d   e   g   o           l   f
f    l          o    g  e    d    e  g    o          l    f
f     l         o     g eeeeeeeeeee g     o         l     f
f      l        o      g           g      o        l      f
f       l       o       g         g       o       l       f
f        l      o        g       g        o      l        f
f         l     o         g     g         o     l         f
f          l    o          g   g          o    l          f
f           l   o           g g           o   l           f
f            l  o            g            o  l            f
f             l ooooooooooooooooooooooooooo l             f
f              l                           l              f
f               l                         l               f
f                l                       l                f
f                 l                     l                 f
f                  l                   l                  f
f                   l                 l                   f
f                    l               l                    f
f                     l             l                     f
f                      l           l                      f
f                       l         l                       f
f                        l       l                        f
f                         l     l                         f
f                          l   l                          f
f                           l l                           f
f                            l                            f
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
</code>```

Reference implementation

I wrote some Julia code that your program’s output should match (at least visually). Try it online!

Body:
JavaScript (ES6), 204 <s>229 238</s>

An anonymous function returning an array of strings

s=>[...s].map(v=>{T=(x,y)=>((r=[...c[y+z]||' '.repeat(z+z)])[z+x]=r[z-x]=v,c[z+y]=c[z-y]=r.join``);for(y=o-~o,o*=++i%2+1;y--;i%2?T(q,y):T(o,q,T(q,o)))q=y-o;++o},l=s.length,z=(2<<-~l/2)-3-l%2,c=[i=o=0])&&c

Less golfed

s=>(
  l = s.length,
  z = (2 << l/2 + .5) - 3 - l%2, // zero position, total width and height are z+z+1
  c = [], // output canvas
  o = 0, // base drawing offset from z
  [...s].map( (v, i) => {
    // execute for each char v at position i in input string
    // helper function to put current char v at position (z+y, z+x),(z+y,z-x),(z-y,z+x),(z-y,z-x)
    // as the image has vertical and horizontal symmetry
    T=(x,y) =>(
      r = [...c[y+z]||' '.repeat(z+z)]), // convert string to array to set char at given pos
      r[z+x] = v,
      r[z-x] = v,
      c[z+y] = c[z-y] = r.join`` // array to string again
    );
    // shorter than if(i%2) {for ...}else{for ...}
    // o is doubled at every other step
    //   and incremented (below) at each step
    for(y=o+o, i % 2 ? 0 : o=o*2; y >= 0; y--)
      q = y-o,
      i % 2 // even and odd steps have different shapes
        ? ( T(o,q), T(q,o))
        : T(q,y);
    ++o
  }),
  c
)

Test

f=
s=>[...s].map(v=>{T=(x,y)=>((r=[...c[y+z]||' '.repeat(z+z)])[z+x]=r[z-x]=v,c[z+y]=c[z-y]=r.join``);for(y=o-~o,o*=++i%2+1;y--;i%2?T(q,y):T(o,q,T(q,o)))q=y-o;++o},l=s.length,z=(2<<-~l/2)-3-l%2,c=[i=o=0])&&c

function update()
{
  O.textContent=f(I.value).join`\n`
}

update()

<input id=I value=CodeGolf oninput='update()'>
<pre id=O></pre>


问:
Division of not so little numbers
Write a program or function that takes in positive integers a, b and c, and prints or returns a/b to c decimal places, using the operations +-*/% [add, subtract, multiply, divide, modulate] on the positive integers: you can use all that your language allows, but not on floating point numbers. The range of a,b,c would be the range allowed for unsigned integers in your language.
The number result will be truncated to the last digit to print (so no round).

This means that if your language does not have an integer type (only float), you can participate by using these float numbers as positive integers only.
The clue of this exercise it would be to write the function that find the
digits in a float point division, using only the operation +-*/%  on
[unsigned] integers.

Examples

print(1,2,1) would print 0.5

print(1,2,2) would print 0.50

print(13,7,27) would print 1.857142857142857142857142857

print(2,3,1) would print 0.6

print(4,5,7) would print 0.8000000

print(4,5,1) would print 0.8

print(9999,23,1) would print 434.7

print(12345613,2321,89) would print if your Language has 32 bit unsigned 5319.09220163722533390779836277466609220163722533390779836277466609220163722533390779836277466

The shortest code in bytes wins. I'm sorry if this appear not clear... I don't know languages too, not remember words well...
It is better to have one link to Ideone.com or some other place for easily try the answer especially for to test some input different from proposed.

答:
PHP, 89 bytes

```<code>list(,$a,$b,$c)=$argv;for($o=intdiv($a,$b).'.';$c--;)$o.=intdiv($a=10*($a%$b),$b);echo$o;
</code>```

intdiv() is introduced in php 7 so it requires that. php 7.1 would allow me to change the list() to [] and so would save 4 bytes.

use like:

```<code>php -r "list(,$a,$b,$c)=$argv;for($o=intdiv($a,$b).'.';$c--;)$o.=intdiv($a=10*($a%$b),$b);echo$o;" 1 2 1
</code>```

ContentLicense: CC BY-SA 3.0

Title: Division of not so little numbers

Body:
PHP, 89 bytes

list(,$a,$b,$c)=$argv;for($o=intdiv($a,$b).'.';$c--;)$o.=intdiv($a=10*($a%$b),$b);echo$o;

intdiv() is introduced in php 7 so it requires that. php 7.1 would allow me to change the list() to [] and so would save 4 bytes.

use like:

php -r "list(,$a,$b,$c)=$argv;for($o=intdiv($a,$b).'.';$c--;)$o.=intdiv($a=10*($a%$b),$b);echo$o;" 1 2 1


问:
Sort a list of numbers
About Code-Bowling:

In golf, you try to get the lowest score (smallest application, most elegant, etc). In Bowling, you try to get the highest score. So if you follow, the goal of a Code-Bowling challenge is to make the biggest, most bastardized, hardest to maintain piece of code that still meets the requirements of the challenge. However, there's no point in making source longer just for the sake of it. It needs to seem like that added length was from design and not just padding.

The Challenge:

Create a program that sorts a list of numbers in ascending order.

Example:

Input: 1, 4, 7, 2, 5

Output: 1, 2, 4, 5, 7

Code: Obviously this wouldn't be a good answer, since there aren't many WTFs in there

```<code>function doSort(array $input) {
    sort($input);
    return $input;
}
</code>```

Rules:

There are no real rules.  As long as the program functions, have at it!

Remember: This is code-bowling, not golf.  The objective is to make the worst, most bastardized code that you can!  Bonus points for code that looks good, but is actually deceptively evil...

答:
C++, not sure if there is name for this sort, but here goes <ducks for cover/>

```<code>#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

int main(void)
{
  std::istream_iterator<int> in(std::cin), end;
  std::vector<int> input(in, end);

  std::cout << "sorting.." << std::endl;
  std::copy(input.begin(), input.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  // this is the smart bit.. ;)
  while (std::next_permutation (input.begin(), input.end()));

  std::cout << "sorted.." << std::endl;
  std::copy(input.begin(), input.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  return 0;
}
</code>```

ContentLicense: CC BY-SA 2.5

Title: Sort a list of numbers

Body:
C++, not sure if there is name for this sort, but here goes <ducks for cover/>

#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

int main(void)
{
  std::istream_iterator<int> in(std::cin), end;
  std::vector<int> input(in, end);

  std::cout << "sorting.." << std::endl;
  std::copy(input.begin(), input.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  // this is the smart bit.. ;)
  while (std::next_permutation (input.begin(), input.end()));

  std::cout << "sorted.." << std::endl;
  std::copy(input.begin(), input.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  return 0;
}


问:
EvenSt-ring C ode - g ol!f
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the characters are:

```<code>69 118 101 110 83 116 45 114 105 110 103 36 33
</code>```

And the parities of these numbers are:

```<code>Odd Even Odd Even Odd Even Odd Even Odd Even Odd Even Odd
</code>```

Which is alternating the whole way. However, a string like Hello world! is not an even string because the ASCII values are:

```<code>72 101 108 108 111 32 87 111 114 108 100 33
</code>```

And the parities are:

```<code>Even Odd Even Even Odd Even Odd Odd Even Even Even Odd
</code>```

Which is clearly not always alternating.

The challenge

You must write either a full program or a function that accepts a string for input and outputs a truthy value if the string is even, and a falsy value otherwise. You can take your input and output in any reasonable format, and you can assume that the input will only have printable ASCII (the 32-127 range). You do not have to handle empty input.

Examples

Here are some examples of even strings:

```<code>#define
EvenSt-ring$!
long
abcdABCD
3.141
~
0123456789
C ode - g ol!f
HatchingLobstersVexinglyPopulateJuvenileFoxglove
</code>```

And all of these examples are not even strings:

```<code>Hello World
PPCG
3.1415
babbage
Code-golf
Standard loopholes apply
Shortest answer in bytes wins
Happy golfing!
</code>```

You may also use this ungolfed solution to test any strings if you're curious about a certain test-case.

答:
><>, <s>29</s> 27 bytes

```<code>i2%\0 n;n 1<
0:i/!?-}:%2^?(
</code>```

Outputs 1 if the word is even, 0 if the word is odd.

You can try it online.

Edit : saved two bytes thanks to Martin Ender

Title: EvenSt-ring C ode - g ol!f

Body:
><>, <s>29</s> 27 bytes

i2%\0 n;n 1<
0:i/!?-}:%2^?(

Outputs 1 if the word is even, 0 if the word is odd.

You can try it online.

Edit : saved two bytes thanks to Martin Ender


问:
Universal Spooky Meme Translator

Introduction

Turns out, aliens love memes just as much as we do. Every alien race we've encountered so far has their own version of 2spooky4me (see the following question) and equivalent, though, with some variation. The inhabitants of planet CUTE1f can't handle a lot of spook, so their preferred spook is 1spooky2me, while skeletor7 memers love them some spook, so they tend to use 9spooky11me.

Challenge

Translating memes is hard work, so you've been tasked with writing a universal meme translator to help these guys access the memenet correctly. Your program will accept a meme and a transformation to apply to the digit sequences in that meme to make it appropriate for the inhabitants of a different planet.

Input

Your program will receive two string inputs:

The input meme (e.g. 2spooky4me). Matches [a-zA-Z0-9]+.

The transformation to apply to it (e.g. +1, to go from 2spooky4me to 3spooky5me). Matches [+\-*/^]\d+ (you must accept +, -, *, /, and ^ as operators, regardless of the native representation in your language).

Output

Your program must return a string output (printed to standard output or equivalent) with the given transformation applied to the digit sequences in the input meme. In a weird turn of events, it also turns out that all races encountered so far prefer integral memes over fractional ones, so these transformations should perform integer arithmetic (e.g. 1spooky1me /2 should result in 0spooky0me).

Examples

Standard arithmetic operations apply:

```<code>Input:  2spooky4me +1
Output: 3spooky5me

Input:  2spooky4me -1
Output: 1spooky3me

Input:  2spooky4me *15
Output: 30spooky60me

Input:  10spooky900me /5
Output: 2spooky180me
</code>```

Digit sequences are integral; integer truncation should occur in cases like this:

```<code>Input:  idontunderstandmemes3 /2
Output: idontunderstandmemes1
</code>```

Your input may not have any digit sequences:

```<code>Input:  notreallyafunnymeme *100
Output: notreallyafunnymeme
</code>```

You must support exponentiation, even if it is not a native operation in your language of choice:

```<code>Input:  2spooky4me ^3
Output: 8spooky64me
</code>```

There's no limit on string length of number of digit sequences in the string:

```<code>Input:  some1meme2sequences3can4be5really6long7 /2
Output: some0meme1sequences1can2be2really3long3
</code>```

Addendum

If your language supports arbitrary-precision integers as a language feature, you must use those. If it does not, you do not need to support arbitrary-precision integers. For example, you must use Integer in Haskell instead of Int because it's available as part of the language; in Java, you are not required to use BigInteger because it's a library feature, not a language feature.

```<code>Input:  2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000spooky4me /2
Output: 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000spooky2me
</code>```

This is code-golf, so standard loopholes are forbidden, and the shortest answer in bytes wins!

Leaderboard

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

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

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

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

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

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

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Javascript (ES6), 85 Bytes

```<code>x=(s)=>{var a=s.split(" ");return[...a[0]].map(x=>(!isNaN(x))?eval(x+a[1]):x).join``}

console.log(x("2spookie5me +1"));
</code>```

Ungolfed:

```<code>x = (s) => {
  var a = s.split(" ");
  return [...a[0]].map(x => (!isNaN(x)) ? eval(x + a[1]) : x).join ``
}
console.log(x("2spookie5me +1"));
</code>```

Title: Universal Spooky Meme Translator

Body:
Javascript (ES6), 85 Bytes

x=(s)=>{var a=s.split(" ");return[...a[0]].map(x=>(!isNaN(x))?eval(x+a[1]):x).join``}

console.log(x("2spookie5me +1"));

Ungolfed:

x = (s) => {
  var a = s.split(" ");
  return [...a[0]].map(x => (!isNaN(x)) ? eval(x + a[1]) : x).join ``
}
console.log(x("2spookie5me +1"));


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

Please post one tip per answer.

答:
Iterate over adjacent pairs

It's common to want to iterate over adjacent pairs of items in a list or string, i.e.

"golf" -> [('g','o'), ('o','l'), ('l','f')]
```

<p>There's a few methods, and which is shortest depends on specifics.</p>

<p><strong>Shift and zip</strong></p>

<pre class="lang-python prettyprint-override"><code>## 47 bytes
l=input()
for x,y in zip(l,l[1:]):do_stuff(x,y)
</code>```

Create a list of adjacent pairs, by removing the first element and zipping the original with the result. This is most useful in a list comprehension like

sum(abs(x-y)for x,y in zip(l,l[1:]))
```

<p>You can also use <code>map</code> with a two-input function, though note that the original list is no longer truncated.</p>

<pre class="lang-python prettyprint-override"><code>## Python 2
map(cmp,l[:-1],l[1:])
</code>```

Keep the previous

## 41 bytes, Python 3
x,*l=input()
for y in l:do_stuff(x,y);x=y
```

<p>Iterate over the elements of the list, remembering the element from a previous loop. This works best with Python 3's ability to unpack to input into the initial and remaining elements. </p>

<p>If there's an initial value of <code>x</code> that serves as a null operation in <code>do_stuff(x,y)</code>, you can iterate over the whole list.</p>

<pre class="lang-python prettyprint-override"><code>## 39 bytes
x=''
for y in input():do_stuff(x,y);x=y
</code>```

Truncate from the front

## 46 bytes
l=input()
while l[1:]:do_stuff(*l[:2]);l=l[1:]
```

<p>Keep shortening the list and act on the first two elements. This works best when your operation is better-expressed on a length-two list or string than on two values. </p>

<hr>

<p>I've written these all as loops, but they also lend to a recursive functions. You can also adjust to get cyclic pairs by putting the first element at the end of the list, or as the initial previous-value.</p>

<hr>

<p>The Python 3.8 "walrus" assignment expressions allow a short expression to give pairs, though with an extra initial element.</p>

<pre class="lang-python prettyprint-override"><code>>>> p=''
>>> [(p,p:=c)for c in"golf"]
[('', 'g'), ('g', 'o'), ('o', 'l'), ('l', 'f')]
</code>```

Title: Tips for golfing in Python

Body:
Iterate over adjacent pairs

It's common to want to iterate over adjacent pairs of items in a list or string, i.e.

"golf" -> [('g','o'), ('o','l'), ('l','f')]

There's a few methods, and which is shortest depends on specifics.

Shift and zip

## 47 bytes
l=input()
for x,y in zip(l,l[1:]):do_stuff(x,y)

Create a list of adjacent pairs, by removing the first element and zipping the original with the result. This is most useful in a list comprehension like

sum(abs(x-y)for x,y in zip(l,l[1:]))

You can also use map with a two-input function, though note that the original list is no longer truncated.

## Python 2
map(cmp,l[:-1],l[1:])

Keep the previous

## 41 bytes, Python 3
x,*l=input()
for y in l:do_stuff(x,y);x=y

Iterate over the elements of the list, remembering the element from a previous loop. This works best with Python 3's ability to unpack to input into the initial and remaining elements.

If there's an initial value of x that serves as a null operation in do_stuff(x,y), you can iterate over the whole list.

## 39 bytes
x=''
for y in input():do_stuff(x,y);x=y

Truncate from the front

## 46 bytes
l=input()
while l[1:]:do_stuff(*l[:2]);l=l[1:]

Keep shortening the list and act on the first two elements. This works best when your operation is better-expressed on a length-two list or string than on two values.

I've written these all as loops, but they also lend to a recursive functions. You can also adjust to get cyclic pairs by putting the first element at the end of the list, or as the initial previous-value.

The Python 3.8 "walrus" assignment expressions allow a short expression to give pairs, though with an extra initial element.

>>> p=''
>>> [(p,p:=c)for c in"golf"]
[('', 'g'), ('g', 'o'), ('o', 'l'), ('l', 'f')]

ContentLicense: CC BY-SA 4.0


答:
Groovy, <s>33</s> 30 Bytes

```<code>{(int)(it.getChars().sum())%2}
</code>```

Basically collects the chars in the string into an array as their values modulo 2, sums them, then modulos the answer. In groovy a 0 is false and a 1 is a true. 0 for odd (false), 1 for true (even). This also implicitly handles empty input...

Try it: https://groovyconsole.appspot.com/script/5132426728701952

-2 Bytes if I can output an odd number if odd, even if even.

Title: EvenSt-ring C ode - g ol!f

Body:
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the characters are:

```<code>69 118 101 110 83 116 45 114 105 110 103 36 33
</code>```

And the parities of these numbers are:

```<code>Odd Even Odd Even Odd Even Odd Even Odd Even Odd Even Odd
</code>```

Which is alternating the whole way. However, a string like Hello world! is not an even string because the ASCII values are:

```<code>72 101 108 108 111 32 87 111 114 108 100 33
</code>```

And the parities are:

```<code>Even Odd Even Even Odd Even Odd Odd Even Even Even Odd
</code>```

Which is clearly not always alternating.

The challenge

You must write either a full program or a function that accepts a string for input and outputs a truthy value if the string is even, and a falsy value otherwise. You can take your input and output in any reasonable format, and you can assume that the input will only have printable ASCII (the 32-127 range). You do not have to handle empty input.

Examples

Here are some examples of even strings:

```<code>#define
EvenSt-ring$!
long
abcdABCD
3.141
~
0123456789
C ode - g ol!f
HatchingLobstersVexinglyPopulateJuvenileFoxglove
</code>```

And all of these examples are not even strings:

```<code>Hello World
PPCG
3.1415
babbage
Code-golf
Standard loopholes apply
Shortest answer in bytes wins
Happy golfing!
</code>```

You may also use this ungolfed solution to test any strings if you're curious about a certain test-case.

Body:
Groovy, <s>33</s> 30 Bytes

{(int)(it.getChars().sum())%2}

Basically collects the chars in the string into an array as their values modulo 2, sums them, then modulos the answer. In groovy a 0 is false and a 1 is a true. 0 for odd (false), 1 for true (even). This also implicitly handles empty input...

Try it: https://groovyconsole.appspot.com/script/5132426728701952

-2 Bytes if I can output an odd number if odd, even if even.


Title: EvenSt-ring C ode - g ol!f

Body:
Brain-Flak 155 151 141 121

Includes +3 for -a

Saved 30 bytes thanks to 1000000000

{({}(())){({}[()]<(()[{}])>)}{}({}()<>)<>}<>{({}[({})]<(())>){((<{}{}>))}{}({}[()]<>)<>}<>{{}}([]<(())>){((<{}{}>))}{}

Output:

truthy: 1

falsy:  0 on top of the stack

Try it online! (truthy)

Try it online! (falsy)

Better explanation coming later (if I can remember how it works after a few hours...)

#compute ((mod 2) + 1) and put on other stack
{({}(())){({}[()]<(()[{}])>)}{}({}()<>)<>}<>

#compare top two (remove top 1) push on other stack (-1 for different 0 for same)
{({}[({})]<(())>){((<{}{}>))}{}({}[()]<>)<>}<>

#remove all of the top -1s
{{}}

#take the logical not of the stack height
([]<(())>){((<{}{}>))}{}


答:
Brain-Flak, <s>138</s> <s>114</s> <s>112</s> 84 + 3 = 87 bytes

Thanks to @Riley for help golfing.

This program treats empty input as a noneven string.

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

Try it online!

Explanation (outdated)

Shifts the input from the left stack to the right while modding by 2. Finds the difference between each adjacent character until all have been checked or one of the differences is equal to zero (which would only occur in a noneven string). If the loop terminated due to a noneven string then switch back to the left stack and pop the value remaining on it. Otherwise, stay on the right stack and pop the zero above the 1 remaining on the stack.

Title: EvenSt-ring C ode - g ol!f

Body:
Brain-Flak, <s>138</s> <s>114</s> <s>112</s> 84 + 3 = 87 bytes

Thanks to @Riley for help golfing.

This program treats empty input as a noneven string.

{({}(())){({}[()]<(()[{}])>)}{}(({})<>[[]{}]()){{}(<>)}{}({}<>)<>}<>(([])[()]){<>}{}

Try it online!

Explanation (outdated)

Shifts the input from the left stack to the right while modding by 2. Finds the difference between each adjacent character until all have been checked or one of the differences is equal to zero (which would only occur in a noneven string). If the loop terminated due to a noneven string then switch back to the left stack and pop the value remaining on it. Otherwise, stay on the right stack and pop the zero above the 1 remaining on the stack.


问:
A Triangular Slice of Squared Pi
Inspired by Bake a slice of Pi

Challenge

Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.

For example, for input n = 5, y = 3, the following matrix is constructed

```<code>14159
26535
89793
23846
26433
</code>```

Then, the upper-right 3 x 3 triangle would be

```<code>159
 35
  3
</code>```

so 159353 is the output.

Input

Two integers -- n representing the size of the square matrix of the digits of pi, and y representing the upper-right triangle -- in any convenient format.

Output

The resulting sliced and concatenated number, either printed/displayed to the screen, returned as a string, etc.

Trailing/leading whitespace is optional, so long as there's no whitespace in the output (i.e., 159 35  3 or the like would be invalid).

Note that since we're explicitly looking for the digits of pi, and not an approximation or mathematical calculation, answers should not round the final digit of the matrix.

Rules

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

Either a full program or function are acceptable.

Standard loopholes are forbidden.

Examples

```<code> n  y  output
-------------
 3  3  141923
 5  3  159353
 6  4  1592589383
 6  6  141592535893238643794
20 12  358979323846950288419715820974944628620899211706792306647223172745025559196615
</code>```

答:
05AB1E, 19 bytes

Uses CP-1252 encoding.

```<code>nžs¦¦¹ôI£íRvyN>£J}R
</code>```

Try it online!

Explanation

n=5, y=3 used for example

```<code>nžs                  # push pi to n^2 digits
                     # STACK: 3.1415926535897932384626433
   ¦¦                # remove the first 2 chars
                     # STACK: 1415926535897932384626433
     ¹ô              # split into n*n matrix
                     # STACK: ['14159', '26535', '89793', '23846', '26433']
       I£            # keep the first y rows
                     # STACK: ['14159', '26535', '89793']
         íR          # reverse the list of rows and each individual row
                     # STACK: ['39798', '53562', '95141']
           v     }   # for each y,N (row, index) in the list
            yN>£J    # keep the first index+1 digits of the row and join to string
                     # STACK: 353951
                  R  # reverse the string
                     # STACK: 159353
                     # implicit print
</code>```

Title: A Triangular Slice of Squared Pi

Body:
05AB1E, 19 bytes

Uses CP-1252 encoding.

nžs¦¦¹ôI£íRvyN>£J}R

Try it online!

Explanation

n=5, y=3 used for example

nžs                  # push pi to n^2 digits
                     # STACK: 3.1415926535897932384626433
   ¦¦                # remove the first 2 chars
                     # STACK: 1415926535897932384626433
     ¹ô              # split into n*n matrix
                     # STACK: ['14159', '26535', '89793', '23846', '26433']
       I£            # keep the first y rows
                     # STACK: ['14159', '26535', '89793']
         íR          # reverse the list of rows and each individual row
                     # STACK: ['39798', '53562', '95141']
           v     }   # for each y,N (row, index) in the list
            yN>£J    # keep the first index+1 digits of the row and join to string
                     # STACK: 353951
                  R  # reverse the string
                     # STACK: 159353
                     # implicit print


问:
List of primes under a million
This is my first code golf question, and a very simple one at that, so I apologise in advance if I may have broken any community guidelines.

The task is to print out, in ascending order, all of the prime numbers less than a million. The output format should be one number per line of output.

The aim, as with most code golf submissions, is to minimise code size. Optimising for runtime is also a bonus, but is a secondary objective.

答:
Vim, 34 bytes

6@=9<CR>o<Tab>0<Esc>V{g<C-A>dj=:g/\v^(<Tab><Tab>+)\1+</d<CR>

This is a direct adaptation of my top solution to Prime Numbers. The difference is... here I have to go up to a million. This forces a cool tactic to put 999999 into the readahead, but it also makes this solution impossible to run. You won't even get past the setup making the number array, because you'd need to fill more than half a terabyte of RAM (without overhead). And if you ever got to the regex algorithm... well, it sucks. You'd never finish.

This solution requires :set autoindent noexpandtab, which you might have set already, might not. It also requires computer hardware that doesn't exist.

6@=9<CR>: Cool trick to write 999999 in 5 bytes. Integer 9 gets evaluated into the expression register as text. That "macro" is run 6 times.

o<Tab>0<Esc>: Make N (999,999) lines of zeroes, with stair-step indent. This is kind of like what happens when you paste in insert mode without doing :set paste.

V{g<C-A>: Visual increment to turn the 0s into a list of numbers 1-999,999. Conveniently leaves cursor on top.

dj: Remove the blank (zero) and 1 lines.

=:: Vim users rarely think of the : command as an operator, but it is one (a charwise operator, surprisingly). Runs the = out to where the : command would move the cursor (top to bottom in this case).

\v^(<Tab><Tab>+)\1+<: Regex that matches a composite number of tabs. If you haven't, watch the VimCast episode, which covers an old version of this solution. The :g//d will delete those lines. The cursor will end on the last remaining line, which will act as the operator for = to remove all indent.

Vim, 36 bytes (actually runs)

6@=9<CR>O0<Esc>V{g<C-A>:%norm~V$EkdYo@0D@.<C-O>@.<CR>d

This :normal macro is a proper sieve of Eratosthenes that cleans up after itself. I actually ran this out to 1,000,000. Took 10-15 minutes. The algorithm is quite good, but the data structure (array of lines in Vim) comes with a big toll. I wrote about it in more detail a long time ago.

Title: List of primes under a million


答:
Mathematica, 82 bytes

```<code>Print@@Join@@Partition[RealDigits[Pi-3,10,#^2][[1]],#][[i,i-#2-1;;]]~Table~{i,#2}&
</code>```

Title: A Triangular Slice of Squared Pi

Body:
Inspired by Bake a slice of Pi

Challenge

Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.

For example, for input n = 5, y = 3, the following matrix is constructed

```<code>14159
26535
89793
23846
26433
</code>```

Then, the upper-right 3 x 3 triangle would be

```<code>159
 35
  3
</code>```

so 159353 is the output.

Input

Two integers -- n representing the size of the square matrix of the digits of pi, and y representing the upper-right triangle -- in any convenient format.

Output

The resulting sliced and concatenated number, either printed/displayed to the screen, returned as a string, etc.

Trailing/leading whitespace is optional, so long as there's no whitespace in the output (i.e., 159 35  3 or the like would be invalid).

Note that since we're explicitly looking for the digits of pi, and not an approximation or mathematical calculation, answers should not round the final digit of the matrix.

Rules

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

Either a full program or function are acceptable.

Standard loopholes are forbidden.

Examples

```<code> n  y  output
-------------
 3  3  141923
 5  3  159353
 6  4  1592589383
 6  6  141592535893238643794
20 12  358979323846950288419715820974944628620899211706792306647223172745025559196615
</code>```

Body:
Mathematica, 82 bytes

Print@@Join@@Partition[RealDigits[Pi-3,10,#^2][[1]],#][[i,i-#2-1;;]]~Table~{i,#2}&


答:
APL, 26 or 25 bytes

```<code>{~1∊↑(2/¨0 1)⍷¨2⍴⊂2|⍵}⎕UCS
</code>```

One byte can be saved if ⎕IO is 0: {~1∊↑(2/¨⍳2)⍷¨2⍴⊂2|⍵}⎕UCS

The dyadic function returns 1 if the string is even, 0 otherwise.

Title: EvenSt-ring C ode - g ol!f

Body:
APL, 26 or 25 bytes

{~1∊↑(2/¨0 1)⍷¨2⍴⊂2|⍵}⎕UCS

One byte can be saved if ⎕IO is 0: {~1∊↑(2/¨⍳2)⍷¨2⍴⊂2|⍵}⎕UCS

The dyadic function returns 1 if the string is even, 0 otherwise.


答:
Ruby, <s>41</s> 30 (+1) bytes

```<code>p gsub(/./){$&.ord%2}!~/(.)\1/
</code>```

Call this from the command line with the -n flag, like so:

```<code>ruby -ne 'p gsub(/./){$&.ord%2}!~/(.)\1/'
</code>```

Replaces each character with the parity of its ASCII value and then compares to a regex. If even, the =~ comparison will return the index of the first match (i.e. 0), which is a truthy value in Ruby; if not even, the comparison will return nil.

Thanks to Jordan for the improvements!

Title: EvenSt-ring C ode - g ol!f

Body:
Ruby, <s>41</s> 30 (+1) bytes

p gsub(/./){$&.ord%2}!~/(.)\1/

Call this from the command line with the -n flag, like so:

ruby -ne 'p gsub(/./){$&.ord%2}!~/(.)\1/'

Replaces each character with the parity of its ASCII value and then compares to a regex. If even, the =~ comparison will return the index of the first match (i.e. 0), which is a truthy value in Ruby; if not even, the comparison will return nil.

Thanks to Jordan for the improvements!


答:
C#, 126 bytes

```<code>(a,b,c)=>{var v=a*BigInteger.Parse("1"+new string('0',c))/b+"";return v.PadLeft(c+1,'0').Insert(Math.Max(1,v.Length-c),".");};
</code>```

Full program with test cases:

```<code>using System;
using System.Numerics;

namespace DivisionOfNotSoLittleNumbers
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<BigInteger,BigInteger,int,string>f= (a,b,c)=>{var v=a*BigInteger.Parse("1"+new string('0',c))/b+"";return v.PadLeft(c+1,'0').Insert(Math.Max(1,v.Length-c),".");};

            //test cases:
            Console.WriteLine(f(1,2,1));    //0.5
            Console.WriteLine(f(1,2,2));    //0.50
            Console.WriteLine(f(13,7,27));  //1.857142857142857142857142857
            Console.WriteLine(f(2,3,1));    //0.6
            Console.WriteLine(f(4,5,7));    //0.8000000
            Console.WriteLine(f(4,5,1));    //0.8
            Console.WriteLine(f(9999,23,1));    //434.7
            Console.WriteLine(f(12345613,2321,89)); //5319.09220163722533390779836277466609220163722533390779836277466609220163722533390779836277466
            Console.WriteLine(f(2,3,1));    //0.6
            Console.WriteLine(f(4,5,2));    //0.80
        }
    }
}
</code>```

Integer division is implemented. Numbers of any size can be used, due to the BigInteger data type (the import System.Numerics is required). The digit-count parameter c is restricted to 2^31-1, however it should provide more than enough digits.

Title: Division of not so little numbers

Body:
Write a program or function that takes in positive integers a, b and c, and prints or returns a/b to c decimal places, using the operations +-*/% [add, subtract, multiply, divide, modulate] on the positive integers: you can use all that your language allows, but not on floating point numbers. The range of a,b,c would be the range allowed for unsigned integers in your language.
The number result will be truncated to the last digit to print (so no round).

This means that if your language does not have an integer type (only float), you can participate by using these float numbers as positive integers only.
The clue of this exercise it would be to write the function that find the
digits in a float point division, using only the operation +-*/%  on
[unsigned] integers.

Examples

print(1,2,1) would print 0.5

print(1,2,2) would print 0.50

print(13,7,27) would print 1.857142857142857142857142857

print(2,3,1) would print 0.6

print(4,5,7) would print 0.8000000

print(4,5,1) would print 0.8

print(9999,23,1) would print 434.7

print(12345613,2321,89) would print if your Language has 32 bit unsigned 5319.09220163722533390779836277466609220163722533390779836277466609220163722533390779836277466

The shortest code in bytes wins. I'm sorry if this appear not clear... I don't know languages too, not remember words well...
It is better to have one link to Ideone.com or some other place for easily try the answer especially for to test some input different from proposed.

Body:
C#, 126 bytes

(a,b,c)=>{var v=a*BigInteger.Parse("1"+new string('0',c))/b+"";return v.PadLeft(c+1,'0').Insert(Math.Max(1,v.Length-c),".");};

Full program with test cases:

using System;
using System.Numerics;

namespace DivisionOfNotSoLittleNumbers
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<BigInteger,BigInteger,int,string>f= (a,b,c)=>{var v=a*BigInteger.Parse("1"+new string('0',c))/b+"";return v.PadLeft(c+1,'0').Insert(Math.Max(1,v.Length-c),".");};

            //test cases:
            Console.WriteLine(f(1,2,1));    //0.5
            Console.WriteLine(f(1,2,2));    //0.50
            Console.WriteLine(f(13,7,27));  //1.857142857142857142857142857
            Console.WriteLine(f(2,3,1));    //0.6
            Console.WriteLine(f(4,5,7));    //0.8000000
            Console.WriteLine(f(4,5,1));    //0.8
            Console.WriteLine(f(9999,23,1));    //434.7
            Console.WriteLine(f(12345613,2321,89)); //5319.09220163722533390779836277466609220163722533390779836277466609220163722533390779836277466
            Console.WriteLine(f(2,3,1));    //0.6
            Console.WriteLine(f(4,5,2));    //0.80
        }
    }
}

Integer division is implemented. Numbers of any size can be used, due to the BigInteger data type (the import System.Numerics is required). The digit-count parameter c is restricted to 2^31-1, however it should provide more than enough digits.


答:
Perl 6, <s> 47 </s> 26 bytes

{?all .ords.rotor(2=>-1).map({(.[0]+^.[1])%2})}
```

<pre class="lang-perl6 prettyprint-override"><code>{[~](.ords X%2)!~~/(.)$0/}
</code>```

Expanded:

# bare block lambda with implicit parameter $_
{
  [~](             # reduce using concatenation operator ( no space chars )
    .ords X[%] 2   # the ordinals cross modulus with 2 ( 1 or 0 )
  # ^-- implicit method call on $_
  )

  ![~~]            # negating meta operator combined with smartmatch operator

  / ( . ) $0 /     # is there a character followed by itself?
}
```

Title: EvenSt-ring C ode - g ol!f

Body:
Perl 6, <s> 47 </s> 26 bytes

{?all .ords.rotor(2=>-1).map({(.[0]+^.[1])%2})}

{[~](.ords X%2)!~~/(.)$0/}

Expanded:

# bare block lambda with implicit parameter $_
{
  [~](             # reduce using concatenation operator ( no space chars )
    .ords X[%] 2   # the ordinals cross modulus with 2 ( 1 or 0 )
  # ^-- implicit method call on $_
  )

  ![~~]            # negating meta operator combined with smartmatch operator

  / ( . ) $0 /     # is there a character followed by itself?
}


答:
Python 2 (with sympy), 100 bytes

from sympy import*
lambda n,y:''.join(c for i,c in enumerate(`pi.round(n*n+1)`[2:])if i%n-i/n>n-y-1)
```
<hr />
<h3>No sympy, <s>260 246 244 233 231</s> 218 bytes</h3>
<pre class="lang-python prettyprint-override"><code>p=lambda n,y,a=-30,b=10,c=3,d=2,e=0,f=5,s='',i=0:i<n*n and p(n,y,*[((2*b+a)*f,b*d,c*f,d+1,(b*(7*d)+2+(a*f))/(c*f),f+2,s,i),(10*(a-e*c),10*b,c,d,((10*(3*b+a))/c)-10*e,f,s+(str(e)[:i%n-i/n>n-y-1]),i+1)][4*b+a-c<e*c])or s
</code>```

This employs "The Spigot Algorithm For Pi" of Stanley Rabinowitz and Stan Wagon.

The standard arguments would be a,b,c,d,e,f=0,1,1,1,3,3 to yield the first digit of pi, 3, since that is not required the algorithm is initialised to the point before 1 is yielded, which saves two bytes even though a and b are longer as the result does not require slicing and i can start at 0 rather than -1.

Hits default recursion limit for last test case

Uses // for the first of the divisions so that str(v) may be replaced by `v` (otherwise it would end in L for a long).

repl.it

A non-recursive version for 232 bytes which evaluates the last test case too:

def p(n,y):
 a,b,c,d,e,f,i,s=-30,10,3,2,0,5,0,''
 while i<n*n:
    if 4*b+a-c<e*c:s+=`e`[:i%n-i/n>n-y-1];g=10*(a-e*c);e=((10*(3*b+a))//c)-10*e;b*=10;i+=1
    else:g=(2*b+a)*f;h=(b*(7*d)+2+(a*f))/(c*f);b*=d;c*=f;f+=2;d+=1;e=h
    a=g
 print s
```

repl.it (first indent is one space, second indent is one tab)

Title: A Triangular Slice of Squared Pi

Body:
Python 2 (with sympy), 100 bytes

from sympy import*
lambda n,y:''.join(c for i,c in enumerate(`pi.round(n*n+1)`[2:])if i%n-i/n>n-y-1)

No sympy, <s>260 246 244 233 231</s> 218 bytes

p=lambda n,y,a=-30,b=10,c=3,d=2,e=0,f=5,s='',i=0:i<n*n and p(n,y,*[((2*b+a)*f,b*d,c*f,d+1,(b*(7*d)+2+(a*f))/(c*f),f+2,s,i),(10*(a-e*c),10*b,c,d,((10*(3*b+a))/c)-10*e,f,s+(str(e)[:i%n-i/n>n-y-1]),i+1)][4*b+a-c<e*c])or s

This employs "The Spigot Algorithm For Pi" of Stanley Rabinowitz and Stan Wagon.

The standard arguments would be a,b,c,d,e,f=0,1,1,1,3,3 to yield the first digit of pi, 3, since that is not required the algorithm is initialised to the point before 1 is yielded, which saves two bytes even though a and b are longer as the result does not require slicing and i can start at 0 rather than -1.

Hits default recursion limit for last test case

Uses // for the first of the divisions so that str(v) may be replaced by `v` (otherwise it would end in L for a long).

repl.it

A non-recursive version for 232 bytes which evaluates the last test case too:

def p(n,y):
 a,b,c,d,e,f,i,s=-30,10,3,2,0,5,0,''
 while i<n*n:
    if 4*b+a-c<e*c:s+=`e`[:i%n-i/n>n-y-1];g=10*(a-e*c);e=((10*(3*b+a))//c)-10*e;b*=10;i+=1
    else:g=(2*b+a)*f;h=(b*(7*d)+2+(a*f))/(c*f);b*=d;c*=f;f+=2;d+=1;e=h
    a=g
 print s

repl.it (first indent is one space, second indent is one tab)


问:
The Letter A without A
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

答:
Vim, 6 bytes

grNg??

Challenge doesn't block N, and Vim has a ROT-13 feature. FDinoff's answer is probably cooler, but this is ASCII and works everywhere.

Title: The Letter A without A


问:
Draw an asterisk triangle
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).

Input:

A positive integer n >= 1.

Output:

n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.

Test case (n=5):

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

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

答:
F#, 114 chars

```<code>[<EntryPoint>]
let main a =
 for i = 1 to System.Int32.Parse(a.[0]) do
  printfn "%s" <| String.replicate i "*"
 0
</code>```

Title: Draw an asterisk triangle

Body:
F#, 114 chars

[<EntryPoint>]
let main a =
 for i = 1 to System.Int32.Parse(a.[0]) do
  printfn "%s" <| String.replicate i "*"
 0


答:
Vim, 19 bytes (not competing)

:redi@"|Ni!<CR>pJd3w~D

Do you demand a shrubbery?

Title: The Letter A without A

Body:
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```


答:
Stata, 21 bytes

```<code>primes 1000000, clear
</code>```

This is (obviously) a built-in command...

Title: List of primes under a million

Body:
This is my first code golf question, and a very simple one at that, so I apologise in advance if I may have broken any community guidelines.

The task is to print out, in ascending order, all of the prime numbers less than a million. The output format should be one number per line of output.

The aim, as with most code golf submissions, is to minimise code size. Optimising for runtime is also a bonus, but is a secondary objective.

Body:
Stata, 21 bytes

primes 1000000, clear

This is (obviously) a built-in command...


问:
Help me with my Halloween decoration
The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task

Input

The input will be a list of 4 digits numbers, where each digit represent a portion of decoration:

```<code>EMBU
||||
|||+-upper decoration
||+-bottom decoration
|+-mouth/nose
+-eyes
</code>```

Eyes:

0 - °

1 - ¯

2 - -

3 - ^

4 - '

Mouth/Nose

0 - v

1 - w

2 - o

3 - _

4 - -

Bottom decoration

0 - nothing

1 - skeleton

2 - pumpkin

Upper decoration

0 - nothing

1 - flying bat

2 - resting bat

3 - spider

Output

Skeleton:

(EME)

 _|_

/[|]\

  |

 / \

Pumpkin

  ,

(EME)

Flying bat

 ^"^

Resting bat

  ()

  ´`

Spider

  |

 .|.

 :":

Each decoration has a 5 character width

Upper decorations start from the top

Lower decorations start from the bottom

If the spider is over the pumpkin or there is no bottom decoration the web length will be 3, if it's over the skeleton, the web length will be 1

When the bottom decoration is 0 the first 2 digits are irrelevant

Between each decoration there will be an empty column

Example

Input

3123 ??02 1021 0310

Output

```<code>   |     ()
   |     ´`   ^"^
  .|.              (°_°)
  :":               _|_
                   /[|]\
   ,           ,     |
 (^w^)       (¯v¯)  / \
</code>```

Trailing spaces at the end of each line are optional

Trailing newline at the end of the entire output is allowed

Winning criteria

This is code-golf so the shortest answer wins

Title: Help me with my Halloween decoration

Body:
Java, <s>829</s>, 798

Yeah. Substantially improved thanks to Kevin Cruijssen and corvus_192.

s->{String[]e=s.split(" ");char c[][]=new char[8][e.length*6],t,u,h='|';int y,x=2,i=0,j;for(String l:e){y=0;char[]p=l.toCharArray(),z=c[y];int a=p[0],b=p[1],f=p[2],d=p[3],k=x-1,m=x+1;t=a<49?'°':a<50?'¯':a<51?45:a<52?'^':39;u=(char)(b<50?b+70:b<51?111:b<52?95:39);if(d>50){z[x]=h;if(f!=49){y=2;c[1][x]=h;c[2][x]=h;}z=c[y];z[k]=46;z[m]=46;z=c[++y];z[k]=58;z[m]=58;z[x]=34;}if(d==50){z[x]=40;z[m]=41;c[++y][x]='´';c[y][m]=96;}if(d==49){z=c[++y];z[k]=94;z[x]=34;z[m]=94;}if(f>49){y=6;c[y][x]=44;}if(f>48){y=f>49?7:3;z=c[y++];z[x]=u;z[k]=t;z[m]=t;z[x-2]=40;z[x+2]=41;}if(f==49){z=c[y++];z[x]=h;z[k]=95;z[m]=95;z=c[y];z[x]=h;z[k]=91;z[m]=93;z[x-2]=47;c[y++][x+2]=92;c[y++][x]=h;c[y][k]=47;c[y][m]=92;}x+=6;}for(;i<8;i++){s="";for(j=0;j<c[0].length;){t=c[i][j++];s+=t<1?' ':t;}System.out.println(s);}};

the ungolfed version

static void makeDecorations(String s){
    String[]e=s.split(" ");
    char c[][]=new char[8][e.length*6],t,u,h='|';
    int x=2,i=0,j,y;
    for(String l:e){
        y=0;
        char[]p=l.toCharArray(), z=c[y];
        int a=p[0],b=p[1],f=p[2],d=p[3],k=x-1,m=x+1;
        t=a<49?'°':a<50?'¯':a<51?45:a<52?'^':39;
        u=(char)(b<50?b+70:b<51?111:b<52?95:39);
        if(d>50){z[x]=h;
            if(f!=49){y=2;
                c[1][x]=h;
                c[2][x]=h;
            }
            z=c[y];
            z[k]=46;
            z[m]=46;
            z=c[++y];
            z[k]=58;
            z[m]=58;
            z[x]=34;
        }
        if(d==50){
            z[x]=40;
            z[m]=41;
            c[++y][x]='´';
            c[y][m]=96;
        }

        if(d==49){
            z=c[++y];
            z[k]=94;
            z[x]=34;
            z[m]=94;}
        if(f>49){
            y=6;
            c[y][x]=44;
        }
        if(f>48){
            y=f>49?7:3;
            z=c[y++];
            z[x]=u;
            z[k]=t;
            z[m]=t;
            z[x-2]=40;
            z[x+2]=41;
        }
        if(f==49){
            z=c[y++];
            z[x]=h;
            z[k]=95;
            z[m]=95;
            z=c[y];
            z[x]=h;
            z[k]=91;
            z[m]=93;
            z[x-2]=47;
            c[y++][x+2]=92;
            c[y++][x]=h;
            c[y][k]=47;
            c[y][m]=92;
        }
        x+=6;
    }
    for(;i<8;i++){
        s="";
        for(j=0;j<c[0].length;){
            t=c[i][j++];s+=t<1?32:t;
        }
        System.out.println(s);
    }
}

Favorite decoration (which apparently looks more evil in my console): terminator skeleton

(-w-)
 _|_
/[|]\
  |
 / \


答:
Haskell, 32 bytes

unlines.(`take`iterate('*':)"*")
```

<p>The expression <code>iterate('*':)"*"</code> generates the infinite list <code>["*","**","***","****","*****",...]</code>. The function then takes the first <code>n</code> elements and joins them with newlines.</p>

<p>The more direct</p>

<pre class="lang-haskell prettyprint-override"><code>concat.(`take`iterate('*':)"*\n")
</code>```

is one byte longer.

Title: Draw an asterisk triangle

Body:
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).

Input:

A positive integer n >= 1.

Output:

n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.

Test case (n=5):

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

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

Body:
Haskell, 32 bytes

unlines.(`take`iterate('*':)"*")

The expression iterate('*':)"*" generates the infinite list ["*","**","***","****","*****",...]. The function then takes the first n elements and joins them with newlines.

The more direct

concat.(`take`iterate('*':)"*\n")

is one byte longer.


答:
Groovy, <s>64</s> 60 Bytes

```<code>{a,b->a.replaceAll(/\d+/,{Eval.me(it+b.replace("^","**"))})}
</code>```

Replaces all instances of digits with a closure that evaluates the operation on the digit portions of the word passed. If passed an exponent function, it replaces it with the proper notation. Groovy implicitly handles BigInteger/BigDecimal conversion when using Eval.me() because parsed strings can potentially be out of the 2^32-1 range.

Explained

{a,b->...} - Closure with two arguments.

a.replaceAll(/\d+/,{...}) - Search for all digit sequences in string and replace with a closure.

{Eval.me(it+b.replace("^","**"))} - More specifically, a closure with each match having the operation appended to it, then evaluated as groovy code.

.replace("^","**") - Replace the first instance of ^ with the groovy exponent operator ** in the operation provided. If you want this to work with full equation strings that use exponents, use replaceAll() instead for a +3 byte penalty.

Fun side-note his is a valid test scenario:

(22348952345238905290858906209862398036spooky409552me, /200*4943^8-23939+((100/203)+600)

Title: Universal Spooky Meme Translator

Body:
Introduction

Turns out, aliens love memes just as much as we do. Every alien race we've encountered so far has their own version of 2spooky4me (see the following question) and equivalent, though, with some variation. The inhabitants of planet CUTE1f can't handle a lot of spook, so their preferred spook is 1spooky2me, while skeletor7 memers love them some spook, so they tend to use 9spooky11me.

Challenge

Translating memes is hard work, so you've been tasked with writing a universal meme translator to help these guys access the memenet correctly. Your program will accept a meme and a transformation to apply to the digit sequences in that meme to make it appropriate for the inhabitants of a different planet.

Input

Your program will receive two string inputs:

The input meme (e.g. 2spooky4me). Matches [a-zA-Z0-9]+.

The transformation to apply to it (e.g. +1, to go from 2spooky4me to 3spooky5me). Matches [+\-*/^]\d+ (you must accept +, -, *, /, and ^ as operators, regardless of the native representation in your language).

Output

Your program must return a string output (printed to standard output or equivalent) with the given transformation applied to the digit sequences in the input meme. In a weird turn of events, it also turns out that all races encountered so far prefer integral memes over fractional ones, so these transformations should perform integer arithmetic (e.g. 1spooky1me /2 should result in 0spooky0me).

Examples

Standard arithmetic operations apply:

```<code>Input:  2spooky4me +1
Output: 3spooky5me

Input:  2spooky4me -1
Output: 1spooky3me

Input:  2spooky4me *15
Output: 30spooky60me

Input:  10spooky900me /5
Output: 2spooky180me
</code>```

Digit sequences are integral; integer truncation should occur in cases like this:

```<code>Input:  idontunderstandmemes3 /2
Output: idontunderstandmemes1
</code>```

Your input may not have any digit sequences:

```<code>Input:  notreallyafunnymeme *100
Output: notreallyafunnymeme
</code>```

You must support exponentiation, even if it is not a native operation in your language of choice:

```<code>Input:  2spooky4me ^3
Output: 8spooky64me
</code>```

There's no limit on string length of number of digit sequences in the string:

```<code>Input:  some1meme2sequences3can4be5really6long7 /2
Output: some0meme1sequences1can2be2really3long3
</code>```

Addendum

If your language supports arbitrary-precision integers as a language feature, you must use those. If it does not, you do not need to support arbitrary-precision integers. For example, you must use Integer in Haskell instead of Int because it's available as part of the language; in Java, you are not required to use BigInteger because it's a library feature, not a language feature.

```<code>Input:  2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000spooky4me /2
Output: 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000spooky2me
</code>```

This is code-golf, so standard loopholes are forbidden, and the shortest answer in bytes wins!

Leaderboard

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

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

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

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

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

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

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

Body:
Groovy, <s>64</s> 60 Bytes

{a,b->a.replaceAll(/\d+/,{Eval.me(it+b.replace("^","**"))})}

Replaces all instances of digits with a closure that evaluates the operation on the digit portions of the word passed. If passed an exponent function, it replaces it with the proper notation. Groovy implicitly handles BigInteger/BigDecimal conversion when using Eval.me() because parsed strings can potentially be out of the 2^32-1 range.

Explained

{a,b->...} - Closure with two arguments.

a.replaceAll(/\d+/,{...}) - Search for all digit sequences in string and replace with a closure.

{Eval.me(it+b.replace("^","**"))} - More specifically, a closure with each match having the operation appended to it, then evaluated as groovy code.

.replace("^","**") - Replace the first instance of ^ with the groovy exponent operator ** in the operation provided. If you want this to work with full equation strings that use exponents, use replaceAll() instead for a +3 byte penalty.

Fun side-note his is a valid test scenario:

(22348952345238905290858906209862398036spooky409552me, /200*4943^8-23939+((100/203)+600)


问:
World Time Conversion

World Time Conversion

Challenge:

Given an initial clock time in UTC and a list of countries: for each country in the list, output the local time it is in that country based on the initial time.  In cases where a country is big enough to have multiple local time zones (like the United States), you may output any valid local time for that country, provided you state which time zone you are using (i.e. for United States, EST for Eastern Standard Time).  You do not have to worry about daylight savings time.

Input:

The current time, in UTC, followed by a list of countries.  The format of the input time can be given in any way (12 or 24 hour, with or without seconds, etc), and the countries can all be on the same line or on new lines after the time, your choice.  You may also use any characters to delimit the countries (space, comma, etc.).  You may choose to take a list of country -> timezone in as input, in which case I would prefer a common list be used across all answers, found here.  This part can be excluded from your byte count.

Output:

The local time in each country from the input list.  Once again, you may use any characters or newline to delimit the times for each country so long as it is easy to tell one time from another.  However, unlike the input, the times must be output in a 12 hour format (so there must be an AM/PM indication).  Other than that, you may express the digits in the time in any format (i.e. leading 0's for hours that are single digits, with or without seconds/milliseconds) as long as the character that is used to separate hours and minutes is different than the character that is used to separate the different times.  I would prefer if a date was not included in the answer since this is a challenge dealing specifically with different times.

Examples:

Input 1:

```<code>12:00 AM [United States]
</code>```

Output 1:

```<code>7:00 PM EST (or any other time zone with the appropriate time)
</code>```

Input 2:

```<code>12:00 PM [United States, Italy, Russia]
</code>```

Output 2:

```<code>4:00 AM PST, 2:00 PM, 3:00 PM MSK
</code>```

Rules:

This is code-golf, so shortest code in bytes wins.  Standard loopholes are forbidden.

Common list of country -> timezone:

```<code>// Format:  <country>,<UTC offset>,<time-zone abbreviation>
// You may use any alternate format or any other UTC/abbreviation for a country for those that have more than one zone
France,1,CET
United States,-5,EST
Russia,3,MSK
United Kingdom,0,UTC
Australia,10,AEST
Canada,-5,EST
Kingdom of Denmark,1,CET
New Zealand,12,NZST
Brazil,-3,BRT
Mexico,-6,MDT
Indonesia,7,WIST
Kiribati,12,LINT
Chile,-3,CLT
Democratic Republic of the Congo,1,WAT
Ecuador,-5,ECT
Federated States of Micronesia,11,KOST
Kazakhstan,6,ALMT
Kingdom of the Netherlands,1,CET
Mongolia,8,ULAT
Papua New Guinea,10,AEST
Portugal,0,WET
South Africa,2,SAST
Spain,1,CET
Afghanistan,4.5,AFT
Albania,1,CET
Algeria,1,CET
Andorra,1,CET
Angola,1,WAT
Antigua and Barbuda,-4,AST
Argentina,-3,ART
Armenia,4
Austria,1,CET
Azerbaijan,4
Bahamas,-5,EST
Bahrain,3
Bangladesh,6,BDT
Barbados,-4
Belarus,3,FET
Belgium,1,CET
Belize,-6
Benin,1,WAT
Bhutan,6,BTT
Bolivia,-4
Bosnia and Herzegovina,1,CET
Botswana,2,CAT
Brunei,8
Bulgaria,2,EET
Burkina Faso,0,UTC
Burundi,2,CAT
Cambodia,7
Cameroon,1,WAT
Cape Verde,-1,CVT
Central African Republic,1,WAT
Chad,1,WAT
China,8,CST
Colombia,-5
Comoros,3,EAT
Republic of the Congo,1,WAT
Costa Rica,-6
Croatia,1,CET
Cuba,-5
Cyprus,2,EET
Czech Republic,1,CRT
Djibouti,3,EAT
Dominica,-4
Dominican Republic,-4
East Timor,9
Egypt,2,EET
El Salvador,-6
Equatorial Guinea,1,WAT
Eritrea,3,EAT
Estonia,2,EET
Ethiopia,3,EAT
Fiji,12
Finland,2,EET
Gabon,1,WAT
Gambia,0,GMT
Georgia,4
Germany,1,CET
Ghana,0,GMT
Greece,2,EET
Grenada,-4
Guatemala,-6
Guinea,0,GMT
Guinea-Bissau,0,GMT
Guyana,-4
Haiti,-5
Honduras,-6
Hong Kong,8,HKT
Hungary,1,CET
Iceland,0,GMT
India,5.5,IST
Iran,3.5,IRST
Iraq,3
Ireland,0,WET
Israel,2,IST
Italy,1,CET
Ivory Coast,0,GMT
Jamaica,-5
Japan,9,JST
Jordan,2
Kenya,3,EAT
North Korea,8.5,PYT
South Korea,9,KST
Kuwait,3,AST
Kosovo,1
Kyrgyzstan,6
Laos,7
Latvia,2,EET
Lebanon,2,EET
Lesotho,2
Liberia,0,GMT
Libya,2,EET
Liechtenstein,1,CET
Lithuania,2,EET
Luxembourg,1,CET
Macau China,8,CST
Macedonia,1,CET
Madagascar,3,EAT
Malawi,2,CAT
Malaysia,8,MYT
Maldives,5
Mali,0,GMT
Malta,1,CET
Marshall Islands,12
Mauritania,0,GMT
Mauritius,4,MUT
Moldova,2,EET
Monaco,1,CET
Montenegro,1,CET
Morocco,0,WET
Mozambique,2,CAT
Myanmar,6.5,MST
Namibia,1,WAT
Nauru,12
Nepal,5.75,NPT
Nicaragua,-6
Niger,1,WAT
Nigeria,1,WAT
Norway,1,CET
Oman,4
Pakistan,5,PKT
Palau,9
Panama,-5
Paraguay,-4
Peru,-5,PET
Philippines,8,PHT
Poland,1,CET
Qatar,3,AST
Romania,2,EET
Rwanda,2,CAT
Saint Kitts and Nevis,-4
Saint Lucia,-4
Saint Vincent and the Grenadines,-4
Samoa,13
San Marino,1,CET
São Tomé and Príncipe,0,GMT
Saudi Arabia,3,AST
Senegal,0,GMT
Serbia,1,CET
Seychelles,4,SCT
Sierra Leone,0,GMT
Singapore,8,SST
Slovakia,1,CET
Slovenia,1,CET
Solomon Islands,11
Somalia,3,EAT
South Sudan,3,EAT
Sri Lanka,5.5,SLST
Sudan,3,EAT
Suriname,-3
Swaziland,2
Sweden,1,CET
Switzerland,1,CET
Syria,2,EET
Taiwan,8
Tajikistan,5,
Tanzania,3,EAT
Thailand,7,THA
Togo,0,GMT
Tonga,13
Trinidad and Tobago,-4
Tunisia,1,CET
Turkey,2,EET
Turkmenistan,5
Tuvalu,12
Uganda,3,EAT
Ukraine,2,EET
United Arab Emirates,4
Uruguay,-3
Uzbekistan,5,UZT
Vanuatu,11,
Vatican City,1,CET
Venezuela,-4
Vietnam,7,ICT
Yemen,3
Zambia,2,CAT
Zimbabwe,2,CAT
</code>```

答:
Python 2, <s>154 153 151 148 147 138 134 131 123 121</s> 116 bytes

-4 bytes thanks to @Shebang (missed a div // to / Py3 -> Py2 conversion; print time zone using unpacking; use map to replace two int casts)

def f(t,c,d):
 for x in c:a,b=map(int,t.split(':'));e,z=d[x];v=60*a+b+e;print`v/60%12`+':'+`v%60`,'pa'[v%1440<720],z
```

repl.it (I only bothered with a tiny subset of countries, as that's a chore and I'm lazy - but I included Nepal to have a non-standard offset in there & Tuvalu with it's +12:00 one).

Input is t the time string in 24 hr format; c the list of countries; and d a dictionary of country string to tuple of minutes offset and time zone name.

Prints a 12hr format plus time zone for each country split by new lines. Leading zeros are not printed AM/PM indicator is just a/p (e.g. 08:06 in Nepal prints as 8:6 a Nepal Time)

Title: World Time Conversion

Body:
Python 2, <s>154 153 151 148 147 138 134 131 123 121</s> 116 bytes

-4 bytes thanks to @Shebang (missed a div // to / Py3 -> Py2 conversion; print time zone using unpacking; use map to replace two int casts)

def f(t,c,d):
 for x in c:a,b=map(int,t.split(':'));e,z=d[x];v=60*a+b+e;print`v/60%12`+':'+`v%60`,'pa'[v%1440<720],z

repl.it (I only bothered with a tiny subset of countries, as that's a chore and I'm lazy - but I included Nepal to have a non-standard offset in there & Tuvalu with it's +12:00 one).

Input is t the time string in 24 hr format; c the list of countries; and d a dictionary of country string to tuple of minutes offset and time zone name.

Prints a 12hr format plus time zone for each country split by new lines. Leading zeros are not printed AM/PM indicator is just a/p (e.g. 08:06 in Nepal prints as 8:6 a Nepal Time)


答:
Groovy (<s>78</s> <s>77</s> 42 Bytes)

```<code>{a,b,n->Eval.me(a+'.0g').divide(b, n, 1)}
</code>```

Explanation

Eval.me(a+'.0g'); - Convert from integer input to BigDecimal input. In groovy BigDecimal notation is double notation with an appended G or g. I could've also used the constructor new BigDecimal(it) but this saved a byte.

.divide(b, n, 1) - Divide by b with n precision, rounding mode half-up.

Try it here: https://groovyconsole.appspot.com/script/5177545091710976

Title: Division of not so little numbers

Body:
Groovy (<s>78</s> <s>77</s> 42 Bytes)

{a,b,n->Eval.me(a+'.0g').divide(b, n, 1)}

Explanation

Eval.me(a+'.0g'); - Convert from integer input to BigDecimal input. In groovy BigDecimal notation is double notation with an appended G or g. I could've also used the constructor new BigDecimal(it) but this saved a byte.

.divide(b, n, 1) - Divide by b with n precision, rounding mode half-up.

Try it here: https://groovyconsole.appspot.com/script/5177545091710976


答:
Scala, 54 bytes

```<code>(_:String)sliding 2 map(t=>t(0)%2!=t(1)%2)reduce(_&&_)
</code>```

I'm sure this can be improved.

Title: EvenSt-ring C ode - g ol!f

Body:
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the characters are:

```<code>69 118 101 110 83 116 45 114 105 110 103 36 33
</code>```

And the parities of these numbers are:

```<code>Odd Even Odd Even Odd Even Odd Even Odd Even Odd Even Odd
</code>```

Which is alternating the whole way. However, a string like Hello world! is not an even string because the ASCII values are:

```<code>72 101 108 108 111 32 87 111 114 108 100 33
</code>```

And the parities are:

```<code>Even Odd Even Even Odd Even Odd Odd Even Even Even Odd
</code>```

Which is clearly not always alternating.

The challenge

You must write either a full program or a function that accepts a string for input and outputs a truthy value if the string is even, and a falsy value otherwise. You can take your input and output in any reasonable format, and you can assume that the input will only have printable ASCII (the 32-127 range). You do not have to handle empty input.

Examples

Here are some examples of even strings:

```<code>#define
EvenSt-ring$!
long
abcdABCD
3.141
~
0123456789
C ode - g ol!f
HatchingLobstersVexinglyPopulateJuvenileFoxglove
</code>```

And all of these examples are not even strings:

```<code>Hello World
PPCG
3.1415
babbage
Code-golf
Standard loopholes apply
Shortest answer in bytes wins
Happy golfing!
</code>```

You may also use this ungolfed solution to test any strings if you're curious about a certain test-case.

Body:
Scala, 54 bytes

(_:String)sliding 2 map(t=>t(0)%2!=t(1)%2)reduce(_&&_)

I'm sure this can be improved.


答:
Node.js (ES6), <s>45</s> 44 bytes

s=>![...Buffer(s)].some((b,c,d)=>b+c-d[0]&1)
```

<p>The <code>Buffer</code> object saved me alot of trouble over <code>charCodeAt()</code>.</p>

<p>Also felt like including my attempts via JavaScript (ES6), though they aren't as short as ETHproduction's:</p>

<pre class="lang-js prettyprint-override"><code>a=>![...a].some((b,c,d)=>b.charCodeAt()+c-d[0]&1) // 49 bytes
</code>```

a=>!/(.),\1/.test([...a].map(b=>b.charCodeAt()&1)) // 50 bytes
```

<pre class="lang-js prettyprint-override"><code>a=>new Set([...a].map((b,i)=>b.charCodeAt()+i&1)).size<2 // 56 bytes
</code>```

The first in the JavaScript (ES6) equivalent of what I went with in Node.js. The second was an attempt to use regex to simplify the pattern matching (45 bytes in Node.js). The third was an attempt to use Set's ability to determine unique values, combined with math that made valid arrays be either all 1's or 0's (51 bytes in Node.js).

Title: EvenSt-ring C ode - g ol!f

Body:
Node.js (ES6), <s>45</s> 44 bytes

s=>![...Buffer(s)].some((b,c,d)=>b+c-d[0]&1)

The Buffer object saved me alot of trouble over charCodeAt().

Also felt like including my attempts via JavaScript (ES6), though they aren't as short as ETHproduction's:

a=>![...a].some((b,c,d)=>b.charCodeAt()+c-d[0]&1) // 49 bytes

a=>!/(.),\1/.test([...a].map(b=>b.charCodeAt()&1)) // 50 bytes

a=>new Set([...a].map((b,i)=>b.charCodeAt()+i&1)).size<2 // 56 bytes

The first in the JavaScript (ES6) equivalent of what I went with in Node.js. The second was an attempt to use regex to simplify the pattern matching (45 bytes in Node.js). The third was an attempt to use Set's ability to determine unique values, combined with math that made valid arrays be either all 1's or 0's (51 bytes in Node.js).