text:
Cover a set with multiples
Lets take a set of integers greater than 1 and call it X.  We will define S(i) to be the set of all members of X divisible by i where i > 1.   Would like to choose from these subsets a group of sets such that

Their union is the set X
No element of X is in two of the sets.

For example we can regroup {3..11} as
      {3,4,5,6,7,8,9,10,11}
S(3): {3,    6,    9,     }
S(4): {  4,      8,       }
S(5): {    5,        10,  }
S(7): {        7,         }
S(11):{                 11}

Some sets cannot be expressed in this way.  For example if we take {3..12}, 12 is a multiple of both 3 and 4 preventing our sets from being mutually exclusive.
Some sets can be expressed in multiple ways, for example {4..8} can be represented as
      {4,5,6,7,8}
S(4): {4,      8}
S(5): {  5,     }
S(6): {    6,   }
S(7): {      7, }

but it can also be represented as
      {4,5,6,7,8}
S(2): {4,  6,  8}
S(5): {  5,     }
S(7): {      7, }

Task
Our goal is to write a program that will take a set as input and output the smallest number of subsets that cover it in this fashion.  If there are none you should output some value other than a positive integer (for example 0).
This is a code-golf question so answers will be scored in bytes, with less  bytes being better.
Tests
{3..11}       -> 5
{4..8}        -> 3
{22,24,26,30} -> 1
{5}           -> 1

If there are none you should output some value other than a positive integer (for example 0). Can't our program result in undefined behaviour instead?

Also, can you add a test case like [5..5]? Can we receive things like [8..4]?

@Mr.Xcoder No it may not.  Programs should be able to identify impossible cases not just loop forever or crash on them.

"12 is a multiple of both 3 and 4 preventing our sets from being mutually exclusive": why? I don't see anything else in the problem statement which requires 12 to go into both subsets.

@Mr.Xcoder I added [5] I don't know what [8..4] is supposed to mean.

@WheatWizard [8..4] means [8,7,6,5,4]

@PeterTaylor It is required to go in those sets. I'll try to work that in.

Also, what's with the test cases? [22,24,26,30] are all multiples of 2. Are you sure it wouldn't be better to delete this and sandbox it?

@Mr.Xcoder Thats the same as [4,5,6,7,8], sets do not have order

@PeterTaylor that should have said one, I must've hit the wrong key when I was copying it over

@PeterTaylor Does that clarify why we can't add 12?  The wording is very tricky.

Parameterised names ftw. "We can define the subset S(i) as the set of elements of X which are divisible by i".

Add more test cases please..

Ah, also needs to require the divisor to be greater than 1.

Is it even possible to have no solution?

@Zacharý The example [3..12] has no solution as explained.

Python 2, 167 bytes
lambda a:([q for q in range(a[-1])if a in[sorted(sum(j,[]))for j in combinations([[p for p in a if p%i<1]for i in range(2,1+a[-1])],q)]]+[0])[0]
from itertools import*

Try it online!
-9 bytes thanks to Zacharý
-4 bytes thanks to Mr. Xcoder
-2 bytes by using lists instead of sets
-5 bytes by using a in [...] rather than any([a == ...]).
-2 bytes thanks to Mr. Xcoder
-8 bytes by merging statements
-5 bytes thanks to Mr. Xcoder
-7 bytes thanks to Mr. Xcoder / Zacharý
+7 bytes to fix bug
-1 byte thanks to ovs
note
This is extremely slow for larger maximum numbers because it is in no way optimized; it did not within 2 minutes on Mr. Xcoder's device for [22, 24, 26, 30].

Clingo, 51 bytes
{s(2..X)}:-x(X).:-x(X),{s(I):X\I=0}!=1.:~s(I).[1,I]

Demo
$ echo 'x(3..11).' | clingo cover.lp -
clingo version 5.1.0
Reading from cover.lp ...
Solving...
Answer: 1
x(3) x(4) x(5) x(6) x(7) x(8) x(9) x(10) x(11) s(3) s(4) s(5) s(7) s(11)
Optimization: 5
OPTIMUM FOUND

Models       : 1
  Optimum    : yes
Optimization : 5
Calls        : 1
Time         : 0.003s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.010s
$ echo 'x(4..8).' | clingo cover.lp -
clingo version 5.1.0
Reading from cover.lp ...
Solving...
Answer: 1
x(4) x(5) x(6) x(7) x(8) s(3) s(4) s(5) s(7)
Optimization: 4
Answer: 2
x(4) x(5) x(6) x(7) x(8) s(2) s(5) s(7)
Optimization: 3
OPTIMUM FOUND

Models       : 2
  Optimum    : yes
Optimization : 3
Calls        : 1
Time         : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.000s
$ echo 'x(22;24;26;30).' | clingo cover.lp -
clingo version 5.1.0
Reading from cover.lp ...
Solving...
Answer: 1
x(22) x(24) x(26) x(30) s(5) s(8) s(22) s(26)
Optimization: 4
Answer: 2
x(22) x(24) x(26) x(30) s(3) s(22) s(26)
Optimization: 3
Answer: 3
x(22) x(24) x(26) x(30) s(2)
Optimization: 1
OPTIMUM FOUND

Models       : 3
  Optimum    : yes
Optimization : 1
Calls        : 1
Time         : 0.004s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.000s
$ echo 'x(5).' | clingo cover.lp -
clingo version 5.1.0
Reading from cover.lp ...
Solving...
Answer: 1
x(5) s(5)
Optimization: 1
OPTIMUM FOUND

Models       : 1
  Optimum    : yes
Optimization : 1
Calls        : 1
Time         : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.000s

This seems to not detect cases without solutions like x(3..12). (or do I need to update?). BTW, can you suggest a good introduction to clingo?

@ChristianSievers Oops, that was a bug, which I’ve now fixed. It should output UNSATISFIABLE in such a case. I mostly used the Potassco guide.

Mathematica, 105 bytes
Length@Select[Subsets@Table[Select[s,Mod[#,i]==0&],{i,2,Max[s=#]}],Sort@Flatten@#==Sort@s&][[1]]~Check~0&

Try it online
copy and paste the code with ctrl+v,
paste the input at the end of the code,
hit shift+enter to run
input

[{3,4,5,6,7,8,9,10,11}]

takes a list as input
outputs 0 if there are none

Nice use of Check

Why didn't you undelete your first answer once you had a working version?

Because this was a totally new approach? Is there a problem?

Haskell, 136 bytes
import Data.List
f l|m<-maximum l=(sort[n|(n,c)<-[(length s,[i|j<-s,i<-[j,2*j..m],elem i l])|s<-subsequences[2..m]],c\\l==l\\c]++[0])!!0

Try it online!
How it works
f l     =                           -- input set is l
   |m<-maximum l                    -- bind m to maximum of l
       [   |s<-subsequences[2..m]]  -- for all subsequences s of [2..m]
        (length s, )                -- make a pair where the first element is the length of s
            [i|j<-s,i<-[j,2*j..m],elem i l]
                                    -- and the second element all multiples of the numbers of s that are also in l
     [n|(n,c)<-       ,c\\l==l\\c]  -- for all such pairs (n,c), keep the n when c has the same elements as l, i.e. each element exactly once
   sort[ ]++[0]                     -- sort those n and append a 0 (if there's no match, the list of n is empty)
 (     )!!0                         -- pick the first element

Take a lot of time for {22,24,26,30}.

Jelly, 38 35 34 33 31 28 25 24 23 20 19 bytes
ṀḊŒPð%þ@⁹¬Sḟ1ðÐḟL€Ḣ

-5 bytes thanks to Leaky Nun
Try it online!
I think the third test case works, but it is very slow. 0 is outputted when there are no solutions.
Explanation (might have gotten this explanation wrong):
ṀḊŒPð%þ@⁹¬Sḟ1ðÐḟL€Ḣ     (input z)
ṀḊ                      - 2 .. max(z)
  ŒP                    - powerset
    ð                   - new dyadic chain
     %þ@⁹               - modulo table of z and that
         ¬              - logical not
          S             - sum
           ḟ1           - filter out 1's
             ðÐḟ        - filter out elements that satisfy that condition
                L€      - length of each element
                  Ḣ     - first element

18 bytes

Thanks! And thank you for not submitting that yourself!

I've got a different 18 byte solution closer to my original, I personal like this one better: ṀḊŒPðḍ@þ@⁹Sḟ1ðÐḟḢL

Woah... ṀḊ actually is a really cool trick!

Whoops, that doesn't work, and neither does my rewrite!
This should output 0, not 1

There, I fixed your solution at the cost of two bytes.

You can use L€Ḣ instead of Ḣḟ0L.

Julia, 91 bytes
x->(t=[];for i in x z=findfirst(x->x==0,i%(2:maximum(x)));z∈t?1:push!(t,z) end;length(t))

Um ... did you forget to include a link within the language name, or is it actually named "[Julia]"?

You are right, the name is Julia without brackets

You might want to fix that on your other answers as well!

Wow, that was a lot of answers! And if you want to insert a link, the syntax is [Text to display](link to website)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
remove duplicates from array
You have given an array from which we need to remove duplicates.
Rules:

First or immediate duplicates gets removed first.
Array contains natural numbers a[i]>0 for i>=0
no. of elements in the array is greater than 1 i.e. n>1

e.g.
{1,2,3,4,5,5,4,6,6,7,8}=> {1,2,3,7,8}
{1,2,3,3,4,5,6,7,7,8} => {1,2,4,5,6,8}
{1,1,3,3,4,4,6,6}=>{}
{4,2,6,8,3,1,1,3,8,6,2,4}=>{}
{6,6,6,1}=>{6,1}

Only adjacent duplicate elements like [1, 2, 2, 1] are removed, but not [1, 2, 1, 2]. This process is repeated until no further modifications are made.
For winning criteria is the one which gives the fastest result.

You must specify the winning criterion clearly in your post.

Should {6,6,6,1} output {1} or {1,6}? Add this on the test-case, maybe?

@officialaimm, It should output {6,1}.

Why {6,1}? 6 is a duplicate. Then, {1,2,3,4,5,5,4,6,6,7,8} should output {1,2,3,4,5,6,7,8} as well.

@Mr.Xcoder, first matching duplicates gets removed. so next 6 is not having any immediate matching element so first 6's will be removed and 6,1 is remaining in the result. hope this helped

@SatishPatel You should specify that in the challenge.

Also, I suggest making it [tag:code-golf].

Code golf or fastest code please, not both. And if it is a code golf, please say it in your question, not with the tags.

@cairdcoinheringaahing, thanks for the suggestion. edited as required.

fastest-code and fastest-algorithm don't go together.

Does the returned array need to be sorted?

@powelles {6,1} is not sorted...

@HyperNeutrino But it still follows the order of the original array. I guess I mean does the sort order matter at all.

@powelles Ah okay. We'll wait for OP clarification then. I don't think it matters too much since even if it increases byte count that doesn't matter, but there could be some optimizations, so I don't know for sure.

If you want to keep this as fastest ode (which is fine) you'll need to provide larger test cases as yours would complete almost instantaneous in any sane language and be subject to significant noise in times

Often problems with (simple) polynomial-time algorithm is not suitable for fastest-code.

Next time, please consider using the Sandbox.

@musicman523, thanks for your feedback. I will make sure next time post question on sandbox first then on the main page. thanks again :)

Python 2, 201 bytes
array = input()
index = 0
while index < len(array) - 1:
	if index >= 0 and array[index] == array[index + 1]:
		array = array[:index] + array[index + 2:]
		index -= 1
		continue
	index += 1
print(array)

Try it online!
Optimizations thanks to Mr. Xcoder

I got values between 1.1126001481898129e-05 and 8.827599958749488e-05 for the test cases in the challenge.

@Mr.Xcoder Okay, thanks. This is using bash's built in time which may be off, I don't know for sure.

I get slightly better times if I add continue at the end of your if statement and drop the else (between 1.0405001376057044e-05 and 4.7165998694254085e-05), because it skips the evaluation of the else-statement.

@Mr.Xcoder Interesting, thanks.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Rapunzel, Rapunzel, let down your hair!
Description
I guess everyone knows the fairy tale of Rapunzel and the prince. For those who do not: read it here. However, Rapunzel had just had her hair cut, so it might not be long enough to let her prince climb up! She may get very sad..
Challenge
Your task is to write a function that evaluates what Rapunzel will be saying when the prince calls for her to let her hair down: When her hair is longer than or equal to the tower is tall plus an extra meter (safety guidelines), she becomes veeeery happy and says Aaaah!, with the number of as being the same as length of her hair - height of the tower. Otherwise, her hair does not have sufficient length, and she starts crying: Booho!, where the os before the h equal two thirds of height of the tower - length of her hair, and the os after the h being the rest. The number of os after the B must be rounded, so if you get 2.6, there will be 3 os, and the others must be after the h.
I/O
You are given positive integers (including null) as arguments, as a list or as two single numbers, in the order you find it the most convenient, but you must state in which order you take them. As the output, print what Rapunzel will be saying.
Test cases
In the test cases, the first number will be the hair length.
0, 0 -> 'Bh!' (probably a dry sob..)
2, 1 -> 'Aah!'
1, 2 -> 'Boh!'
1, 4 -> 'Booho!'
4, 1 -> 'Aaaah!'
2, 4 -> 'Boho!'

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

So she can't get down if the height of the tower is 0? BTW, positive integers (including null) == _non-negative integers :)

I meant to do this on your first post, but I would like to tell you about the Sandbox, where you can post challenges to get feedback before posting them to main. This seems like quite an interesting challenge but people can get carried away.

@StewieGriffin Yep, assuming that her hair length is 0 too. Still, she has to get out of the window, and the restrictions for safety apply here too! There's no way she can marry him if she's got herself a broken neck.

Jelly,  43 41 40 38 34 33 32  31 bytes
There's probably a much Is there a shorter way though! ? ...this was quite some golfing!
‘:3;ạ¥⁸4ẋ+;€⁹¦7Ṛṭ;8ị“øŻPLC»
ạç>

A full program printing the result*.
Try it online!
How?
‘:3;ạ¥⁸4ẋ+;€⁹¦7Ṛṭ;8ị“øŻPLC» - Link 1: number, abs(hair-tower); number, (hair > tower)?
‘                           - increment -> abs(hair-tower)+1
 :3                         - integer divide by 3 -> (abs(hair-tower)+1)//3
                            -   ...the remainder amount after removing 2/3 rounded
      ⁸                     - chain's left argument, abs(hair-tower)
     ¥                      - last two links as a dyad:
    _                       -   subtract (yields the 2/3 rounded amount)
   ;                        - concatenate
       4ẋ                   - repeat 4 (vectorises) (i.e. [[4,4,...],[4,...]])
         +                  - add (hair > tower)? (vectorises) (i.e. 4s->5s if so)
             ¦              - sparse application:
          ;€  7             - of:  concatenate €ach with a 7
            ⁹               - to indexes: chain's right argument, (hair-tower)?
               Ṛ            - reverse the list
                ṭ           - tack (hair-tower)?
                 ;8         - concatenate an 8
                    “øŻPLC» - compression of the word "Abroach" & the string "!B"
                   ị        - index into "Abroach!B" (1-indexed & modular, so 0->B)
                            - implicit (smashed) print

ạç> - Main link: number, hair; number, tower
ạ   - absolute difference -> abs(hair-tower)
  > - greater than? -> (hair > tower)? (1 if so, else 0)
 ç  - call the last link (1) as a dyad

* As a monadic link it returns a list of characters and lists of characters e.g. ['B', [['o', 'o', 'h'], ['o']], '!'], as a full program the implicit print smashes this e.g. Booho!

Yep, there is. :-)

Yeah I started with the idea of using AL€œs3 and found div by zero errors and then after I addressed that with the much longer code above found I still needed to special case the equal length case. I thought I'd try and implement a different way today, but looks like you did already.

...mind you I was thinking 25-30 bytes :)

Python 3, 87 bytes
lambda l,h:["B"+"o"*round((h-l)*2/3)+"h"+"o"*round((h-l)/3),"A"+"a"*(l-h)+"h"][l>h]+"!"

Try it online!
Arguments to the function are taken in the order length of hair, height of tower.

Javascript, 105 97 bytes
Thanks to Oki for helping save 7 bytes!
p=(t,s)=>(s||"o").repeat(t)
l=>h=>(d=l-h,o=d/3-.5|0,l>h?`A${p(d,"a")}h`:`B${p(o-d)}h`+p(-o))+"!"

Defines an anonymous currying function. Use like f(length)(height)
Try it online!

Doesn't seem to be working for f(1)(4). Replacing p(o+d) with p(-o-d) could fix this. Also you can use o=-d*2/3+.5|0 to save 7 bytes.

@Oki thanks for pointing that error out and showing me the shorter rounding!

p=(t,s='o')=>s.repeat(t)

05AB1E, 38 35 32 bytes
Input order: length of hair, height of tower
‹i¹α'a×"Aÿh!"ë¹-x‚>3÷R'o×'hý…Bÿ!

Try it online!
Explanation
‹i                                  # if h < l
  ¹α                                # push absolute difference of h and l
    'a×                             # repeat "a" that many times
       "Aÿh!"                       # interpolate between "A" and "h!"
 ë                                  # else
  ¹-                                # push h-l
    x‚                              # pair with its double
      >3÷                           # increment and integer divide by 3
         R                          # reverse the list
          'o×                       # for each, repeat "o" that many times
             'hý                    # merge the o's on "h"
                …Bÿ!                # interpolate between "B" and "!"

You seem to have forgotten a 3 which is shown on TIO.

@EriktheOutgolfer: Thanks for notifying. I've fixed the explanation to conform with the code :)

Oh, and you have spacing problems with your explanation.

@EriktheOutgolfer: I don't see it. If you mean the fact that they are in 2 diagonal lines, that's an intentional separation of if-else to decrease horizontal space used. If there's something else I must be blind.

Oh I was confused with the extraneous whitespace in it...

Argument order?

@racer290: length, height as in the test cases.

Jelly, 32 bytes
_‘”aẋŒt;⁾h!ɓ_÷1.,3+.”oẋ“Bh!”żð>?

Try it online!
-1 thanks to Jonathan Allan.
Only works as full program.
Arguments are in order: hair, tower

Save a byte by replacing ær0 with +.

@JonathanAllan Ooh it does indeed work. (damn two-byte builtin)

PHP>=7.1, 111 bytes
[,$h,$t]=$argv;echo BA[$b=$h>$t],($r=str_repeat)(oa[$b],$c=round(($a=abs($h-$t))*($b?:2/3))),h,$r(o,$a-$c),"!";

PHP Sandbox Online

Argument order 1. hair 2. tower?

@racer290 Yes $h hair $t tower

Julia, 101 bytes
g(h,t)=h>t?string("A","a"^(h-t),"h!"):string("B","o"^round(Int,(t-h)*2/3),"h","o"^round(Int,(t-h)/3))

Arguments to the function are taken in the order length of Hair, height of Tower.

Typo: heigth of Hower

Jelly, 84 76 bytes
It's really rather long, but I spent too much time on this not to post it. Takes two integer arguments:

length of hair
length of tower

Any tips on golfing this would be appreciated.
³>⁴×111ð;ø³>⁴¬×97
97ðxø³ạ⁴
111ðxø¢L÷3×⁸ær0:1
2Çṭ2£“h”ṭµ1ÇṭµFḟ1£
>¬+65¥;¢;33Ọ

Try it online!

well, there is already a much shorter Jelly answer

Perl, 107 bytes
Takes hair length first, tower length second.
sub b{(($c=$_[0]-$_[1])>0?'A'.'a'x--$c.'h':do{$o=int(2/3*($c*=-1)+.5);'B'.('o'x$o).'h'.('o'x($c-$o))}).'!'}

You can get rid of the ``` and intend your code by 4 spaces to make it look nicer..

R, 117 bytes
x=diff(scan());cat(`if`(x>0,paste0("A",rep("a",x),"h!"),paste0("B",rep("o",F<-round(-2*x/3)),"h",rep("o",-x-F),"!")))

A bit long, pretty sure this can be golfed down. Takes input from STDIN in the order Tower, Hair.

uh-oh; this doesn't actually work for input 1 4

Try this? (113 bytes, too)

Python 2, 77 bytes
lambda h,t:("BA"+(abs(h-t)*2+1)/3*"oa"+"h"+(abs(h-t)+1)/3*"ao"+"h!!")[h>t::2]

An unnamed function taking hair length, h, and tower height, t, and returning a string.
Try it online!
Builds a string starting with BA, followed by two thirds of the difference rounded of the string oa repeated, followed by a single h, then the remainder amount of ao repeated, and finally h!!. The return value is then every second character starting with either the B or A via the slice notation [h>t::2].


text:
Is this any number?
Inspired (like 2 others) by this chat message. (and to some extent, my CMC)
Given a string as an input, your task is to check whether or not that string is a number.
What is a number?
This is a list of all input formats that are "numbers":

Integers: An integer is a string made entirely of characters from 1234567890, without any other character e.g. 152
Floats: A float is a integer with 1 (no more, no less) decimal points (.) in the middle of the number. A decimal point must always be preceded and followed by a number e.g. 1.0 or 3.14
Complex: A complex number is a number that follows the format a+bj where a and b are numerical values. The plus sign can also be a minus sign e.g. 1+10j or 143-1j. If it saves bytes (or you want to), you may use i instead of j.
Longs: A long is any number that would be classed as an integer or a float, with an L at the end e.g 1325963L
Hexadecimal: A hexadecimal number is a number which consists entirely of characters in 1234567890abcdef. Upper case characters are valid hex, but only when used consistently e.g. 10a or afa not A5c
Scientific: A scientific number is a number which consists of a run of digits (1234567890.) followed by an e followed by a run of digits, optionally preceded by a -. A E may also be used.

Any of these 5 may also be preceded by a minus sign (-) but any whitespace in the number causes it to no longer be a number e.g.  -3.5 + 2i isn't a number. Longs may not be hexadecimal but may be floats
You must output 2 distinct values (preferably truthy and falsy but you may choose) for inputs that are either numbers as defined above, or not.
Test Cases
These should result in truthy
10
-9.34
-3.5+2j
ab1
100000L
3.14159L
-73e-7
7E53C80
1.2e3
12E3.4

And these should be falsy
abcdefghijklmnop
10.10.10
2569LL
10L+9j
8+45io
4aE3
3.
.3

Now because small numbers are easier to work with, this is a code-golf so shortest code, in bytes, wins!

Isn't 4E3 = 4000?

I don't downvote, but I find these rules (only lowercase e, j and not i, single L is OK) quite arbitrary. This reads basically "design me a regex for this spec".

It seems exceedingly inconvenient to only allow the use of j rather than either i or j, so long as convention is internally consistent within the answer - as I would be willing to bet there is at least one language in which i is used to denote complex numbers - beyond this, I am aware of at least 20 languages in which E is the proper notation for scientific notation - by preventing this internal method of interpretation seems like it would artificially inflate some answers

@Uriel I have changed it so that the rules are less rigid about input, and have changed the appropriate test cases.

I think that you could add another couple of hex numbers to clarify the changes you made i would suggest something like 7EC80000 as truthy (to show that you may not assume the letters a-fA-F wiil not always be in a single block)

@TaylorScott it is. Read the part on floats again.

@dzaima thanks for catching all that, clarified

Upper case characters are valid hex that mean that we have to support both all-lowercase and all-uppercase hexadecimal, right?

@dzaima you may choose

SOGL V0.12, 53 52 50 bytes
O[►~hΘP█⁵\↔<sK⁹>¼⅝┘d⁾Δo≡7ξδ¾▓↑ΧGj4<eu╝t┼Pπ»‘øβ!d!-

Try it Here! or test all test cases (first number indicates amount of test cases)
based on a regex - ^(-?\d+((\.\d+|)(L|e-?\d+(\.\d+|)|\+\d+(\.\d+|)j|)|)|[A-F\d]+)$

Not sure this works for −3.5+2j or ab1

the first one uses a unicode dash, which shouldn't be (and has been fixed in the examples), and for the second - this expects all uppercase hexadecimal

Javascript, 72 71 65 bytes
saved one byte thanks to @Cowsquack
saved 6 bytes thanks to @dzaima
a=>/^(-?\d+((\.\d+|)(L|e-?\d+(\.\d+|)|\+\d+(\.\d+|)j|)|)|[A-F\d]+)$/.test(a)

JS port of @dzaima's answer. Credit to @dzaima for the regex.

/regex here/.test(a) is shorter than match

you don't need the ==null if you use test

Fails for lowercase hexadecimals.

@darrylyeo caird said in the comments that you can choose whether to support lowercase or uppercase hexadecimals

Can you simply use /regex here/.test, eliminating a=> and (a)? I'm not a Javascript programmer, but this seems to me like it would work

@musicman523 it has to be either a full program or a function, not a snippet

Would that not return a function?

@musicman523 according to my Chrome console, doing something like f=/a/.test and then trying to call f("a") causes Uncaught TypeError: Method RegExp.prototype.test called on incompatible receiver undefined. So technically, it returns a function, but it's one that doesn't work...

Huh, weird. I don't know anything about JS so I can't help you there

you need to bind it on /a/, which loses the byte savings

Python 3, 290 136 105 bytes
Python port of @dzaima's answer. All credit to @dzaima for the regex :)
lambda s:re.match('^(-?\d+((\.\d+|)(L|e-?\d+(\.\d+|)|\+\d+(\.\d+|)j|)|)|[A-F\d]+|[a-f\d]+)$',s)
import re

Try it online!

You don't need to account for both lowercase and uppercase hexadecimal (caird said that in the comments)

You don't need to compile the regex.

111 bytes

@totallyhuman thanks! I don't think it needs bool() though, because the re match object is truthy.

It's 1 byte shorter as re.compile('...').match rather than lambda s:re.match('...',s)


text:
Bounce-modulo two numbers
The graph of the modulo operation (\$y = x \mod k\$) looks like this:

This is a very useful function, as it allows us to create "wrapping" behavior. However, it is very cumbersome when I want to use it to create an appearance of "bouncing" between two walls. The graph of the "bounce" function (\$y = \text{bounce} (x, k)\$) looks like this:

The period of the graph of \$y = x \mod k\$ is \$k\$. The period of the graph of \$y = \text{bounce} (x, k)\$ is \$2k\$, because it moves upwards for \$k\$ units, and then moves downwards for another \$k\$ units, before returning to where it started. For both functions, the minimum value for \$y\$ is 0, and the maximum is \$k\$ (Actually, for the modulus function with integral inputs, it's \$k-1\$). In addition, for both functions, the value where \$x=0\$ is 0.
The challenge
Given an integer \$x\$ and a positive integer \$k\$, return an integer or floating-point approximation of \$y = \text{bounce} (x, k)\$.
This is code-golf, so the shortest valid submission (counted in bytes) wins.
Test Cases
  x,  k -> bounce(x, k)
  0, 14 ->            0
  3,  7 ->            3
 14, 14 ->           14
 15, 14 ->           13
-13, 14 ->           13 (12.999997 etc would be an acceptable answer)
-14, 14 ->           14
191,  8 ->            1
192,  8 ->            0

Bonus points for a Fourier-based approach in Fourier.

"For both functions, the minimum value for x is 0, and the maximum is k" is just plain wrong.

@PeterTaylor Whoops. I means the result.

Oops, that's what I thought it said already. It's still wrong. k % k = 0

@PeterTaylor Oh, I understand your question. I had originally designed this with floating-point in mind, then switched to just ints after. Will edit.

@PeterTaylor If the arguments are floats, then the maximum is a number arbitrarily close to k.

Shouldn't the -11, 14 testcase yield 11?

@notjagan Fixed.

I think I've misunderstood: shouldn't the cases resulting in 14 with 14 as k actually be 0? This is what I based my answer on.

@notjagan No. The function has a period of 2k. Zeroes only occur when x % 2k = 0.

x86-64 Machine Code, 18 bytes
97
99
31 D0
29 D0
99
F7 FE
29 D6
A8 01
0F 45 D6
92
C3

This code defines a function in x86-64 machine language that computes bounce(x, k). Following the System V AMD64 calling convention used on Gnu/Unix systems, the x parameter is passed in the EDI register, while the k parameter is passed in the ESI register. As with all x86 calling conventions, the result is returned in the EAX register.
To call this from C, you would prototype it as follows:
int Bounce(int x, int k);

Try it online!
Ungolfed assembly mnemonics:
; Take absolute value of input 'x' (passed in EDI register).
; (Compensates for the fact that IDIV on x86 returns a remainder with the dividend's sign,
; whereas we want 'modulo' behavior---the result should be positive.)
xchg   eax, edi      ; swap EDI and EAX (put 'x' in EAX)
cdq                  ; sign-extend EAX to EDX:EAX, effectively putting sign bit in EDX
xor    eax, edx      ; EAX ^= EDX
sub    eax, edx      ; EAX -= EDX

; Divide EDX:EAX by 'k' (passed in ESI register).
; The quotient will be in EAX, and the remainder will be in EDX.
; (We know that EAX is positive here, so we'd normally just zero EDX before division,
; but XOR is 2 bytes whereas CDQ is 1 byte, so it wins out.)
cdq
idiv   esi

; Pre-emptively subtract the remainder (EDX) from 'k' (ESI),
; leaving result in ESI. We'll either use this below, or ignore it.
sub    esi, edx

; Test the LSB of the quotient to see if it is an even number (i.e., divisible by 2).
; If not (quotient is odd), then we want to use ESI, so put it in EDX.
; Otherwise (quotient is even), leave EDX alone.
test   al, 1
cmovnz edx, esi

; Finally, swap EDX and EAX to get the return value in EAX.
xchg   eax, edx
ret

Note that the first section (that takes the absolute value) could have equivalently been written:
; Alternative implementation of absolute value
xchg    eax, edi
neg     eax
cmovl   eax, edi

which is the exact same number of bytes (6). The performance should be similar, perhaps slightly faster (except on certain Intel chips, where conditional moves are slow).
XCHG is, of course, relatively slow and would not be preferred over MOV except in code golfing (since the XCHG is 1-byte when one of the operands is the accumulator, whereas a register-register MOV is always 2 bytes).

Python 2, 29 27 bytes
lambda x,k:abs(x%k-x/k%2*k)

Try it online!

Jelly, 3 bytes
æ%A

Try it online!
Built-ins ftw.
Explanation
æ% is a useful built-in here. I don't know how to describe it, so I'll just provide the output for some inputs:
As x goes from 0 to infinity, xæ%4 goes 0,1,2,3,4,(-3,-2,-1,0,1,2,3,4,) where the part in parentheses is repeated to infinity both ways.

Python 3, 27 bytes
lambda x,k:k-abs(k-x%(k*2))

Try it online!

Ruby, 40 bytes 32 bytes
b=->(x,k){(x/k+1)%2>0?x%k:k-x%k}

Try it online!
Explanation
Hi, this is my first answer on this site!  This code is based on the observation that the bounce function behaves exactly like modulo when (n-1)k <= x < nk and n is odd, and behaves like a reversed modulo operation when n is even.  (x/k+1) is the smallest integer greater than x/k (which is x/k+1 rounded down to an integer).  Therefore, (x/k+1) finds the n mentioned above.  %2>0 checks to see if n is odd or even.  If n mod 2 > 0, then n is odd.  If n mod 2 = 0, then n is even.  If n is odd, then the bounce function should equal x mod k.  If n is even, the bounce function should be the reverse, equal to k - x mod k.  The whole expression (x/k+1)%2>0?x%k:k-x%k finds n, then executes the x mod k if it is odd, and executes k - x mod k otherwise.
The answer was improved based on a suggestion from Cyoce.

You can convert this to a lambda. Instead of def b(x,k) ... end use ->x,k{...}

And since you're dealing with integers, .to_i isn't necessary.

JavaScript (ES6), 36 32 bytes
k=>f=x=>x<0?f(-x):x>k?k-f(k-x):x

Recursively bounces x against 0 and k, so very much in the spirit of the challenge.

Mathematica, 19 bytes
Abs@Mod[#,2#2,-#2]&

Pyth, 5 bytes
aa%Ey

Verify all testcases.
Fork of my Python answer.

J, 25 bytes
Hint:

This is just regular modulo on the ladder numbers.  For example, in the case of 5: 0 1 2 3 4 5 4 3 2 1

Here is a (not yet well-golfed) solution in J.  Will try to improve tomorrow:
[ ((|~ #) { ]) (i.@>:,}:@i.@-) @ ]

compressed: [((|~#){])(i.@>:,}:@i.@-)@]
compressed2: [((|~#){])(<:|.|@}.@i:)@]
Try it online!

I feel like i: can be used here, but I haven't tried a solution yet

@ConorO'Brien check out my compressed2 version, it saves a few bytes using i:.  Just haven't had time to update the main one and provide an explanation.  I expect an expert could shave off another 4 or 5 bytes at least...

((|~#){])]-|@}:@i: for 18 bytes

@miles beautiful, tyvm

QBIC, 25 30 27 bytes
g=abs(:%:)~a'\`b%2|?b-g\?g

Did a bit of restructuring...
Explanation
g=abs(   )  let g be the absolute value of
       %    the (regular) modulo between
      : :   input a read from cmd line, and input b read from cmd line
~a \ b%2    IF the int division of A and B mod 2 (ie parity test) yields ODD
  ' `         (int divisions need to be passed to QBasic as code literals, or ELSE...)
|?b-g       THEN print bouncy mod
\?g         ELSE print regular mod

Does QBIC do something different for MOD operations than other Basic implementations do? Other Basics return MOD with the same sign as the dividend; that would fail when x is -13 and k is 14.

@CodyGray Nope, it gave -13. Fixed now.

Don't you need abs both times?

@Neil do you have a testcase for that?

@Neil nvm, I've fixed it by restructuring the whole thing.

You only need abs once, because k is guaranteed to be positive. Or, I guess if it's shorter, you can indeed just do the absolute value of the modulo operation, as in your revised version.

PHP, 40 50 bytes
damn dollars. damn import overhead. :)
integer version:
[,$x,$k]=$argv;$y=abs($x)%$k;echo$x/$k&1?$k-$y:$y;

or
[,$x,$k]=$argv;echo[$y=abs($x)%$k,$k-$y][$x/$k&1];

float version, 56 bytes:
Replace abs($x)%$k with fmod(abs($x),$k).

edit: fixed results for negative x

"Damn dollars". Yeah, money stinks...

How about €argv or £argv? Those would look nice :x

C89, 40 bytes
t;f(x,k){t=abs(x%k);return x/k%2?k-t:t;}

A C port of my x86 machine code answer, this defines a function, f, that calculates the bounce-modulo for the parameters x and k.
It uses C89's implicit-int rule, so that both parameters, the global variable t, and the function's return value are all implicitly of type int. The global variable t is just used to hold a temporary value, which ends up saving bytes, compared to repeating the computation on either side of the conditional operator.
The abs function (absolute value) is provided in the <stdlib.h> header, but we don't have to include it here, again thanks to C89's implicit-int rule (where the function is implicitly declared and assumed to return int).
Try it online!
Ungolfed version:
#include <stdlib.h>

int Bounce(int x, int k)
{
    int mod = abs(x % k);
    return (x/k % 2) ? k-mod : mod;
}

Looking at this in light of my hand-tuned machine code, compilers actually generate pretty good output for this. I mean, they should; it's a pretty simple function to optimize! I did uncover a minor bug in GCC's x86-64 optimizer, though, where it curiously produces larger code when you tell it to optimize for size and smaller code when you tell it to optimize for speed.

m;f(x,k){m=abs(x%k);x=x/k%2?k-m:m;} is shorter

Except that it doesn't actually return a value, @cows, other than under certain ill-defined circumstances due to a quirk of the GCC code generator on x86 targets. It's a template I see people use here, but it doesn't work for me, any more than pulling random garbage off the stack that just happens to be the correct answer.

Haskell, 37 Bytes
Try it online!
(!)=mod;x#k|odd$x`div`k=k-x!k|1<2=x!k

How to use:
Call as 15#14 for non-negative left arguments and as (-13)#14 for negative left arguments, because Haskell would interpret -13#14 as -(13#14) if you are using something like ghci. The TIO-link simply takes two command-line arguments.
Explanation:
First redefines the binary infix operator ! to be the same as mod. Haskell's mod always outputs a non-negative value, so we don't need the abs that other solutions here do. It then checks whether x/k (integer division) is odd and if so, returns k-x mod k (ie the back-bounce) or else it returns x mod k.

This is probably just a matter of taste, but I personally prefer not defining ! since it doesn't save any bytes over x#k|odd$x`div`k=k-x`mod`k|1<2=x`mod`k

Vyxal, 5 bytes
d%ε¹ε

Try it Online!
How?
d%ε¹ε
d     # Double the (implicit) first input
 %    # Modulo the (implicit) second input by this
  ε   # Take the absolute difference of this and the (implicit) first input
   ¹ε # Take the absolute difference of this and the first input again

C (gcc), 43 53 bytes
Edit: Fixed negative issue
int f(int x,int y){return x/y%2?abs(y-x%y):abs(x%y);}

Try it Online!

This provides the wrong answer for (-13, 14) (-13 instead of 13). The modulus and remainder operations behave different on negative numbers.

Common Lisp, 41 bytes
(lambda(x k)(- k(abs(-(mod x(* k 2))k))))

Try it online!

R, 28 bytes
pryr::f(abs((x-k)%%(2*k)-k))

Which evaluates to the function:
function (k, x)
abs((x - k)%%(2 * k) - k)

Which appears to be the method that most solutions use. I didn't look at them before making this.

MMIX, 20 bytes (5 instrs)
"xxd --jelly"
00000000: 1c02 0001 fe00 0006 24ff 0100 6600 02ff  ÷£¡¢“¡¡©$”¢¡f¡£”
00000010: f801 0000                                ẏ¢¡¡

disassembly and commentary
bounce  DIV  $2,$0,$1       // f:rR = x /% k
        GET  $0,rR          // rv = rR
        SUB  $255,$1,$0     // t = k - rv
        CSOD $0,$2,$255     // if(f odd) rv = t
        POP  1,0            // return rv

Not entirely sure what this does if k is negative, but it's probably the negative of bounce(x,k).

Haskell, 23 bytes
x#k=abs$mod(x-k)(2*k)-k

Try it online!
Boring port of everything else just to spite the existing answer for the pointless (!)=mod; ;).

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Who committed most?
Background
Sometimes, people think you didn't work at your git project. But - you can prove yourself with git shortlog -n. Now, the problem is you are a programmer and programmers are lazy. So you want to write a program which shows the person who committed at most.
Rules
You may not do the following things:

use git shortlog with the argument -s
use any alias, which calls git on any way

You may assume the following:

git is installed on the system
You are in the working directory of the repository where to find out the person
The output of git shortlog -n will be piped in your program, but you may also call the command in your program, even though I can't see the advantage.
If there is a language-specific package or library for git, you may use it.

The output
Your program has to output the name of the person with the most commits in the repo.
This is a code-golf challenge, so the program with the least amount of bytes wins!

Language-specific rules are typically frowned upon. Did you Sandbox this?

@musicman523 No, sorry, I forgot to. The rules are only are workaround for languages who can't directly call a command, but I'll change it.

Please specify what is wrong with the question if you downvoted.

Can we assume that the user has no ( in his name?

@ovs Yes, we can. It is realistic and anything else would be very annoying.

Could you add some input-output examples to the question?

@Leo Not at the moment, just clone any git repo and run the command

@Leo Here is an example output from Retina

Is a trailing space accepted in the output? Some of the current answers actively try to avoid it, while others don't

@Leo Yes, it is

Bash, 20 bytes
head -1|cut -d\( -f1

Try it online!

Bash, 18 bytes
sed -n 1s/.\(.*//p

Try it online!
sed, 11 bytes
Run with -n (counted as +1 byte).
1s/ (.*//p

Try it online!

Personally I would just call this a sed answer, not a Bash answer

Befunge-98, 10 bytes
~:'(-!#@_,

Try it online!

Retina, 8 bytes
s` \(.*

Try it online! Example input is the output from shortlog -n from Retina.

Python 3, 29 bytes
print(input().split(' (')[0])

Try it online! Example input is the output from shortlog -n from Retina.

AWK, 9 bytes
NR<2,NF--

Try it online!
This one is just a test, consisting of two statements, without any associated code block.  The first test NR<2 determines the truthy'ness of the test.  So the default code block, which is effectively print $0, is only run for the first line of the input.
The secondary statement, NF-- just drop the last field in the input line.

05AB1E, 4 bytes
'(¡¬

Try it online!

Version without trailing space: #¨ðý

Jelly, 4 bytes
ṣ”(Ḣ

Try it online!
My first Jelly answer!
How?
ṣ”(Ḣ - Main Link. Takes a string X on left
ṣ    - Split X on the occurrences of
 ”(  - Literal "("
   Ḣ - Head

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Make a Minecraft Crafting Table
Don't you hate it when you can't remember how to craft something in Minecraft? Well, time to remedy that!
Task
Your task is to take an input, either as a 1D or 2D list and output what item is a result of the crafting table!
Input
You may take input as either a string or a list of length 9 or a 2D nested array.
If you take input as a...
String
Each item in the table is 1 char in the printable ASCII character (0x20 to 0x7E). To represent an empty space, you use a - e.g. WWW-W-WWW would be the same as a crafting table like
+------+------+------+
| Wood | Wood | Wood |
+------+------+------+
|      | Wood |      |
+------+------+------+
| Wood | Wood | Wood |
+------+------+------+

You may also take input as a multiline string as long as all spaces are preserved e.g.
WWW
 W
WWW

1D array
You would take the input as a char array where empty spaces on the crafting table would be an empty char e.g. the above table would be ['W','W','W','','W','','W','W','W']
2D array
This time, each list represents a line on the crafting table, where an empty space is an empty char e.g. [['W','W','W'],['','W',''],['W','W','W']]
You can assume that the input will always correspond to an item that can be crafted, and if using array input, you may replace the empty char with any character not used as an abbreviated name.
Output
Output will be the item crafted from the input, in any form you want, as long as it is obvious what it means. (Personally, I would use my 1 letter abbreviations of the items)
Ingredients
For this challenge, wood means wooden planks, not wooden logs.
You only have to handle the most common items when crafting. These are the ingredients for crafting but may also be products of crafting. The crafting recipe follows the format xxxxxxxxx like the string input above. If an item cannot be crafted, --------- is placed instead.
Some recipes are shapeless, meaning that just so long as all items are there, the item will be made. These are denoted be a *. An example of this would be pumpkin pie (not one in this challenge) that only needs pumpkin, sugar and egg to be made.
   item name    | abb. name | crafting recipe
----------------+-----------+------------------
wood            |     W     | ---------
cobblestone     |     C     | ---------
sticks          |     S     | ----W--W-
iron            |     I     | ---------
gold            |     G     | ---------
diamond         |     D     | ---------
redstone        |     R     | ---------
string          |     N     | ---------
coal            |     Y     | ---------
sugar cane      |     U     | ---------
redstone torch  |     E     | -R--S----
paper           |     P     | ---------
book            |     B     | ---PL-PP-
wool            |     M     | ---NN-NN-
obsidian        |     O     | ---------
gunpowder       |     X     | ---------
sand            |     A     | ---------
glass           |     H     | ---------
feather         |     F     | ---------
flint           |     K     | ---------
torch           |     T     | ---------
leather         |     L     | ---------
material blocks |     Z     | QQQQQQQQQ (here Q represents any in `[G, I, R, D, Y]`
compass         |     V     | -I-IRI-I-

Products
This is a list of all the products that you could handle for crafting. if the item is also an ingredient, it will not be included here but you must still be able to handle it. Each one can be crafted using only the ingredients above and is designated a unique, lowercase letter to identify it. Armour (+) can use any ingredient in [G, I, L, D]. Weapons ($) can be made from [W, C, I, G, D]. As this is a code-golf site, however, we need to make these lists shorter. [G, I, L, D] is denoted by a Q and [W, C, I, G, D] is denoted by a J.
   item name    | abb. name | crafting recipe
----------------+-----------+------------------
crafting table  |     a     | -----WWWW
boots +         |     b     | ---Q-QQ-Q
pants +         |     c     | QQQQ-QQ-Q
chestplate +    |     d     | Q-QQQQQQQ
helmet +        |     e     | QQQQ-Q---
bed             |     f     | ---MMMWWW
chest           |     g     | WWWW-WWWW
wood door       |     h     | WW-WW-WW-
iron door       |     i     | II-II-II-
furnace         |     j     | CCCC-CCCC
trap door       |     k     | ---WW-WW-
TNT             |     l     | XAXAXAXAX
anvil           |     m     | ZZZ-I-III
axe $           |     n     | -JJ-SJ-S-
sword $         |     o     | -J--J--S-
pickaxe $       |     p     | JJJ-S--S-
hoe $           |     q     | JJ--S--S-
shovel $        |     r     | -J--S--S-
arrow           |     s     | -K--S--F-
bow             |     t     | SN-S-NSN-
bowl            |     u     | ---W-W-W-
gold nugget *   |     v     | ----G----
bucket          |     w     | ---I-I-I-
clock           |     y     | -G-GRG-G-
map             |     z     | PPPPVPPPP
fishing rod     |     1     | --S-SNS-N
flint and steel |     2     | ----I---K
shears          |     3     | ---I---I-
wood button *   |     4     | ----W----
dropper         |     5     | CCCC-CCRC
stone button *  |     6     | ----C----
jukebox         |     7     | WWWWDWWWW
lever           |     8     | ----S--C-
noteblock       |     9     | WWWWRWWWW
piston          |     0     | WWWCICCRC
pressure plate  |     !     | ------WW- (W can also be replaced with C/I/G)
repeater        |     @     | ---ERECCC
tripwire hook   |     #     | -I--S--W-
activator rail  |     (     | ISIIEIISI
boat            |     %     | ---W-WWWW
minecart        |     ^     | ---I-IIII
powered rail    |     &     | G-GGSGGRG
rail            |     )     | I-IISII-I
stone wall      |     {     | ---CCCCCC
fence gate      |     }     | ---SWSSWS
fence panel     |     [     | ---SSSSSS
glass pane      |     ]     | ---HHHHHH
iron bars       |     ;     | ---IIIIII
item frame      |     :     | SSSSLSSSS
ladder          |     '     | S-SSSSS-S
sandstone       |     "     | -----AAAA
slabs           |     |     | ---CCC---
stairs          |     <     | W--WW-WWW
bookshelves     |     >     | WWWBBBWWW
carpet          |     .     | -------MM
painting        |     ,     | SSSSMSSSS
sign            |     ?     | WWWWWW-S-
cauldron        |     /     | I-II-IIII
enchant. table  |     `     | -B-DODOOO
glass bottle    |     ~     | ---H-H-H-
rocket *        |     _     | -----PXXX

Scoring
As it would be unreasonable to ask you to do all of these recipes, you only have to do the ones that you want! But of course, the more that you do, the better your score.
Score is defined as
score = length of program in bytes / number of working recipes squared

For example, this could be a submission.
input()
print('S')

As you can assume that the input passed will be one that it can handle (----W--W-), it will always output S, which is equivalent to sticks. This would score 18 / 1 = 18.
You must take input to be a valid program and you must be able to handle at least 5 different inputs.
The person with the lowest score wins.
Rules

Lowest score wins
You may take input using any accepted method (function parameters, STDIN etc)
You can only take input in one of the above forms. It isn't too restrictive and should be workable
Standard loopholes are disallowed
You must take input
You must output at least 5 correct results to qualify as competing.
For recipes that are shapeless, e.g. gold nuggets, different combinations do not count as different recipes. ----W---- is the same (recipe-wise) as --W------ and is only 1 recipe.
On the flip side of this, for recipes that use more than one material, such as material blocks, each different material counts as a different recipe, meaning that IIIIIIIII is not the same (recipe-wise) as RRRRRRRRR.

Good luck, Minecrafters!

sticks may be crafted by W--W-----, -W--W----, --W--W---, ---W--W--, ----W--W-, or, -----W--W. do we need handle only one of these or all of these?

may I take input as an array of strings? (e.g. ["WWW", "CIC", "CRC"])

May we take code to evaluate recipes from the original Minecraft source code? I actually do some modding from time to time.

This challenge is interesting, I'll be doing it. I think I can do 14 chars per recipe, which is quite bad :l I'll investigate this when I have time.

@tsh as sticks doesn't have a * next to it, it must be as specified in the question.

@dzaima yes of course

@racer290 if you mean use the code from Minecraft itself, I'm going to say yes, but you must specify that in the answer.

Answers in Minecraft Code, 5 bytes

@MagicOctopusUrn Minecraft is written in Java so no way that's possible :p

Probably racer290 is meant to regard Minecraft code base as a library...

Minecraft Code: Input is as a configuration on a crafting table, and output is the output from the crafting table. Easy. :p /s

Python 2, Score: 0.0636347
715 bytes, all 106 recipes
import zlib,base64
i=input()
x=`sorted(i)`[2::5]
W=zlib.decompress(base64.b64decode('eNpVUglywyAMfJEeEUPqaoKPQTPFzf8fUq0O6iyyLJsFLUhERMOM6Gx0ngj2HWYYijXBiZ6oid8EM7nZYhhW0orvTiS2qxK6PhHCmO+B527UYK3dA5+qVGG13gOf0lyr5YyAUjxN+SZDKPZsLXawXXxKsW3bcNB8wYrC3PWI8X6/7RiMaRlYrhQpCPSnMAIVIisCzSEVgV87yGYgm4FsBrKZJFOSKcmUZEoy1V7mv5KjaxeqRz2Og+i/rE7GaSyAfgtwcxbgOvI2DOB+/gH39ue8rkt2/drF+mfY8CpbVYVk19lT8QOHavXoDo7H/QsSa1Rg9HgXLqWXKEEvRHknIW4ebyqOgHkqhn/2p/JZmJ+s3qV6ledxvGHQP7KqyI9GlejS4lqIvm1AzhCYopmn8OAYTIx3oeKh0KzLsnjy2W1RIMe2YRNzSGH4AwHh7JI='))
d={W[l:l+9]:'SBMaZZZZZikeEVbcebcebcebcddqddqfghjlmnnnnnooooorrrrrs#`4ppppp6qvq_tuw1zy3279058|!!!!@(%q^&/){~}:\'];"><?.,['[l/9]for l in range(0,len(W),9)}
if i in d:x=i
print d[x]

Try it online!
Handles all the specified recipes, including material variations.
Creates a dictionary of all working recipes (with length 9).
The shapeless recipes are included by sorting the input string, and checking those against the dictionary.
Edit: Switched to string compression, and saved 7 bytes in the code thanks to  notjagan

I count 110 recipes

-7 bytes.

@dzaima Armor only has 4 vairants (GILD) so i count 106

@TFeld oh yeah, coal armor doesn't exist :|

Mathematica, score: 0.0482378 0.0540228 0.0543788
542 607 611 bytes, all 106 recipes
-4 bytes for rearranging compressed data
-65 bytes for losing the ability to deal with invalid inputs
"4/a[:chwpb?_oqjB%',>!6aM7^s<S@1|dfi~g38y&.nz}25#0r;]`mVe{v)b\"l9(tZE"~StringTake~{#&@@Join@@StringPosition[Uncompress@"1:eJw9UVuOgzAMrHoS9yglsGnUJkAsLYj92wv0/n+dsU3HZoAwfnL7f3f9u14uEtiKFDrIXgHc9IsXaQWEjo/uQDHjFxU6gt0MfiKy7Psuq9CVKVycACcoXrIsEQ6oF3euJBwOw+CNAUwSSNZx9NManSnGmCLmelrRH+R38ebFxO5Tn6wNFGwqjUmtK85rwHOtFVElNsWoh5mV+dbyy2ohQZbcs5hlzXx21MoBlEtbgF8SgzbMqRJJnrGfnviqsZpU7OTcIbUlftzDIIOM8zjP83EcPjy5x29aJRaXUmzekClUk/rUIbsD+2kcspOonKjXhhYaeD0hPbr6AOvmjtk=",#<>""&/@{v=#/.""->" ",Sort@v,v/.(#|##2&@@Characters@"GLIDWCYR"->"Q")}]/9+8/9}&

Take input as 1D-list {"W", "W", "", "", ...}
Expanded & clear version:
TableOfNames~StringTake~{# & @@
      Join @@ StringPosition[
        Uncompress@CompressedRecipeTable,
        # <> "" & /@ {v = # /. "" -> " ", Sort@v,
          v /. (# | ##2 & @@ Characters@"GLIDWCYR" -> "Q")}]/9 + 8/9}
 &

The big Uncompress is a string table of all combinations, joined together.
"        WI II IIII     WWWW   SSSSSSSSSSLSSSSQQQQ QQ QWW WW WW    I \
I I QQQ S  S    W W W WWWWWW S      PXXX Q  Q  S QQ  S  S CCCC CCCC   \
PL PP    W WWWWS SSSSS SSSSSMSSSSWWWBBBWWW      QQ         C   WW WW  \
  NN NN WWWWDWWWW   I IIII K  S  F W  WW WWW    W  W    ERECCC  S SNS \
N   CCC   Q QQQQQQQ   MMMWWWII II II    H H H WWWW WWWW   I   I     S \
 C  G GRG G G GGSGGRG       MM QQ SQ S PPPPVPPPP   SWSSWS    I   \
KCCCC CCRC I  S  W WWWCICCRC Q  S  S    IIIIII   HHHHHH B DODOOOZZZ I \
III I IRI I QQQQ Q      CCCCCC        GI IISII I   Q QQ Q     \
AAAAXAXAXAXAXWWWWRWWWWISIIEIISISN S NSN QQQQQQQQQ R  S    "

StringPosition looks for matching in a order of: input itself, sorted input (for shapeless recipe), armour, weapon, pressure plate.
# & @@ Join @@ returns the position of first occurence.
/9+8/9 calculates the index in result table and StringTake takes the character at that position.

SOGL V0.12, 325 322 317 316 bytes / 106^2 = score 0.0281238875
3∫HA"-?%mΛe*▓╔Υι§ā⅜β¬kēōΠ»t ‰CV↓ZΟΚΨpΝ∫3υ≤↕‰č⅛c╚≤Æ⁷/←;[piυ¦╗⌠⁄⁸qη╔@O;┐√)cR█9ιZ׀l»░(■DΛQ-╥76PT─ō4ο3ū^╝/9»¾κλCβ׀+!'▼vw-№█⁷$▒d`Σ⅟Ιž⁴n≡,`!m≤Σ═╥∫Κ‽∆Q>+g=¼⁾⁽D┐?─D○≠6τ╝ZTΞķ⅜∑²V=]4Æ⁴℮lT$¡sψī1 ◄δ)⅞/Σ/Δō»ņe#≥ζz⅛yB÷B⅞⁵Kβn┘g⁵ķ»<§└≡↓θ○‼¼ņΔε⁄z‼Ζ∙Φ6β⅜c≈Νycm!=V○Jεκ~  :I)ΩS‘U9ndW:? ~Δ" $*+-=\x”Z+čøŗ"SEBMZV”+W←,a‽"9╚πw⁽νQσ_‘č┌ŗD}a?□D

Explanation:
3∫                    3 times repeat (on each it'll try something else)
  HA                    save 1-indexed iteration - 1 on variable A
    "..‘                push a string of the recipes
        U               uppercase it (as lowercase was ~7 bytes shorter)
         9n             split into and array of strings of length 9
           d            load the variable D (by default string input)
            W           get the variables 1-based index in that array, 0 if not found
:?                  ←   if [it isn't 0], leaves the input on the stack
   ~Δ                     get the ascii characters from space to ~ (inclusive)
     "..”                 push " $*+-=\x", the characters that are in the ASCII but not used
         Z+               add the uppercase alphabet to that (as most of it can't be outputted)
           čøŗ            filter those out
              "..”+       append to it the uppercase characters that are used - "SEBMZV"
                   W      get in the finished string the character at the index gotten before the if
                    ←     exit, outputting that
       ,                push the input
        a‽        }     if the 0-based index is not [0] (aka if this is the 1st time in the loop)
          "..‘            push "RDYWCDCIGL" - characters that are either of the groups of Q, J or the pressure plate
              č┌ŗ         replace [in the pushed input, each of those characters, with a dash]
                 D        save on variable D - used in the IF above
                   a?   if the 0-based index [is == 0] (aka if this is the 2st time in the loop, soon-to-be 3rd/last)
                     □    sort [the previously pushed input]
                      D   save on the variable D

Try it Here! or test by running the following (which will say what's wrong):

var arr = `      WW  !\n      CC  !\n      II  !\n      GG  !\n     AAAA "\n I  S  W  #\n   W WWWW %\nG GGSGGRG &\nS SSSSS S '\nISIIEIISI (\nI IISII I )\nSSSSMSSSS ,\n       MM .\nI II IIII /\nWWWCICCRC 0\n  S SNS N 1\n    I   K 2\n   I   I  3\n        W 4\nW         4\n    W     4\n      W   4\nCCCC CCRC 5\n        C 6\n     C    6\nC         6\nWWWWDWWWW 7\n    S  C  8\nWWWWRWWWW 9\nSSSSLSSSS :\n   IIIIII ;\nW  WW WWW <\nWWWBBBWWW >\nWWWWWW S  ?\n   ERECCC @\n   SSSSSS [\n   HHHHHH ]\n   I IIII ^\n     PXXX _\n XP    XX _\nX   XP  X _\nXXXP      _\n B DODOOO \`\n   G GG G b\nGGGG GG G c\nG GGGGGGG d\nGGGG G    e\n   I II I b\nIIII II I c\nI IIIIIII d\nIIII I    e\n   L LL L b\nLLLL LL L c\nL LLLLLLL d\nLLLL L    e\n   D DD D b\nDDDD DD D c\nD DDDDDDD d\nDDDD D    e\n   MMMWWW f\nWWWW WWWW g\nWW WW WW  h\nII II II  i\nCCCC CCCC j\n   WW WW  k\nXAXAXAXAX l\nZZZ I III m\n WW SW S  n\n W  W  S  o\nWWW S  S  p\nWW  S  S  q\n W  S  S  r\n CC SC S  n\n C  C  S  o\nCCC S  S  p\nCC  S  S  q\n C  S  S  r\n II SI S  n\n I  I  S  o\nIII S  S  p\nII  S  S  q\n I  S  S  r\n GG SG S  n\n G  G  S  o\nGGG S  S  p\nGG  S  S  q\n G  S  S  r\n DD SD S  n\n D  D  S  o\nDDD S  S  p\nDD  S  S  q\n D  S  S  r\n K  S  F  s\nSN S NSN  t\n   W W W  u\n        G v\n      G   v\n   G      v\nG         v\n   I I I  w\n G GRG G  y\nPPPPVPPPP z\n   CCCCCC {\n   CCC    |\n   SWSSWS }\n   H H H  ~\n    W  W  S\n R  S     E\n   PL PP  B\n   NN NN  M\nGGGGGGGGG Z\nIIIIIIIII Z\nLLLLLLLLL Z\nDDDDDDDDD Z\n I IRI I  V`.split("\n");
toLog = "";
arr.forEach(f=>{
  inputs.value = f.substring(0,9);
  runClicked();
  correct = f.charAt(10);
  got = output.value;
  if (got != correct)
    toLog+= "\""+ inputs.value +"\": expected \""+ correct +"\", got \""+ got +"\".";
})
console.log(toLog);

Jelly, score 0.00173611111
4/(48^2) = 0.00173611111 score
OṢḄỌ

Takes input as string with hyphens for empty space, e.g. -----WWWW.
I think this is valid because the challenge says

Output will be the item crafted from the input, in any form you want, as long as it is obvious what it means. (Personally, I would use my 1 letter abbreviations of the items)

The 1 letter abbreviations are about as confusing as what this outputs, so this output is obvious enough what it means.
This assumes the input can be one the program can handle as specified by

you can assume that the input passed will be one that it can handle

Try it online!
Test Suite (Header and footer prettify the output) This does all 48 recipes and gives their names.
How it Works
This is really just a really poor hash function.
OṢḄỌ - main link, input e.g. ZZZ-I-III
O      - character codes e.g. [90, 90, 90, 45, 73, 45, 73, 73, 73]
 Ṣ     - sort. This helps shapeless recipes and keeps recipes such as TNT in CJK
           e.g. [45, 45, 73, 73, 73, 73, 90, 90, 90]
  Ḅ    - convert from binary to integer e.g. 26670
   Ọ   - chr: convert from integer to character e.g.栮


text:
Chicken McNugget Numbers
Description
Chicken McNugget numbers are numbers that can be expressed as a sum of \$6\$, \$9\$ or \$20\$ - the initial sizes of the famous Chicken McNuggets boxes sold by McDonald's. In that sum, a number may occur more than once, so \$6 + 6 = 12\$ is such a number too, and the number must "contain" at least one of the mentioned sizes. The first Chicken McNugget numbers are:
\begin{align*}&6\\
    &9\\
    &6 + 6 = 12\\
    &6 + 9 = 15\\
    &9 + 9 = 6 + 6 + 6 = 18\\
    &20\\
    &6 + 6 + 9 = 21\\
    &\dots
\end{align*}
Challenge
Your task is to write a program or function, that, given a positive integer, determines whether this number can be expressed in the described way, therefore is such a Chicken McNugget number. It should then output a truthy or falsy value based on its decision.
Test cases
6 -> true
7 -> false
12 -> true
15 -> true
21 -> true
40 -> true
42 -> true

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

It should be noted that "All integers are McNugget numbers except 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23, 25, 28, 31, 34, 37, and 43." (mathworld)

Well, then let's take it as a compression challenge, but thanks for the note

@Leaky Nun Also, I haven't spotted a proof for that yet..

@racer290 With 6 and 9 you can get to any multiple of 3 which is >3. By subtracting 0,20,40 from your number you will get to a multiple of 3 and therefore there can't be any McNuggets number >43.

Related

@HyperNeutrino Hell yea when i posted it on meta another one was mentioned but not this one.

Anybody have an OEIS link for this???

What do you have against the 4 piece nugget pack?  https://www.mcdonalds.com/us/en-us/product/chicken-mcnuggets-4-piece.html

@LeakyNun it's not a competitive approach though heh... https://codegolf.stackexchange.com/a/132856/59376

numberphile...

Python, 27 bytes
lambda n:0x82492cb6dbf>>n&1

Try it online!

What is this magical code o_O this is amazing

You can remove the ~ because you can swap the outputs.

Also, 8953174650303 has the exact same length with 0x82492cb6dbf (albeit less readable).

@HyperNeutrino the magic number has only those bits set which correspond to numbers that are not Chicken McNugget numbers. Look at its binary representation and it'll be much clearer.

@DavidZ Oh hm. That is very smart. Nice.

Shame you can't easily use this same idea with base 64

Shouldn’t you add ^1? It’s supposed to say true for CMNN.

@FrownyFrog See this comment.

Python 3, 24 bytes
lambda n:0<=n--n%3*20!=3

Try it online!
Explanation
With 6 and 9 alone, one can make all integers divisible by 3 which are greater than 3, as is stated in ovs's comment to the challenge. It is assumed that one can also make 0. In conclusion, one can make 0,6,9,12,15,....
With one instance of 20, one can make: 20,26,29,32,35,....
With two instances of 20, one can make: 40,46,49,52,55,....
Three instances is never necessary, for 3 x 20 = 10 x 6.

Notice that the cases where no 20 is needed is also divisible by 3; the cases where one 20 is needed leaves a remainder of 2; the cases where two 20 is needed leaves a remainder of 1.
The number of 20 needed can hence be calculated by (-n)%3. Then, we do n-(((-n)%3)*20) to remove the number of 20 needed from the number. We then check that this number is non-negative, but is not 3.

39 bytes

@Mr.Xcoder updated.

f=lambda n:n%3<1<n-2or n>20and f(n-20) does that work?

@Zacharý thanks, updated.

37 bytes.

@notjagan wow, I didn't know that chaining is short-circuiting.

You can remove the f= now since it's not recursive.

@xnor Is it ok now?

Ah, you ninja'd me! I was about to suggest this, but yours is shorter anyhow.

Yes, checked it. Nice method!

i'm assuming there is a general mathematical theory similar to the technique used here, for solving generalized versions of the same problem.  do you know what it's called?

@Jonah Chinese Remainder Theorem?

@LeakyNun that'll do just fine.  ty.

Looks like the post has been updated to exclude 0; I think that saves you a byte?

@DavidZ The 0 is still needed for 20 and 40.

Ah, true. But still the function currently gives an incorrect result for input 0.

Python 2, 28 bytes
lambda n:-n%3-n/20<(n%20!=3)

Try it online!

Using some trial-and-error and mapping the first part to the range, I have a rough idea of how it works. However, I would like to know how you came up with this solution.

@LeakyNun Funny, I thought this was the natural method and yours was the clever one :). I noted the possible values of (n%3,n/20) from your excluded list are {(2, 0), (1, 0), (1, 1)}. Using -n%3 instead gave an inequality n/20>=(-n)%3. From there, I fiddled a while to reverse {3,23,43} which are 3 mod 20 without affecting 63,83,... I found shifting the inequality endpoint for these worked nicest.

Well my method involves really solving the problem whereas your method is fiddling with the values in the excluded list, so I'd say that my method is more natural :)

Jelly, 11 bytes
ṗ3’æ.“©µÞ‘ċ

Try it online!
How it works
ṗ3’æ.“©µÞ‘ċ  Main link. Argument: n

ṗ3           Cartesian power; yield all 3-tuples over [1, ..., n].
  ’          Decrement all coordinates.
     “©µÞ‘   Yield [6, 9, 20].
   æ.        Take the dot product of each 3-tuple and [6, 9, 20].
          ċ  Count the occurrences of n (Positive for Chicken McNuggets numbers).

Chicken McNuggets™ and Jelly! Mmmm!!!

@CJDennis Actually it's Chicken McNuggets© and Jelly.

@cairdcoinheringaahing Actually it's Chicken McNuggets® and Jelly.

Haskell, 36 bytes
f n|n<1=n==0
f n=any(f.(n-))[6,9,20]

Try it online!
Explanation
This solution is about as straightforward as it can get.  The first line declares that for any number less than 1 it is a McNugget number if n==0.  That is to say that 0 is a McNugget number and all negative numbers are not.
The second line declares that for all other numbers, n is a McNugget number if it minus any of the Nugget sizes is a McNugget number.
This is a pretty simple recursive search.

Mathematica, 20 bytes
0<=#-20Mod[-#,3]!=3&

Anonymous function. Takes a number as input and returns True or False as output. Logic copied from Leaky Nun's answer, with some added abuse of Inequality.

x86-64 Machine Code, 22 bytes
48 B8 41 92 34 6D DB F7 FF FF 83 F9 40 7D 03 48 D3 E8 83 E0 01 C3

The above bytes define a function in 64-bit x86 machine code that determines whether the input value is a Chicken McNugget number. The single positive integer parameter is passed in the ECX register, following the Microsoft 64-bit calling convention used on Windows. The result is a Boolean value returned in the EAX register.
Ungolfed assembly mnemonics:
; bool IsMcNuggetNumber(int n)
; n is passed in ECX
    movabs  rax, 0xFFFFF7DB6D349241   ; load a 64-bit constant (the bit field)
    cmp     ecx, 64
    jge     TheEnd                    ; if input value >= 64, branch to end
    shr     rax, cl
TheEnd:
    and     eax, 1                    ; mask off all but LSB
    ret

Obviously, this plays heavily off of Anders Kaseorg's solution in Python, in that it is based around a bit-field representing the values that are Chicken McNugget numbers. Specifically, each bit in this field that corresponds to a valid Chicken McNugget number is set to 1; all other bits are set to 0. (This considers 0 to be a valid Chicken McNugget number, but if you don't like that, your preference is a single-bit modification away.)
We start off by simply loading this value into a register. It is a 64-bit value, which already takes 8 bytes to encode, plus we need a one-byte REX.W prefix, so we are really being quite spendthrift in terms of bytes, but this is the heart of the solution, so I guess it's worth it.
We then shift the field right by the input value.* Finally, we mask off all but the lowest-order bit, and that becomes our Boolean result.
However, since you cannot shift by more than the number of bits actually in the value, this works only for inputs from 0–63. To support higher input values, we insert a test at the top of the function that branches to the bottom of the input value is >= 64. The only thing interesting about this is the we preload the bit-field constant in RAX, and then branch down to the instruction that masks off the lowest-order bit, thus ensuring that we always return 1.
Try it online!
(The C function call there is annotated with an attribute that causes GCC to call it using the Microsoft calling convention that my assembly code uses. If TIO had provided MSVC, this wouldn't be necessary.)
__
* As an alternative to a shift, we could have used the x86 BT instruction, but that's 1 byte longer to encode, so no advantage. Unless we were forced to use a different calling convention that didn't conveniently pass the input value in the ECX register. This would be a problem because SHR requires that its source operand be CL for a dynamic shift count. Therefore, a different calling convention would require that we MOVed the input value from whatever register it was passed in to ECX, which would cost us 2 bytes. The BT instruction can use any register as a source operand, at a cost of only 1 byte. So, in that situation, it would be preferable. BT puts the value of the corresponding bit into the carry flag (CF), so you would use a SETC instruction to get that value in an integer register like AL so it could be returned to the caller.

Alternative implementation, 23 bytes
Here is an alternative implementation that uses modulo and multiplication operations to determine whether the input value is a Chicken McNugget number.
It uses the System V AMD64 calling convention, which passes the input value in the EDI register. The result is still a Boolean, returned in EAX.
Note, though, that unlike the above code, this is an inverse Boolean (for implementation convenience). It returns false if the input value is a Chicken McNugget number, or true if the input value is not a Chicken McNugget number.
                    ; bool IsNotMcNuggetNumber(int n)
                    ; n is passed in EDI
8D 04 3F            lea    eax, [rdi+rdi*1]   ; multiply input by 2, and put result in EAX
83 FF 2B            cmp    edi, 43
7D 0E               jge    TheEnd             ; everything >= 43 is a McNugget number
99                  cdq                       ; zero EDX in only 1 byte
6A 03               push   3
59                  pop    rcx                ; short way to put 3 in ECX for DIV
F7 F1               div    ecx                ; divide input value by 3
6B D2 14            imul   edx, edx, 20       ; multiply remainder of division by 20
39 D7               cmp    edi, edx
0F 9C C0            setl   al                 ; AL = (original input) < (input % 3 * 20)
                 TheEnd:
C3                  ret

What's ugly about this is the need to explicitly handle input values >= 43 by a compare-and-branch at the top. There are obviously other ways of doing this that don't require branching, like caird coinheringaahing's algorithm, but this would take a lot more bytes to encode, so isn't a reasonable solution. I figure I'm probably missing some bit-twiddling trick that would make this work out more elegantly and be fewer bytes than the bitfield-based solution above (since encoding the bitfield itself takes so many bytes), but I've studied this for a while and still can't see it.
Oh well, try it online anyway!

Jelly, 11 bytes
_20$%3$¿o>3

Try it online!
Port of my Python answer, but slightly modified: subtract 20 until divisible by 3, then check whether it belongs to 0,6,9,... by mapping 0 to the input (by using or), and then check if it is greater than 3.
The only three numbers that produce 0 upon completing the first step is 0, 20, or 40, with the first one being out of the domain, and the rest being greater than 3.

I dont get how to enter the input..

@racer290 Command-line argument.

Python 3, 48 46 42 bytes
lambda n:n+50in b'2345679:<=?@BCEHIKNQTW]'

Try it online!
Switches True and False.

You can switch True and False by default

Mathematica, 53 bytes
!Flatten@Table[Tr/@Tuples[{6,9,20},i],{i,#}]~FreeQ~#&

Maybe you can use the FrobeniusSolve function.

Mathematica, 30 bytes
{6,9,20}~FrobeniusSolve~#!={}&

Try it on Wolfram Sandbox.

05AB1E, 17 16 bytes
ŽGç₂в©IED®âO«]I¢

Try it online!
Explanation
  ŽGç₂в                 The list [6, 9, 20]
       ©                Store this list in register_c
        IE              Loop <input> number of times
           ®â           Cartesian product stack contents with list in register_c
             O          Sum up the contents of each sub array
          D   «         List duplicated before taking Cartesian product, concat
               ]        End for loop
                I¢      Count occurences of input

You have duplicate TIO links.

Nice answer. Welcome to PPCG and the world of 05AB1E. :) One thing to golf is to use … for the string (there are buitins for 1-, 2-, and 3-char strings, being ', „, and … respectively). I have the feeling more can be golfed, perhaps by using a different approach, but regardless this is a nice first answer. +1 from me.

Was indeed correct. Found a 12-byter by utilizing the builtin Åœ: … ÇIÅœåPOĀ. It's a completely different approach, so if you want me to post it as a separated answer rather than a golf of yours, let me know. PS: I'm not 100% sure if the unprintables are allowed in the 05AB1E codepage. It might have to be in a different encoding in that case, which would make some characters count as 2 bytes each instead.. In that case ŽBo21в could be an alternative for +1 byte.

Like Kevin mentions, neither of the 3 bytes in your string are in the 05ab1e code page and thus can't be used without counting the whole program in utf-8 which would make it a lot longer. You can however use ŽGç₂в instead of the string while simultaneously saving a byte in the process.

Kevin, go for it. It'd be nice to see different approaches.
Emigna, thanks for you suggestion, I will make the change

JavaScript (ES6), 69 64 bytes
n=>'ABCDEFHIKLNOQRTWXZ]`cfl'.includes(String.fromCharCode(n+65))

f=
n=>'ABCDEFHIKLNOQRTWXZ]`cfl'.includes(String.fromCharCode(n+65))
<input onkeydown=a.innerHTML=f(this.value)>
<pre id=a>

Outputs false for Chicken McNugget numbers, true otherwise.

I'd like at least a "try it" link..

@racer290 Added.

n=>~'ABCDEFHIKLNOQRTWXZ]`cfl'.search(String.fromCharCode(n+65)) for 63 bytes

Java, 21 57 24 bytes
Try it online!
Golfed:
n->(n-=n*2%3*20)>=0&n!=3

Ungolfed:
import java.util.*;

public class ChickenMcNuggetNumbers {

  private static final Set<Integer> FALSE_VALUES = new HashSet<>(Arrays.asList(
    new Integer[] { 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23,
    25, 28, 31, 34, 37, 43 }));

  public static void main(String[] args) {
    for (int i = 0; i < 45; ++i) {
      System.out.println(i + " -> expected=" + !FALSE_VALUES.contains(i)
        + ", actual=" + f(n->(n-=n*2%3*20)>=0&n!=3, i));
    }
  }

  public static boolean f(java.util.function.Function<Integer, Boolean> f, int n) {
    return f.apply(n);
  }
}

Result is wrong for 26 = 20 + 6.

@LeakyNun Algorithm was too naive. I had to go with plan B which added some bytes, but appears to produce correct results all of the time now. I should have iterated all of the values to begin with instead of relying on the test cases in the question.

35 bytes

25 bytes (with community override on 0)

24 bytes (see above)

@LeakyNun thanks! I still have a lot to learn about golfing.

Could golf a byte with "&n>3" instead of "&n!=3"

Add++, 35 bytes
D,f,@,A6$%0=@20$%0=A3$%0=A8<A43<s1<

Try it online!
Look ma, no while loops. Or strings. Or lists. Or really anything that helps save bytes. But mainly because Add++ doesn't know what any of those are.
3 months later, I realised that this was invalid, and fixed it. Somehow, that golfed it by 13 bytes. This is a function that takes one argument and tests whether that argument is a Chicken McNugget number or not.
How it works
D,f,@,                        - Create a monadic (one argument) function called f (example argument: 3)
A                             - Push the argument again; STACK = [3 3]
 6                            - Push 6;                  STACK = [3 3 6]
  $                           - Swap the top two values; STACK = [3 6 3]
   %                          - Modulo;                  STACK = [3 3]
    0                         - Push 0;                  STACK = [3 3 0]
     =                        - Are they equal?          STACK = [3 0]
      @                       - Reverse the stack;       STACK = [0 3]
       20                     - Push 20;                 STACK = [0 3 20]
         $                    - Swap the top two values; STACK = [0 20 3]
          %                   - Modulo;                  STACK = [0 3]
           0                  - Push 0;                  STACK = [0 3 0]
            =                 - Are they equal?          STACK = [0 0]
             A                - Push the argument;       STACK = [0 0 3]
              3               - Push 3;                  STACK = [0 0 3 3]
               $              - Swap the top two values; STACK = [0 0 3 3]
                %             - Modulo;                  STACK = [0 0 0]
                 0            - Push 0;                  STACK = [0 0 0 0]
                  =           - Are they equal?          STACK = [0 0 1]
                   A          - Push the argument;       STACK = [0 0 1 3]
                    8         - Push 8;                  STACK = [0 0 1 3 8]
                     <        - Less than;               STACK = [0 0 1 0]
                      A       - Push the argument;       STACK = [0 0 1 0 3]
                       43     - Push 43;                 STACK = [0 0 1 0 3 43]
                         <    - Less than;               STACK = [0 0 1 0 0]
                          s   - Sum;                     STACK = [1]
                           1  - Push 1;                  STACK = [1 1]
                            < - Less than;               STACK = [0]

Python 2, 51 bytes
-1 byte thanks to @LeakyNun
lambda n:max(n>43,25<n>n%3>1,5<n>n%3<1,n in[20,40])

Try it online! Footer prints all non McNugget numbers

n%3 can only be 0 or 1 or 2, so n%3==2 is equivalent to n%3>1.

Pyth, 15 bytes
fg.{CM"     "{T./

Try it online!
The string contains the characters corresponding to codepoints 6, 9, and 20.

Javascript, 92 78 72 bytes
*saved 14 bytes thanks to @Jonasw
a=>!(a in[0,1,2,3,4,5,7,8,10,11,13,14,16,17,19,22,23,25,28,31,34,37,43])

Uses the fact that "All integers are McNugget numbers except 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23, 25, 28, 31, 34, 37, and 43." from @LeakyNun's comment

using a simple array would save the bytes for .split ...

@Jonas array is 108 bytes, splitted string is 73 bytes

um http://jsbin.com/bucihuqefi/edit?console   -11 bytes...

APL (Dyalog), 19 bytes
⊢∊6 9 20+.×⍨∘↑∘⍳3⍴⊢

with ⎕IO←0
Same algorithm with Dennis's answer
Try it online!

Haskell, 64  56 bytes
I didn't do any bit trickery, but looking at the other answers it might actually be shorter to import the Bits module and use those methods. This approach checks much more directly.
f x=(\l->elem x[i*6+j*9+k*20|i<-l,j<-l,k<-l,x/=0])[0..x]

The byte count is 66 not 64. But you you can save a lot of parenthesis and put an x/=0 guard to save some bytes, see here.

Excel, 87 bytes
=AND(OR(MOD(A1,3)*MOD(A1,20)*IF(A1>43,MOD(A1-40,3),1)*IF(A1>23,MOD(A1-20,3),1)=0),A1>5)

Alternatively, 92 bytes:
=CHOOSE(MOD(A1,3)+1,A1>3,IF(A1>43,MOD(A1-40,3)=0,A1=40),IF(A1>23,MOD(ABS(A1-20),3)=0,A1=20))

Retina, 26 bytes
.+
$*
^(1{6}|1{9}|1{20})+$

Try it online!

PHP, 69+1 bytes
for($n=$argn;$n>0;$n-=20)if($n%3<1)for($k=$n;$k>0;$k-=9)$k%6||die(1);

exits with 1 for a Chicken McNugget Number, 0 else.
Run as pipe with -n or try it online.

Jelly, 10 bytes
Œṗḟ€“©µÞ‘Ạ

Try it online!
Outputs in the opposite direction; returning false indicates that the input is a Chicken McNugget number. The TIO footer swaps this for you.
How it works
Œṗḟ€“©µÞ‘Ạ - Main link. Takes an integer n on the left
Œṗ         - Integer partitions of n; all ways to sum integers to n
    “©µÞ‘  - Yield [6, 9, 20]
   €       - Over each partition P:
  ḟ        -   Remove all 6s, 9s and 20s
         Ạ - Are all resulting lists non-empty?

Python 2, 61 bytes
lambda n:n in[int(c,36)for c in'1234578ABDEGHJMNPSV']+[37,43]

Try it online!

Or you could use codepoints and decompress with chr.

Mathematica, 59 bytes
!Select[IntegerPartitions@#,{6,9,20}~SubsetQ~#&]=={}&&#!=0&

Pari/GP, 44 bytes
n->n&&#(1/(1-x^6)/(1-x^9)/(1-x^20)%x^n++)==n

Try it online!

Irrelevant comment : what was the problem with this answer of yours?#~SetPrecision~1& ?

@Jenny_mathy It fails the 0.25 test case.

Javascript 37 bytes
Takes a positive integer n and outputs true for Chicken McNugget numbers and false for others.
F=n=>!(n<0||(n%6&&!F(n-9)&&!F(n-20)))

Explanation
F=n=>!(            // negate the internal test for non-Chicken McNugget numbers
    n<0 || (       // if n < 0, or
        n%6 &&     // if n % 6 is truthy,
        !F(n-9) && // and n-9 is not a Chicken McNugget number
        !F(n-20)   // and n-20 is not a Chicken McNugget number
                   // then n is not a Chicken McNugget number
    )
)

The recursion on this function is heinous, and for any sufficiently large n, you will exceed call stack limits. Here's a version that avoids those limits by checking if n is larger than the largest non-Chicken McNugget number (43 bytes [bonus points for being the largest non-Chicken McNugget number?]):
F=n=>n>43||!(n<0||(n%6&&!F(n-9)&&!F(n-20)))

F=n=>n>43||!(n<0||(n%6&&!F(n-9)&&!F(n-20)))

$('#input').on('keyup', () => $('#output').text(F(parseInt($('#input').val(), 10))))
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="input" />
<span id="output"></span>

JavaScript ES5, 46 bytes
n=>n>5&&(!(n%20)||(n<24?!(n%3):n<44?n%3-1:1));

Explicit boolean answer, 50 bytes:
n=>!!(n>5&&(!(n%20)||(n<24?!(n%3):n<44?n%3-1:1)));

Clumsy, but it gets the job done.  Returns false or 0 for every value that isn't 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23, 25, 28, 31, 34, 37, or 43, and true, -1, or 1 for everything else.
Explicit solution returns true or false only.
n=>!!(                                          ); forces Boolean type (optional)
      n>5                                          false for 0, 1, 2, 3, 4, 5 (and negative inputs)
            !(n%20)                                explicit true for 20, 40
                      n<24?!(n%3)                  false for 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23
                                  n<44?n%3-1       false for 25, 28, 31, 34, 37, 43

Clojure 33 bytes
An on ok quick attempt: #(-> %(rem 20)(rem 9)(rem 6)(= 0))