text:
Socket - Plug compatibility
Traveling with electronics is always fun, especially when you need an adapter to charge them. Your challenge is to make planning a trip a little easier by checking if a given plug will be compatible with a given socket.
Challenge
Given a plug type and a socket type, return a value that indicates whether they will work together or not.
Compatibility table
Socket  Accepted plugs  |  Plug  Accepting Sockets
A       A               |  A     A, B
B       A, B            |  B     B
C       C               |  C     C, D, E, F, H, J, K, L, N, O
D       C, D, E, F      |  D     D
E       C, E, F         |  E     D, E, F, H, K, O
F       C, E, F         |  F     D, E, F, H, K, O
G       G               |  G     G
H       C, E, F, H      |  H     H
I       I               |  I     I
J       C, J            |  J     J
K       C, E, F, K      |  K     K
L       C, L            |  L     L
M       M               |  M     M
N       C, N            |  N     N
O       C, E, F, O      |  O     O

The tables show the same information, only transposed.
For reference.
Input

The input will be given as two uppercase or two lowercase letters (you choose).

Inputs will always be /[A-O]/ (or /[a-o]/), there's no need to handle invalid inputs.

You may accept the two inputs in any order (please specify which).

Input can be taken in any reasonable format (string, stdin, array, ...).

If you take both inputs in a single string, they can be separated by no more  than one character and there must be nothing surrounding them

Good inputs: "G,K", "EF", "a b", ['l', 'o']

Bad inputs: "K l", "f(O)(I)", [1,5]

Output

Output can be returned in any reasonable format.

Output must be either truthy/falsy or one of 2 constant values

Good outputs: false/any positive number, 1/2, 'T'/'F'

Bad outputs: an even number/an odd number, 1/more than 1

Examples
Using the format socket, plug => true / false.
A, A => true
I, K => false
O, C => true
C, O => false
E, F => true
F, E => true

Standard loopholes are disallowed.
This is code-golf so the answer with the fewest bytes in each language wins.

My country uses only C and F, I have also seen J... but why are there so many???

@AlexRacer Here, have some reading, there's also the weird shaver plug and the Italian extra wide plug and some others. Europlug is masterplug tho.

Retina 0.8.2, 30 29 bytes
(.)\1|[DEFHKO][CEF]|[JLN]C|BA

Try it online! Link includes test cases.

Python 3, 76 bytes
lambda s,p:any([s==p,p in"CEF"and s in"DEFHKO",s=="B"<p,s in"JLN"and"C"==p])

Try it online!
Credits:

From 83 to 76 bytes by (Better) Neil

lambda s,p:any([s==p,p in"CEF"and s in"DEFHKO",s=="B"<p,s in"JLN"and"C"==p]) for 76 bytes?

@Neil Thanks I updated that.

So funny haha Better Niel

Python 3, 72 Bytes 73 bytes 70 bytes
lambda p,s:s in{"A":"AB","C":y+"CJLN","E":y,"F":y}.get(p,p)
y="DEFHKO"

Try it online!
Edit: Thanks to Chas Brown for cutting some fat!

Found a typo that caused C, C to return false.

Nice! q= can be omitted since the function is anonymous. Also, there's an extra space. 70 bytes. Try it online.

Thanks! For some reason I thought that the lambda would capture y, which is why I had written it that way initially.

Welcome to PPCG, and nice first post!

@user202729: Hadn't seen that before; nice tip to know.

@ChasBrown That really confuses me. >.< I thought that cokment was of OP so I deleted the comment.

C (gcc) (x86 architecture), 76 60 bytes
Many thanks to Arnauld for the changes!
Arguments are given in (plug, socket) order.
c[15]={6,0,56696,0,35184,35184};f(a,b){a=a==b|c[a-65]>>b&1;}

Try it online!

Using the reference you provided here about x86 architectures: you can save 3 bytes by doing 1<<~-b.

66 bytes by getting rid of d and the ternary operator.

62 bytes by doubling the bitmasks. Now beating all languages but Jelly and Retina! \o/

60 bytes by just comparing a with b.

Suggest L"\6\0\xdd78\0襰襰" instead of {6,0,56696,0,35184,35184}

Haskell, 67 bytes
p#s=p==s||or[elem s b|a:b<-words"AB CDEFHJKLNO EDFHKO FDEHKO",a==p]

Arguments to function # are two characters, plug first, socket second.
Try it online!

JavaScript (Node.js), 79 bytes
S=>P=>P==S|P<'B'&S<'C'|P=='C'&'JLN'[K='includes'](S)|'CEF'[K](P)&'DEFHKO'[K](S)

Invoked as a curried function, f(socket)(plug).
Try it online! (includes testcases, showing a matrix of results.)

Jelly, 31 bytes
Oḅ⁴_ȷe“j⁼⁽⁾ƇƑƓƘƝƤḄẸỊṂṢỴẒĊḞĿ‘o⁼/

A monadic link accepting a list of characters [plug,socket] which yields 1 if compatible or 0 if not.
Try it online! Or see a test-suite (which separates out the two classes).

R, 132 129 113 bytes
function(S,P,`!`=utf8ToInt)"[<-"(diag(15),cbind(rep(!"",!"	"),!"
"),1)[-64+!P,-64+!S]

Try it online!
Builds the following matrix and extracts m[S,P] => 1 if TRUE, else 0.
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
 [1,]    1    1    0    0    0    0    0    0    0     0     0     0     0     0     0
 [2,]    0    1    0    0    0    0    0    0    0     0     0     0     0    0     0
 [3,]    0    0    1    1    1    1    0    1    0     1     1     1     0    1     1
 [4,]    0    0    0    1    0    0    0    0    0     0     0     0     0    0     0
 [5,]    0    0    0    1    1    1    0    1    0     0     1     0     0    0     1
 [6,]    0    0    0    1    1    1    0    1    0     0     1     0     0    0     1
 [7,]    0    0    0    0    0    0    1    0    0     0     0     0     0    0     0
 [8,]    0    0    0    0    0    0    0    1    0     0     0     0     0    0     0
 [9,]    0    0    0    0    0    0    0    0    1     0     0     0     0    0     0
[10,]    0    0    0    0    0    0    0    0    0     1     0     0     0    0     0
[11,]    0    0    0    0    0    0    0    0    0     0     1     0     0    0     0
[12,]    0    0    0    0    0    0    0    0    0     0     0     1     0    0     0
[13,]    0    0    0    0    0    0    0    0    0     0     0     0     1    0     0
[14,]    0    0    0    0    0    0    0    0    0     0     0     0     0    1     0
[15,]    0    0    0    0    0    0    0    0    0     0     0     0     0    0     1

Saved 3 bytes by compressing indexes using intToUtf8 and replacing this function with !. See History for more legible version.
Saved 16 bytes thanks to @Giuseppe!

do you need t= in rep?

@Giuseppe looks like I do not!

IDK why this saved so many bytes

@Giuseppe It totally looks like an esoteric language submission now.

PHP, 81 bytes
<?list(,$s,$p)=$argv;$A=AB;$C=$E=$F=DEFHKO;$C.=JLN;echo+($p==$s||strpos($$p,$s));

To run it:
php -n -d error_reporting=0 <filename> <socket> <plug>

Example:
php -n -d error_reporting=0 socket_plug_compatibility.php F E

Or Try it online!
Notes:

To save some bytes, I have used strings without single/double quotations as the string wrapper. Thus, the error_reporting=0 option is used to not output warnings.
Input only works with uppercase letters.
Outputs 1 for compatibility and 0 for non-compatibility.

How?
Every plug is compatible with same socket as itself. There are four special plugs (A, C, E, F) which are compatible with a few more sockets as well. Four string variables with the name of the special plugs are defined to hold list of their extra compatible sockets.
It is checked if input plug and socket are same or if the socket is in the list of compatible sockets for that plug. The latter check is done with the help of PHP's variable variables.

Javascript ES6, 66 65 64 chars
p=>s=>p==s|{A:1,C:14172,E:8788,F:8780}[p]&(1<<parseInt(s,36)-11)

Takes capital letters into p for plug and s for socket, returns falsy (0) or truthy (1, 2, 4, ..., 8192) value.
Test:

f=p=>s=>p==s|{B:1,C:14172,E:8788,F:8780}[p]&(1<<parseInt(s,36)-11)

console.log(`A, A => true
I, K => false
O, C => true
C, O => false
E, F => true
F, E => true`
.split`
`.map(x=>x.match(/(.), (.) => (\w+)/))
.every(([m,p,s,res])=>!!f(s)(p)==eval(res)))

-1 byte with currying

@AsoneTuhid, thank you, updated. But your link is smth strange and doesn't open.

It's TIO. Opens for me.

@AsoneTuhid, ERR_CONNECTION_RESET

Did you try removing https? Do other TIO links work? I tried on mac (chrome and safari) and android and it works fine...

@AsoneTuhid, no tio does NOT work with ERR_CONNECTION_RESET, niether https, nor http.

That's gotta be a problem with your system then

@AsoneTuhid, can't open on 2 different computers in different networks.

How about this?

Let us continue this discussion in chat.

Pascal (FPC), 113 bytes
var p,s:char;begin read(p,s);write((p=s)or(pos(p,'CEF')>0)and(pos(s,'DEFHKO')>0)or(pos(p+s,'AB CJ CL CN')>0))end.

Try it online!
Test for all values
Following the DEFHKO train...
pos(string1,string2) checks for first occurence of string1 in string2 and returns its position in it or 0 if it doesn't exist.


text:
Small Ramsey Numbers
Background: the Ramsey number \$R(r,s)\$ gives the minimum number of vertices \$v\$ in the complete graph \$K_v\$ such that a red/blue edge coloring of \$K_v\$ has at least one red \$K_r\$ or one blue \$K_s\$. Bounds for larger \$r, s\$ are very difficult to establish.
Your task is to output the number \$R(r,s)\$ for \$1 \le r,s \le 5\$.
Input
Two integers \$r, s\$ with \$1 \le r \le 5\$ and \$1 \le s \le 5 \$.
Output
\$R(r,s)\$ as given in this table:
  s   1    2    3    4      5
r +--------------------------
1 |   1    1    1    1      1
2 |   1    2    3    4      5
3 |   1    3    6    9     14
4 |   1    4    9   18     25
5 |   1    5   14   25  43-48

Note that \$r\$ and \$s\$ are interchangeable: \$R(r,s) = R(s,r)\$.
For \$R(5,5)\$ you may output any integer between \$43\$ and \$48\$, inclusive. At the time of this question being posted these are the best known bounds.

I think (even with the range for 5,5) that this may fit under [tag:kolmogorov-complexity] (or does only a non-input, fixed output fit?)

When was 49 excluded for R(5,5)?  (I'm not challenging; I seem to have missed a paper after Exoo's and McKay and Radziszowski's.)

@EricTowers https://arxiv.org/abs/1703.08768

@qwr : Thanks!  I'm enjoying it so far.

JavaScript (ES6), 51 49 bytes
Takes input in currying syntax (r)(s).
r=>s=>--r*--s+[9,1,,13,2,,3,27,6][r<2|s<2||r*s%9]

Try it online!
How?
As a first approximation, we use the formula:
$$(r-1)(s-1)$$
 0  0  0  0  0
 0  1  2  3  4
 0  2  4  6  8
 0  3  6  9 12
 0  4  8 12 16

If we have \$\min(r,s)<3\$, we simply add \$1\$:
 1  1  1  1  1
 1  2  3  4  5
 1  3  -  -  -
 1  4  -  -  -
 1  5  -  -  -

Otherwise, we add a value picked from a lookup table whose key \$k\$ is defined by:
$$k=(r-1)(s-1)\bmod9$$
 k:                    table[k]:           (r-1)(s-1):         output:
 -  -  -  -  -         -  -  -  -  -       -  -  -  -  -       -  -  -  -  -
 -  -  -  -  -         -  -  -  -  -       -  -  -  -  -       -  -  -  -  -
 -  -  4  6  8   -->   -  -  2  3  6   +   -  -  4  6  8   =   -  -  6  9 14
 -  -  6  0  3         -  -  3  9 13       -  -  6  9 12       -  -  9 18 25
 -  -  8  3  7         -  -  6 13 27       -  -  8 12 16       -  - 14 25 43

Nice, The first two rows is a neat expression.

JavaScript (Node.js), 56 55 bytes
f=(x,y)=>x<2|y<2||f(x,y-1)+f(x-1,y)-(x*y==12)-7*(x+y>8)

Try it online! I noticed that the table resembles Pascal's triangle but with correction factors. Edit: Saved 1 byte thanks to @sundar.

Yep, the Pascal's triangle identity comes from a simple upper bound on the Ramsey numbers (see Jonathan Allan's post)

You can save 1 byte replacing x*y>19 with x+y>8.

@sundar Thanks, my original solution was 50 bytes before I realised that my indexing was wrong and I forgot to try to golf it again after I'd fixed that.

Jelly,  17  16 bytes
’ScḢƊ_:¥9“ ı?0‘y

Try it online! Or see a test-suite.
Replace the 0 with +, ,, -, ., or / to set \$R(5,5)\$ equal to \$43\$, \$44\$, \$45\$, \$46\$, or \$47\$ respectively (rather than the \$48\$ here).
How?
Since \$R(r,s)\leq R(r-1,s)+R(r,s-1)\$ we may find that:
$$R(r,s)\leq \binom{r+s-2}{r-1}$$
This is ’ScḢƊ and would produce:
 1  1  1  1  1
 1  2  3  4  5
 1  3  6 10 15
 1  4 10 20 35
 1  5 15 35 70

If we subtract one for each time nine goes into the result we align three more with our goal (this is achieved with _:¥9):
 1  1  1  1  1
 1  2  3  4  5
 1  3  6  9 14
 1  4  9 18 32
 1  5 14 32 63

The remaining two incorrect values, \$32\$ and \$63\$ may then be translated using Jelly's y atom and code-page indices with “ ı?0‘y.
’ScḢƊ_:¥9“ ı?0‘y - Link: list of integers [r, s]
’                - decrement              [r-1, s-1]
    Ɗ            - last 3 links as a monad i.e. f([r-1, s-1]):
 S               -   sum                  r-1+s-1 = r+s-2
   Ḣ             -   head                 r-1
  c              -   binomial             r+s-2 choose r-1
        9        - literal nine
       ¥         - last 2 links as a dyad i.e. f(r+s-2 choose r-1, 9):
      :          -   integer division     (r+s-2 choose r-1)//9
     _           -   subtract             (r+s-2 choose r-1)-((r+s-2 choose r-1)//9)
         “ ı?0‘  - code-page index list   [32,25,63,48]
               y - translate              change 32->25 and 63->48

If you can set it to any number I recommend 43 as conjectured by McKay, Radziszowski and Exoo ;)

Python 2, 62 bytes
def f(c):M=max(c);u=M<5;print[48,25-u*7,3*M+~u-u,M,1][-min(c)]

Try it online!

Python 2, 63 bytes
def f(c):M=max(c);print[48,M%2*7+18,3*~-M+2*(M>4),M,1][-min(c)]

Try it online!
This is ridiculous, I will soon regret having posted this... But eh, ¯\_(ツ)_/¯. Shaved off 1 byte thanks to our kind Jonathan Allan :). Will probably be outgolfed by about 20 bytes shortly though...

Porting Arnauld's JS answer is still 62 bytes.

Julia 0.6, 71 61 59 57 bytes
A->((r,s)=sort(A);r<3?s^~-r:3r+(s^2-4s+3)*((r==s)+r-2)-3)

Try it online!
Ungolfed (well, a bit more readable):
function f_(A)
  (r, s) = sort(A)

  if r < 3
    result = s^(r-1)
  else
    result = 3*r +
               (s^2 - 4*s + 3) * ((r == s) + r - 2) -
               3
  end

  return result
end

What does it do?
Takes input as array A containing r and s. Unpacks the array into r and s with the smaller number as r, using (r,s)=sort(A).
If r is 1, output should be 1. If r is 2, output should be whatever s is.
\$ s^{r - 1} \$ will be \$ s^0 = 1 \$ for r=1, and \$ s^1 = s \$ for r = 2.
So, r<3?s^(r-1) or shorter, r<3?s^~-r
For the others, I started with noticing that the output is:

for r = 3, \$ 2\times3 + [0,  3, 8] \$ (for s = 3, 4, 5 respectively).
for r = 4, \$ 2\times4 + \ \ [10, 17] \$ (for s = 4, 5 respectively)
for r = 5, \$ 2\times5 + \ \ \ \ \ [35] \$ (for s = 5)

(I initially worked with f(5,5)=45 for convenience.)
This looked like a potentially usable pattern - they all have 2r in common, 17 is 8*2+1, 35 is 17*2+1, 10 is 3*3+1. I started with extracting the base value from [0, 3, 8], as [0 3 8][s-2] (this later became the shorter (s^2-4s+3)).
Attempting to get correct values for r = 3, 4, and 5 with this went through many stages, including
2r+[0 3 8][s-2]*(r>3?3-s+r:1)+(r-3)^3+(r>4?1:0)

and
2r+(v=[0 3 8][s-2])+(r-3)*(v+1)+(r==s)v

Expanding the latter and simplifying it led to the posted code.

x86, 49 37 bytes
Not very optimized, just exploiting the properties of the first three rows of the table. While I was writing this I realized the code is basically a jump table so a jump table could save many bytes. Input in eax and ebx, output in eax.
-12 by combining cases of r >= 3 into a lookup table (originally just r >= 4) and using Peter Cordes's suggestion of cmp/jae/jne with the flags still set so that r1,r2,r3 are distinguished by only one cmp! Also indexing into the table smartly using a constant offset.
start:
        cmp     %ebx, %eax
        jbe     r1
        xchg    %eax, %ebx              # ensure r <= s

r1:
        cmp     $2, %al
        jae     r2                      # if r == 1: ret r
        ret

r2:
        jne     r3                      # if r == 2: ret s
        mov     %ebx, %eax
        ret

r3:
        mov     table-6(%ebx,%eax),%al  # use r+s-6 as index
        sub     %al, %bl                # temp = s - table_val
        cmp     $-10, %bl               # equal if s == 4, table_val == 14
        jne     exit
        add     $4, %al                 # ret 18 instead of 14

exit:
        ret

table:
        .byte   6, 9, 14, 25, 43

Hexdump
00000507  39 d8 76 01 93 3c 02 73  01 c3 75 03 89 d8 c3 8a  |9.v..<.s..u.....|
00000517  84 03 21 05 00 00 28 c3  80 fb f6 75 02 04 04 c3  |..!...(....u....|
00000527  06 09 0e 19 2b                                    |....+|

Don't be so sure a jump table would be optimal.  r1: cmp $2, %al / jae r2 will set flags such that you can use r2: jne r3 without another cmp.  The jump target in r1 can be a ret somewhere else, and fall through to r2.  (Reverse the condition).  BTW, this is the first code-golf question I looked at after answering your Short jump offset table usage question on SO.  I guess I picked the right one from HNQ :)

r4 can be one instruction: mov table-8(%ebx,%eax), %al.  IDK why you used a separate instruction to mov the table address into a register.  But one of the key things is that constant offsets from symbols don't cost anything extra because it already assembles to a 32-bit absolute address.  Object file formats can represent symbol refs with an offset for when the linker fills in the final address so compilers don't have to put separate labels on every field of a struct, or every array element...

@PeterCordes I didn't even realize this made HNQ. And yes for some reason I thought the table address had to be in a register before realizing I had the syntax wrong. I fixed it here https://codegolf.stackexchange.com/a/168503/17360 which is just a lookup table. But I didn't know about the constant offset which is handy. I think I'll try a table for the last 3 rows instead of the multiplication.

Note to self: it is still possible to save 1 byte by using one ret for r1 and r2.

Nice update, looks good.  What if you move the mov     %ebx, %eax to exit, so it always runs after r3, and r2 jumps there or falls through into r3?  Then r3 produces its result in BL with sub %bl, %al / cmp $10, %al / jne exit / add $4, %bl (neutral size change: cmp vs. add can use the al,imm8 short form).  The gain is that it removes the ret from r2 as well.  Hmm no that doesn't work, well maybe if you negate the table entries or something?  And that probably clobbers something you need.  I haven't thought this through and unfortunately don't have time to do so :/

I think if I really wanted to try golfing I could do an approach like Arnauld's answer (where I got the idea to use 3x3 lookup table)

I was just thinking how one cmp can give three results due to the law of trichotomy (?)

Python 2, 70 bytes
f=lambda R,S:R<=S and[1,S,[6,9,14][S-3],[18,25][S&1],45][R-1]or f(S,R)

Try it online!

MATL, 25 21 bytes
+2-lGqXnt8/k-t20/k6*-

Try it on MATL Online
Attempt to port Jonathan Allan's Jelly answer to MATL.
+2-lGqXn - same as that answer: compute \$ \binom{r+s-2}{r-1} \$
t8/k - duplicate that, divide by 8 and floor
- - subtract that from previous result (We subtract how many times 8 goes in the number, instead of 9 in the Jelly answer. The result is the same for all but the 35 and 70, which here give 31 and 62.)
t20/k - duplicate that result too, divide that by 20 and floor (gives 0 for already correct results, 1 for 31, 3 for 62)
6* - multiply that by 6
- - subtract that from the result (31 - 6 = 25, 62 - 18 = 44)

Older:
+t2-lGqXntb9<Q3w^/k-t20>+

Try it on MATL Online

Python 3, 74 bytes
lambda *a:[[1]*5,[2,3,4,5],[6,9,14],[18,25],[43]][min(a)-1][max(a)-min(a)]

Try it online!

Proton, 52 bytes
Near-port of my Python answer.
c=>[48,(M=max(c))%2*7+18,3*M-(M>4?1:3),M,1][-min(c)]

Try it online!

Java 8, 62 bytes
(r,s)->--r*--s+new int[]{9,1,0,13,2,0,3,27,6}[r<2|s<2?1:r*s%9]

Lambda function, port of Arnauld's JavaScript answer. Try it online here.
Java, 83 bytes
int f(int x,int y){return x<2|y<2?1:f(x,y-1)+f(x-1,y)-(x*y==12?1:0)-7*(x+y>8?1:0);}

Recursive function, port of Neil's JavaScript answer. Try it online here.

C (gcc), 57 bytes
f(x,y){x=x<2|y<2?:f(x,y-1)+f(x-1,y)-(x*y==12)-7*(x+y>8);}

Recursive function, port of Neil's JavaScript answer. Try it online here.
C (gcc), 63 bytes
f(r,s){r=--r*--s+(int[]){9,1,0,13,2,0,3,27,6}[r<2|s<2?:r*s%9];}

Port of Arnauld's JavaScript answer. Try it online here.

49 bytes

source: Stack Exchange

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

sort: votes


text:
Search text for a prefix and list all its suffixes in the text
I use "suffix" loosely here to mean "any sub-string that follows the prefix".
"Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first character of the input text (for the first word). A "prefix" in the middle of a word is ignored.
E.g. if your input prefix is "arm" and the input text is "Dumbledore's army was fully armed for the impending armageddon" then the output list contains (y, ed, ageddon).
Test Cases
Assume case-sensitive, strings end after spaces. Input will not start with a space.
Removing duplicates is optional.

Input prefix: "1"

Input text:

"He1in aosl 1ll j21j 1lj2j 1lj2 1ll l1j2i"

Output: (ll, lj2j, lj2) - in any permutation

Input prefix: "frac"

Input text:

"fracking fractals fracted fractional currency fractionally fractioned into fractious fractostratic fractures causing quite a fracas"

Output: (king, tals, ted, tional, tionally, tioned, tious, tostratic, tures, as)

Input prefix: "href="https://www.astrotheme.com/astrology/"

Input text:

"(div style="padding: 0; background: url('https://www.astrotheme.com/images/site/arrondi_450_hd.png') no-repeat; text-align: left; font-weight: bold; width: 450px; height: 36px")
  (div class="titreFiche" style="padding: 5px 0 0 6px")(a href="https://www.astrotheme.com/astrology/Nolwenn_Leroy" title="Nolwenn Leroy: Astrology, birth chart, horoscope and astrological portrait")Nolwenn Leroy(br /)
(/div)
  (div style="text-align: right; border-left: 1px solid #b2c1e2; border-right: 1px solid #b2c1e2; width: 446px; padding: 1px 1px 0; background: #eff8ff")
    (table style="width: 100%")(tr)(td style="width: 220px")
(div style="padding: 0; background: url('https://www.astrotheme.com/images/site/arrondi_450_hd.png') no-repeat; text-align: left; font-weight: bold; width: 450px; height: 36px")
  (div class="titreFiche" style="padding: 5px 0 0 6px")(a href="https://www.astrotheme.com/astrology/Kim_Kardashian" title="Kim Kardashian: Astrology, birth chart, horoscope and astrological portrait")Kim Kardashian(br /)(span style="font-weight: normal; font-size: 11px")Display her detailed horoscope and birth chart(/span)(/a)(/div)
(/div)
(div style="padding: 0; background: url('https://www.astrotheme.com/images/site/arrondi_450_hd.png') no-repeat; text-align: left; font-weight: bold; width: 450px; height: 36px")
  (div class="titreFiche" style="padding: 5px 0 0 6px")(a href="https://www.astrotheme.com/astrology/Julia_Roberts" title="Julia Roberts: Astrology, birth chart, horoscope and astrological portrait")Julia Roberts(br /)(span style="font-weight: normal; font-size: 11px")Display her detailed horoscope and birth chart(/span)(/a)(/div)
    (td id="cfcXkw9aycuj35h" style="text-align: right")
  (/div)"

Output: (Nolwenn_Leroy", Kim_Kardashian", Julia_Roberts")

The Winner
This is code-golf, so the fewest bytes wins. :)
Can accept the inputs in any way that works, as long as your code can solve arbitrary problems like the test cases.

To be clear, the prefix has to be at the beginning of a word? If the second test case had the word 'diffraction' in it, would that change the output?

"Prefix" here means ONLY if preceded by a space (or the start of the input).
So the "1" in "He1in" is ignored, and in "l1j2i", just as the "frac" in "diffraction" is ignored.

How can the https://www.astrotheme.com/astrology/ can be a prefix when it's preceded by href="?

Thank you Neil, that's very well spotted. I will have to add spaces. Thanks for noting.

May the suffix be empty?

Empty suffix is fine, whether that leaves an empty slot in the output etc. It's also fine to ignore it.

Also can there be two consecutive whitespaces (empty word) in the text?

I'd suggest allowing people to split on other white-space as well as spaces as a few seem to be doing so anyway. I'd also suggest saying there wont be multiple spaces in a row in the input (or somewhat equivalently that empty words may result in undefined behaviour). I suggest both these things since the main part of the challenge is not the splitting into words part (I would suggest just allowing a list of words or even just a word as input, but it's way too late now with 22 answers - something to note for future challenges though).

-1 to allowing splitting on other whitespaces now. It would make sense for the challenge to have been that originally, but changing now would split the answers into ones that do two different things. And this is not like the cases where some languages can't handle for eg. 64-bit numbers or something, here it just means implementing a slightly (possibly) more complex match, so it makes more sense to correct answers with wrong assumptions and perhaps add a test case to check for this too.

Yes, the whitespace thing is a clear misstep by me for specifying 'space', I am happy for answers to do either. For the sake of the contest, any code that can solve my test cases is valid so things like "inputs with consecutive spaces" etc are fine since my test cases don't do that anyway.

R, 63 bytes
function(s,p,z=el(strsplit(s,' ')))sub(p,'',z[startsWith(z,p)])

Try it online!
The positive-lookbehind implementation is unfortunately 5 bytes longer due to the huge regmatches/gregexpr combination :
function(s,p)regmatches(s,gregexpr(paste0('(?<=',p,')[^ ]*'),s,,T))

A naive sub(grep()) is slightly better than the lookbehind at 66, but still doesn't encroach on the startsWith(). I don't see much room for improvement here without a change of approach. Try it online!

Jelly, 12 bytes
Ḳfṛ"€¥Ḋ€ṫ€L}

Try it online!

A work of art. :')
Will be using this to parse html into lists, thank you so much. :)

@DrQuarius Regex cannot parse HTML, and so is Jelly.

Seems to work ok to me. Not sure why?

@DrQuarius It's a famous joke, and user202729 extended it.

C (gcc), 113 109 106 105 bytes
-4 bytes thanks to @LambdaBeta!
-3 bytes thanks to @WindmillCookies!
i;f(char*s,char*t){for(i=strlen(s);*t;t++)if(!strncmp(t,s,i))for(t+=i,puts("");*t^32&&*t;)putchar(*t++);}

Try it online!

You can save 4 bytes by removing both ^0's. Just ;*t; and &&*t;

@LambdaBeta thanks! I missed that.

I was able to get it down to 107 using a different strategy, sorry :)

@LambdaBeta I actually thought of that method but I didn't think it would've been shorter than the solution that I posted. Nice answer, upvoted.

used puts instead of putchar, now is 107, outputs on different lines:
https://tio.run/##TU5BDoMwDPsK44Ba6C5wrPaVSVHWsmhQWJseJrS3sxaGtpPj2E6M5x5xXUlbgXfwdVAbsFzoEtgPxokgtZ280DVrbhpJVpyS4nCcBaugSMosc3MhNUfOcdG1MtmvXVtVKSWPdZ3z@r2OQE7IxYrSesBSbfAg1xd5YBjCPpjbjjQ5GAqM3huHr7/d8CPJS46ng8fviSlVBSbcWfQmFAgx5F/PSGwK2BQIZS72AQ

@WindmillCookies I don't know what you did since you linked the same program as my answer but I got 106 using puts(), thanks!

ok, seems like I forgot to get the permalink, lol

103 bytes

Python 2, 57 56 bytes
lambda i,j:[w[len(i):]for w in j.split()if w.find(i)==0]

Try it online!
-1 with thanks to @mypetlion

lambda i,j:[w[len(i):]for w in j.split()if w.find(i)==0] for -1 byte

Japt, 9 bytes
8 bytes if we can take input as an array of words.
¸kbV msVl
¸         // Shorthand for `qS`, split into words.
 kbV      // Filter the words, selecting only those that start with the prefix.
     msVl // For each remaining word, remove prefix length chars from the start.

Try it online!

Very nice, but doesn't seem to work for the last test case. Might be due to quotation marks inside the string? or new lines?

@DrQuarius Your last test case is faulty, is it not? All the strings you're looking for are in the middle of the words (surrounded by url('')), none of them are at the start.

Retina, 31 bytes
L`(?<=^\2¶(.|¶)*([^ ¶]+))[^ ¶]+

Try it online! First line should be the desired prefix, the rest is the input text. Does not remove duplicates. Would be 25 bytes if any white space was a valid seprator. Explanation: We want to list the suffixes of valid prefixes. The [^ ¶]+ matches the suffix itself. The prefix of the regexp is a lookbehind that ensures that the prefix of the suffix is the input prefix. As a lookbehind is evaluated right-to-left, this starts by matching the prefix (using the same pattern but inside ()s to capture it), then any characters, before finally matching the prefix on its own line at the beginning of the input.

White space meaning spaces and/or line breaks?
I think that's a valid solution if so, but to be fair to all I will leave the problem as stated.

@DrQuarius No, any white space includes tabs, formfeeds and even ellipses.

Retina was the first language that came to mind when I saw the post (though I don't know the language yet). I thought it would be shorter though. Could I bother you for an explanation? For eg. the docs say ¶ is a newline character, but I can't figure out why so many are needed here.

@sundar Sorry I was in a bit of a rush at the time. The first ¶ ensures that the whole first line is matched to the prefix. The second ¶ is needed because it isn't known how many intermediate lines there are. The last two ¶s work the same way - negated character classes normally include newlines but we don't want that here.

No problem, thanks for adding it in. "normally include newlines but we don't want that here" <- If I understand correctly, we do want that here. OP specifies strictly that only spaces count as separators, that prefixes begin at and suffixes end at spaces. So for eg. "dif\nfractional" shouldn't match for "frac" because the prefix comes after a newline, not a space. Similarly "fracture-\nrelated" should return suffix "ture-\nrelated". Which is good news here I think, because you can remove at least one ¶, possibly more.

Japt, 16 12 bytes
Port of Arnauld Answer
-4 bytes from @Shaggy
iS qS+V Å®¸g

iS                  Insert S value (S = " ") at beginning of first input (Implicit)
   q                split using
    S+V             S + Second input
        Å           slice 1
         ®          map
          ¸         split using S
           g        get first position

Try it online!

12 bytes

Should probably make mention that this is a port of Arnauld's solution. (Assuming it wasn't independently derived, of course)

@Shaggy Honestly I did not notice this was the same answer, anyway I'll give him credit. sorry

There's a 9 byte solution if you want to give it a try.

@Shaggy Did you mean this or did you have something different in mind?

Exactly it (only I'd used a instead of b). Nice one :)

05AB1E, 11 bytes
#ʒηså}εsgF¦

Try it online! (here is a demo for multiline strings)
How does it work?

#ʒηså}εsgF¦    Full program.
#              Split the first input by spaces.
 ʒ   }         Filter the words by ...
  ηså          ... "Does the second input occur in the prefixed of the word?"
      ε        And for each valid word
       sg      Retrieve the length of the of the second input.
         F¦    And drop the first character of the word that number of times.

:) Very nice, thanks for the multiline demo! I think that was causing issues for other programs.

Stax, 8 bytes
·B¬╤²*6&

Run and debug it
Explanation:
j{x:[fmx|- Full program, implicit input: On stack in order, 1st input in X register
j          Split string on spaces
 {   f     Filter:
  x:[        Is X a prefix?
      m    Map passing elements:
       x|-   Remove all characters in X the first time they occur in the element
             Implicit output

I could also use x%t (length of X, trim from left), which is equally long but packs to 9 bytes.

Beautiful. :) I think this might be the winner. Most of the lowest byte score contenders haven't been able to parse the third test case. :)

Ahhh... but I see how you've done it now, you had to let the program know that the quotation marks in the string were not part of the program. I think that's fine. Also, yours is still the shortest regardless. :)

Brachylog, 24 21 bytes
tṇ₁W&h;Wz{tR&h;.cR∧}ˢ

Try it online!
Could have been a few bytes shorter if there was variable sharing with inline predicates.
Input is an array with the prefix as the first element and the text as the second element.
tṇ₁W                    % Split the text at spaces, call that W
    &h;Wz               % Zip the prefix with each word, to give a list of pairs
         {         }ˢ   % Select the outputs where this predicate succeeds:
          tR            % Call the current word R
            &h;.c       % The prefix and the output concatenated
                 R      % should be R
                  ∧     % (No more constraints on output)

IBM/Lotus Notes Formula, 54 bytes
c:=@Explode(b);@Trim(@If(@Begins(c;a);@Right(c;a);""))

Takes it's input from two fields named a and b. Works because Formula will recursively apply a function to a list without the need for a @For loop.
No TIO available so here's a screenshot:

APL (Dyalog Unicode), 23 bytesSBCS
Full program. Prompts for text and prefix from stdin. Prints list to stdout.
(5⌽'(\w+)\b',⎕)⎕S'\1'⊢⎕

Try it online!
⎕ prompt (for text)
⊢ yield that (separates '\1' from ⎕)
(…)⎕S'\1' PCRE Search and return list of capture group 1 from the following regex:
 ⎕ prompt (for prefix)
 '(\w+)\b', prepend this string (group of word characters followed by a word boundary)
 5⌽ rotate the first 5 characters to the end; '\bPREFIX(\w+)'

MATL, 17 bytes
Yb94ih'(.*)'h6&XX

Try it on MATL Online
How?
Yb - Split the input at spaces, place the results in a cell array
94 - ASCII code for ^ character
ih - Get the input (say "frac"), concatenate '^' and the input
'(.*)'h - Push the string '(.*)' into the stack, concatenate '^frac' and '(.*)'. So now we have '^frac(.*), a regex that matches "frac" at the beginning of the string and captures whatever comes after.
6&XX - Run regexp matching, with 6& specifying 'Tokens' mode i.e., the matched capture groups are returned instead of the entire match.
Implicitly output the results.

So that's what 'Tokens' does; good to know!

Haha. I had no idea either, figured it out by trial and error for this answer.

C (clang), 107 bytes
i;f(s,t,_)char*s,*t,*_;{i=strlen(s);_=strtok(t," ");while((strncmp(_,s,i)||puts(_+i))&&(_=strtok(0," ")));}

Try it online!
Description:
i;f(s,t,_)char*s,*t,*_;{   // F takes s and t and uses i (int) and s,t,u (char*)
    i=strlen(s);           // save strlen(s) in i
    _=strtok(t," ");       // set _ to the first word of t
    while(                 // while loop
        (strncmp(_,s,i)||  // short-circuited if (if _ doesn't match s to i places)
         puts(_+i))        // print _ starting at the i'th character
        &&                 // the previous expression always returns true
        (_=strtok(0," "))) // set _ to the next word of t
    ;                      // do nothing in the actual loop
}

Has to be clang because gcc segfaults without #include <string.h> due to strtok problems.

100 bytes

PowerShell 3.0, 60 62 59 bytes
param($p,$s)-split$s|%{if($_-cmatch"^$p(.*)"){$Matches[1]}}

Lost some bytes suppressing the cmatch output. Had a janky solution that gained some by purposely causing duplicates. But it also threw redlines if it didn't match on the first but that is not fine now that I think about it. +2 bytes to fix it though.

Solution with 60 bytes returns double answer in some cases king, tals, ted, tional, tional, tionally, tioned, tioned, tious, tostratic, tures,tures,tures, tures, as and show index error on He1in example. Powershell 5.1, 6.0.2. Solution with 62 bytes is Ok.

@mazzy I knew that, I was just abusing the "Duplicates is allowed" bit to have it return even more duplicates when it comes across a no-match and throw red on a no-match 1st iteration.

Bash + grep, 20 bytes
grep -Po "\b$1\K\S*"

Prefix is given as a command-line parameter, and input text is piped in via stdin.
Try it online!

JavaScript (Node.js), 64 59 bytes
-5 bytes from @Shaggy
a=>b=>b.match(eval(`/\\b${a}\\w*/g`)).map(x=>x.split(a)[1])

Try it online!

59 bytes

JavaScript (ES6), 57 bytes
Takes input in currying syntax (text)(prefix). Does not remove duplicates.
s=>p=>(' '+s).split(' '+p).slice(1).map(s=>s.split` `[0])

Try it online!

Perl 6, 30 bytes
{$^t.comb: /[^|' ']$^p <(\S+/}

Test it
Expanded:
{  # bare block lambda with placeholder params $p, $t

  $^t.comb:    # find all the substrings that match the following
  /
    [ ^ | ' ' ] # beginning of string or space
    $^p        # match the prefix
    <(         # don't include anything before this
    \S+        # one or more non-space characters (suffix)
  /
}

@sundar fixed

You seem to have an extra space between 'p' and '<' btw.

@sundar The space between p and <( is necessary as otherwise it may be seen as $v<…> which is short for $v{qw '…'}.

Seems to work without it though, at least in this case.

@sundar Technically it just warns, but I don't like writing code that warns when it is only one byte different than code that doesn't warn.

Ah, I can understand that.

Perl 5 with -asE, 23 22 21 bytes (?)
say/^$b(.*)/ for@F

Try it online!
Can be run as a commandline one-liner
 as perl -asE 'say/^$b(.*)/ for@F'  -- -b=frac  -, or with a filename in place of the last -.
Or from a script file, say perl -as -M5.010 script.pl -b=frac - (thanks to @Brad Gilbert b2gills for the TIO link demonstrating this).
The code itself is 18 bytes, I added 3 bytes for the -b= option which assigns its value (the prefix input) to a variable named $b in the code. That felt like an exception to the usual "flags aren't counted" consensus.
-a splits each input line at spaces and places the result in the array @F. -s is a shortcut way of assigning a command-line argument as a variable, by giving a name on the command-line. Here the argument is -b=frac, which places the prefix "frac" in a variable $b.
/^$b(.*)/ - Matches the value of $b at the beginning of the string. .* is whatever comes after that, until the end of the word, and the surrounding parantheses capture this value. The captured values are automatically returned, to be printed by say. Iterating through space-separated words with for @F means we don't have to check for initial or final spaces.

https://tio.run/##XY1BC8IwDIX/Sg4eFNmmh51E8OTPELIuk2BtZ9IK@/PWlQ4cnvK9l7yXkcS2KSrBu62Ph1NSnJrbptvW@10Dg5fLNaVB0DzY3SFDQKsFqC@TvUMLJoqQM9PKsz8x37ILHpSeXK1SC8al0msQDGyKikIKBqPm36/IgQCh5@Evj5qq7pwpVR8/5s3soH4B

Jelly,  11  9 bytes
Ḳœṣ€ḢÐḟj€

A dyadic link accepting the text (a list of characters) on the left and the prefix (a list of characters) on the right which yields a list of lists of characters (the resulting suffixes).
Try it online! (footer joins with spaces to avoid full-program's implicit smashing)
Note: I added three edge cases to the string in the OP - unfrackled and nofracfracheremate to the beginning, which should not output and fracfracit to the end which should output fracit.
How?
Ḳœṣ€ḢÐḟj€ - Link: text, prefix                        e.g. "fracfracit unfracked", "frac"
Ḳ         - split (text) at spaces -> list of words        ["fracfracit", "unfracked"]
   €      - for each (word):
 œṣ       -   split around sublists equal to (prefix)       ["","","it"]  ["un","ked"]
     Ðḟ   - filter discard items for which this is truthy:
    Ḣ     -   head
          -   -- Crucially this modifies the list:             ["","it"]       ["ked"]
          -   -- and yields the popped item:                 ""            "un"
          -   -- and only non-empty lists are truthy:       kept          discarded
          -            ...so we end up with the list:      [["","it"]]
        € - for each (remaining list of lists of characters):
       j  -   join with the prefix                          "fracit"
          -                                                ["fracit"]

previous 11 byter:
Ḳs€L}Ḣ⁼¥ƇẎ€

Also a dyadic link as above.
Try it online!

Haskell, 51 bytes
p#x=[length p`drop`y|y<-words x,and$zipWith(==)p y]

Try it online!

Husk, 11 bytes
Pretty much just a port of the Haskell answer:
m↓L⁰foΠz=⁰w

Try it online!
Explanation
m↓L⁰f(Πz=⁰)w  -- prefix is explicit argument ⁰, the other one implicit. eg: ⁰ = "ab" and implicit "abc def"
           w  -- words: ["abc","def"]
    f(    )   -- filter by (example w/ "abc"
       z=⁰    -- | zip ⁰ and element with equality: [1,1]
      Π       -- | product: 1
              -- : ["abc"]
m             -- map the following
 ↓            -- | drop n elements
  L⁰          -- | n being the length of ⁰ (2)
              -- : ["c"]

Java 10, 94 bytes
p->s->{for(var w:s.split(" "))if(w.startsWith(p))System.out.println(w.substring(p.length()));}

Try it online here.
Ungolfed:
p -> s -> { // lambda taking prefix and text as Strings in currying syntax
    for(var w:s.split(" ")) // split the String into words (delimited by a space); for each word ...
        if(w.startsWith(p)) //  ... test whether p is a prefix ...
            System.out.println(w.substring(p.length())); // ... if it is, output the suffix
}

Small Basic, 242 bytes
A Script that takes no input and outputs to the TextWindow Object
c=TextWindow.Read()
s=TextWindow.Read()
i=1
While i>0
i=Text.GetIndexOf(s," ")
w=Text.GetSubText(s,1,i)
If Text.StartsWith(w,c)Then
TextWindow.WriteLine(Text.GetSubTextToEnd(w,Text.GetLength(c)+1))
EndIf
s=Text.GetSubTextToEnd(s,i+1)
EndWhile

Try it at SmallBasic.com! Requires IE/Silverlight

Python 2, 53 bytes
lambda i,j:[w.split()[0]for w in j.split(i)if len(w)]

Try it online!

Interesting idea but fails for the first test case, input: "1", "He1in aosl 1ll j21j 1lj2j 1lj2 1ll l1j2i"

Right, I'll try to fiddle with it. I'm sure I'm onto something...

Brachylog, 12 bytes
hṇ₁∋R&t;.cR∧

Try it online!
Takes input as [text, prefix] through the input variable, and generates each word through the output variable. This was originally sundar's answer, which I started trying to golf after reading that it "could have been a few bytes shorter if there was variable sharing with inline predicates", which is possible now. Turns out that generator output saves even more bytes.
    R           R
   ∋            is an element of
h               the first element of
                the input
 ṇ₁             split on spaces,
     &          and the input
      t         's last element
         c      concatenated
       ;        with
        .       the output variable
          R     is R
           ∧    (which is not necessarily equal to the output).

My first two attempts at golfing it down, using fairly new features of the language:
With the global variables that had been hoped for: hA⁰&tṇ₁{∧A⁰;.c?∧}ˢ (18 bytes)
With the apply-to-head metapredicate: ṇ₁ᵗz{tR&h;.cR∧}ˢ (16 bytes)
And my original solution:
Brachylog, 15 bytes
ṇ₁ʰlᵗ↙X⟨∋a₀⟩b↙X

Try it online!
Same I/O. This is essentially a generator for words with the prefix, ṇ₁ʰ⟨∋a₀⟩, modified to remove the prefix.
                   The input variable
  ʰ                with its first element replaced with itself
ṇ₁                 split on spaces
    ᵗ              has a last element
   l               the length of which
     ↙X            is X,
       ⟨   ⟩       and the output from the sandwich
       ⟨∋  ⟩       is an element of the first element of the modified input
       ⟨ a₀⟩       and has the last element of the input as a prefix.
                   The output variable
       ⟨   ⟩       is the output from the sandwich
            b      with a number of characters removed from the beginning
             ↙X    equal to X.

A very different predicate with the same byte count:
Brachylog, 15 bytes
hṇ₁∋~c₂Xh~t?∧Xt

Try it online!
Same I/O.
   ∋               An element of
h                  the first element of
                   the input variable
 ṇ₁                split on spaces
    ~c             can be un-concatenated
      ₂            into a list of two strings
       X           which we'll call X.
        h          Its first element
         ~t        is the last element of
           ?       the input variable,
            ∧      and
             Xt    its last element is
                   the output variable.

C (gcc), 99 bytes
This uses strsep instead of strtok, saving a few bytes. Oddly, I had to include the function prototype for strsep (and strtok) to avoid segment faults when not including string.h.
char*strsep();w;f(s,t,u)char*s,*t,*u;{for(w=strlen(t);u=strsep(&s," ");)strncmp(u,t,w)||puts(u+w);}

Try it online!

This version uses only 91 bytes with strtok, but only works with clang: Try it online!

You can ditch the char at the beginning.

Red, 62 bytes
func[p s][parse s[collect[any[p keep to[" "| end]| thru" "]]]]

Try it online!

Pyth, 21 20 18 17 16 bytes
AQVcH)IqxNG0:NG"

Try it online!
-1 by using V instead of FN because V implicitly sets N
-2 after some further reading about string slicing options
-1 using x to check for the presence of the substring at index 0
-1 using replace with "" for getting the end of the string
I'm sure this could use some serious golfing but as a Pyth beginner, just getting it to work was a bonus.
How does it work?
assign('Q',eval_input())
assign('[G,H]',Q)
for N in num_to_range(chop(H)):
    if equal(index(N,G),0):
        imp_print(at_slice(N,G,""))

Excel VBA, 86 bytes
Takes input as prefix in [A1] and values in [B1] and outputs to the console.
For each w in Split([B1]):?IIf(Left(w,[Len(A1)])=[A1],Mid(w,[Len(A1)+1])+" ","");:Next

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


text:
Reducing a Python Script
Does anyone have any suggestions as to how I could shorten this program?
_=map(ord,raw_input());_=[10if y==88else 0if y==45else 58-_[x-1]if y==47else y-48for x,y in enumerate(_)];t=0;exec('t+=sum(_[:2+(_[0]+_[1]>=10)]);_=_[2-(_[0]==10):];'*10);print t

Run it online
I'd like to write a bowling calculator. I'm fairly proficient in python so I chose that language.
The trick is that the input string is made up of frames not split by white-space and the spares, strikes, and misses are marked by /, X, and - respectively. (note that there are no 0 in the code, - is used instead)
Here is an example line X7/9-X-88/-6XXX81, this line would have a score of 167.
As you can see, most of my characters are spent on mapping these special characters to their actual bowl scores. I do this by taking their ord values and then replacing the X and - with 10 and 0 respectively. I then find the / rolls and set their value as ten minus the previous roll.
After this, I calculate the final game score by looping over 10 frames (the size of a line of bowling), chunking the line array based on if the  frame was a strike spare or normal roll, and then reducing the array going forward.
I feel like this is the best way to perform this challenge as a golf challenge, but I'm not sure if I'm reducing it enough.

@user202729 The TIO link, as well as the use of print strongly suggests it is not.

@user202729 Just changed it, thanks!

To be clear a spare (/) can never come after a gutter (-)?  Your current code doesn't seem to handle this.

Oh and welcome to the site by the way!

I'm getting a score of 176 for your example. Could you maybe write out the bowling scoring rules to make sure we're all on the same page about how they are calculated?

Here are the scores I have after each roll: `X 10;
7 24;
/ 30;
9 48;

48;
X 58;
58;
8 74;
8 82;
/ 84;
84;
6 90;
X 100;
X 120;
X 150;
8 174;
1 176`.

@user202729 I can use any language.

@xnor I added the wikipedia with the rules, it's easier than writing them out.

@user202729 yes it is guaranteed

@user202729 Feel free! But my office decided that only "real" languages are allowed to compete for the free lunch (python, perl, ruby, javascript, etc). I'm guessing it will be up for debate depending on our submissions (it's a small office).

I suppose the last edit is only for the bonus section? Because the question is Python only? ...

Let us continue this discussion in chat.

OK, I was missing that if the game goes into extra frames, those frames are not scored. Are we guaranteed that the game as listed lasts exactly ten frames and those extra rolls are listed exactly if the the game goes into those extra frames?

A naive translation to J. Just for fun. Try it online!

This could make for an interesting challenge, assuming it hasn't been done already.

Closely related.

Yeah, it's been done already

1.
The portion 2+(_[0]+_[1]>=10) could be rewritten as 2+(_[0]+_[1]>9) to save two bytes. In a similar vein 2-(_[0]==10) can be rewritten as 2-(_[0]>9), since 10 is the only possible value greater than 9.
a=map(ord,raw_input());a=[10if y==88else 0if y==45else 58-a[x-1]if y==47else y-48for x,y in enumerate(a)]
t=0;exec('t+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10);print t

Try it online!
(I also renamed _ to a, because even though it's code-golf we don't have to make it unreadable)
2.
You can also use a dictionary instead of conditionals to saves some bytes.
a=raw_input();a=[{y:ord(y)-48,'X':10,'-':0,'/':58-ord(a[x-1])}[y]for x,y in enumerate(a)]
t=0;exec('t+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10);print t

Try it online!
3.
Don't enumerate.  enumerate tends to be too long for it's own good.  Here you want to get the last character, which can better be acheived with a zip.
a=raw_input();a=[{y:ord(y)-48,'X':10,'-':0,'/':58-ord(x)}[y]for x,y in zip('-'+a,a)]
t=0;exec('t+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10);print t

Try it online!

If you combine this with @user202729's two tips you get 149 bytes.
a=raw_input();a=[[10,0,58-ord(x),ord(y)-48]['X-/'.find(y)]for x,y in zip('-'+a,a)]
t=0;exec't+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10;print t

Try it online!

Here's another version that is also 149 bytes:
a=raw_input();a=[['-123456789X'.find(y),58-ord(x)][y=='/']for x,y in zip('-'+a,a)]
t=0;exec't+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10;print t

Try it online!

Wow, fantastic response! And here I thought I was being clever with my use of enumerate to save some time. Thanks!

@Swiper-CCCVI Glad that helps.  I would suggest waiting a little while before accepting an answer, there are definitely some people that are much better at python golfing than I am, and this question has only been viewed 18 times so far.

Sure can do, I wish it was possible to accept multiple!

Shorten the conditional using str.find
Compare:
Mine:        [10,0,58-_[x-1],y-48]['X-/'.find(chr(y))]
Mine (char): [10,0,58-ord(a[x-1]),ord(y)-48]['X-/'.find(y)]
WW's:        {y:ord(y)-48,'X':10,'-':0,'/':58-ord(a[x-1])}[y]
Original:    10if y==88else 0if y==45else 58-_[x-1]if y==47else y-48

@CatWizard ... That's because you use characters and I use character codes...

Yeah, looks like I confused myself, if you implement this with characters rather than codes you save 2 bytes.  Try yours

146 bytes
Based on Cat Wizard's "another version".
Basically I include / into the string so find returns 0 (falsy value), then use or to replace that 0 with the desired result.
a=raw_input();a=[('/-123456789X'.find(y)or 59-ord(x))-1for x,y in zip('-'+a,a)]
t=0;exec't+=sum(a[:2+(a[0]+a[1]>9)]);a=a[2-(a[0]>9):];'*10;print t

Try it online!
Explanation: x or y == x if x else y. So:
   '/-123456789X'.find(y)or 59-ord(x)
== '/-123456789X'.find(y) if '/-123456789X'.find(y) else 59-ord(x)
== '/-123456789X'.find(y) if '/-123456789X'.find(y) != 0 else 59-ord(x)
== '/-123456789X'.find(y) if y != '/' else 59-ord(x)

Could you elaborate on how the .find(y)or section is working? I'm having a hard time understanding how this is checking if the character is a spare or not.

@Swiper-CCCVI If the character is a spare '/-123456789X'.find(y) will be zero.  This short circuits the or, because 0 is the same as false, so it returns the second part of the or which is the 59-ord(x).

Gotcha, makes sense now. Thanks! And very nifty.

Remove () around parameter of exec
exec is a command, not a function. This saves 2 bytes.

Nice catch! I did not know this.

Is there a reason why you need to use raw_input() and not replace it with input() and wrap the input string in quotes e.g. "X7/9-X-88/-6XXX81"? That would save 4.


text:
Make a program that prints its own size
Challenge: Create a program that prints out the size of its own source code file.
For example, a 35 bytes size of program must print out 35. Pre-calculation is not valid. What I mean by pre-calculation is:
 // test.js -> its size is 15 byte
 console.log(15)

It must dynamically calculate the size of  own source code file.
The winner is who prints the minimum number , same as who has the minimum size of code.

Em, console.log(15) is valid?

Well it is not a good solution, if you calculate first and print :), pre-calculation is not valid.

You should set some rules for cases like that so

The program should dynamically calculate its own length then? You should mention such rules as part of the question (And have you seen the "Sandbox for Proposed Challenges"? You can post your questions there first and get help making them clearer and more likely to yield useful, interesting answers.)

Yes it must be dynamically. thanks for advice, I will get help there to make it clear.

Do you mean by reading the size of its source file or were you thinking of some other means?

@Neil , I mean the size of the source code.

Possible duplicate.

@Mr.Xcoder It must dynamically calculate the size of own source code file.

Is not "reading the source code file and count the bytes" the only form of "dynamically calculate" possible? I feel that "calculate" gives the impression we can somehow work out how big the source code is from some other values.

calculate can also mean enumerate, i.e. to count.

Can the program contain the name of its own source file?

So...? Anything that would count as "reading your own source code" and invalid for normal quine challenge is valid here?

Welcome to PPCG! Your challenge has been put on hold. It means it can be reopen once clarification questions have been addressed. I do have one such question: usually programs and functions are allowed, do you allow functions?

So, is print(2*5) considered dynamic calculate?

APL (Dyalog Unicode), 10 bytesSBCS
≢⊃⌽⎕NR⊃⎕SI

Try it online! Prints 11 because TIO's APL is set up to auto-format the code, but on a system where this isn't the case, it prints 10:

⎕SI State Indicator (list of all functions on the stack)
⊃ pick the first one (i.e. the currently running function)
⎕NR Nested Representation (one character list per line)
⌽ reverse (to bring the actual code line to the front)
⊃ pick the first (i.e. the code line)
≢ tally the characters of that

Python 3, 32 bytes
Not much to say really, opens the file and checks the length of its contents as a string.
print(len([*open(__file__)][0]))

There might be something shorter but I couldn't think of it.
Edit: Try it Online! (stolen from the comments - thanks for the reminder!)

Was just typing these exact characters lol, you can remove one byte from print by switching to python2, provided it doesn't break the rest

I'm not 100% sure if [*x] works in Python 2 - I don't have an install to test it, but if it does work then yes, you could save one :)

[*...] does not work in Python 2, but print len(open(__file__).read()) does for 32 bytes as well.

Try it online!

Why only the first line ([0])?

...i.e.TIO

Making it work for all lines takes a fair few more bytes since you have to do something like print(sum(len(x)for x in[*open(__file__)])) instead, but the source is only one line so that isn't necessary (the question didn't say it had to adapt to additional source being added). Example

JavaScript (Node.js), 40 20 bytes
-20 thanks to @Shaggy
f=_=>("f="+f).length

f=_=>("f="+f).length

alert(f())

f=_=>("f="+f).length

... Because this is valid for normal quine challenge, it's invalid here? ... Also why not just 2+?

@user202729 but 2+(''+f).length do not save a byte


text:
Scoring Briscola
Introduction
Briscola is one of Italy's most popular card games. It is a trick-taking card game, like Bridge. Briscola is well known for its bizarre point system. In this challenge, given two cards, you will output whether the first one scores more, less, or the same number of points as the second in Briscola's point system.
Challenge
Briscola is played with a deck of Italian playing cards. There are forty cards in a deck, 1-10 in each of the four suits: cups, swords, clubs, and coins. We will be ignoring the suits for this challenge. Cards 2 - 7 are the numeric cards, and cards 8, 9, and 10 are the face cards. The ranking of the cards, from highest to lowest, are:
 +------------------------+-------------+
 |     Cards, by Rank     | Point Value |
 +------------------------+-------------+
 | Ace (1)                |     11      |
 | Three (3)              |     10      |
 | King (10)              |      4      |
 | Knight (9)             |      3      |
 | Jack (8)               |      2      |
 | Numeric Cards (2, 4-7) |      0      |
 +------------------------+-------------+

Thanks to Orphevs for the nice table! :)
Your task is to create a full program or function which accepts two numbers 1-10 representing card ranks, and outputs (or returns) whether the point value of the first card is greater than, lesser than, or equal to the point value of the second card. Additional Notes:

Your program may output any three values to indicate less than, greater than, and equal to, however, it must output the same value for each condition each time.
Your program may use any IO defaults.
Standard loopholes are disallowed.
Either a full function or a program is permitted.
This question is code-golf, so lowest byte-count wins.
Here are some sample inputs and outputs:
 1, 4 => more than (ace scores 11 points, 4 scores 0 points, first is  more than second.
 8, 3 => less than (8 scores 2, 3 scores 10, first is less than second.
 5, 2 => equal (5 and 2 both score 0)

If you have any questions, don't hesitate to ask. Good luck!

I always thought Scopa's primiera was more bizarre ;)

@FryAmTheEggman you're right, I've changed it. Also, you may have a point about the primiera… ;)

Can we take an array with the two values as input ?

@digEmAll sure thing.

Not that bizarre. Very similar scoring exists on Portuguese Sueca and Bisca card games!

Why usual negative, zero, positive is disallowed?

@Qwertiy what do you mean? I say above that you can output any three consistent values.

@Amphibological, i mean that a lot of languages use comparator returning a) nigative value - the first argument is smaller; b) zero - they are equal; c) positive value - the first is greater. But you are requiring constant values.

@Qwertiy I think you are misunderstanding me. What you have mentioned is completely fine: you are returning consistent values for the different comparisons, which is all the challenge specifies.

@Amphibological, from the question: "output any three values ... however, it must output the same value for each condition each time" also note using Math.sign in many answers.

@Qwertiy I apologize if my wording is confusing. The meaning was supposed to be that each condition ( less than, greater than, equal to) would yield the same value on each run. All the answers below, are as far as I can tell, valid.

@Amphibological, but without Math.sign, they wouldn't be valid, right?

@Qwertiy yes, that's correct.

I did game it many years ago with my relatives (parenti)

Jelly, 12 11 bytes
“®µ½¤¢‘iⱮIṠ

Try it online!

-1 byte by using Luis Mendo's method.

Outputs 0 for equal, -1 for greater than and 1 for less than. Uses the code-page index “®µ½¤¢‘ which evaluates to [8, 9, 10, 3, 1].
Takes input as a pair of cards. Use 1,2 as an example.
“®µ½¤¢‘iⱮIṠ
“®µ½¤¢‘       [8,9,10,3,1]
       i      index of
        Ɱ     each element in the input -> 5,0
         I    Finds the forward difference: 0-5 = -5.
          Ṡ   Sign -> -1.
                When ranks are equal, Ṡ returns 0 and when the rank of the second
                card is higher, Ṡ returns 1.

Not annoyed, but could whoever downvoted explain why?

In case it was an accidental downvote -- and assuming that it occurred after the last edit -- I'd suggest to do a dummy update to the post so that it can be undone when/if the downvoter realize that something went wrong.

JavaScript (ES6), 42 bytes
Takes the two ranks in currying syntax (a)(b). Returns 1 for more than, -1 for less than or 0 for equal.
a=>b=>Math.sign((s="05040000123")[a]-s[b])

Try it online!

Using a formula, 48 bytes
This is definitely longer than using a lookup table but also a bit more interesting.
Same I/O format.
a=>b=>Math.sign((g=n=>(1<<n&1802)*6%13)(a)-g(b))

Try it online!
How?
Because many cards have a value of \$0\$, we first want to mask them out. Given a card rank \$n\$, we compute:
$$p=2^n\text{ and }(2^1+2^3+2^8+2^9+2^{10})$$
$$p=2^n\text{ and }1802$$
  n (card)   | 2**n | AND 1802
-------------+------+----------
  1 (Ace)    |    2 |      2
  2          |    4 |      0
  3 (Three)  |    8 |      8
  4          |   16 |      0
  5          |   32 |      0
  6          |   64 |      0
  7          |  128 |      0
  8 (Jack)   |  256 |    256
  9 (Knight) |  512 |    512
 10 (King)   | 1024 |   1024

We now want to transform the remaining non-zero values in such a way that they can be sorted in the correct order. We use:
$$q=6p \bmod 13$$
    p (card)   |   6p | MOD 13
---------------+------+--------
    2 (Ace)    |   12 |   12
    8 (Three)  |   48 |    9
  256 (Jack)   | 1536 |    2     --> Ace > Three > King > Knight > Jack
  512 (Knight) | 3072 |    4
 1024 (King)   | 6144 |    8

Has there been meta discussion about this approach using curried parameters? Technically this doesn't match this challenge, because the function you've written returns a function, not an answer.

@Sparr https://codegolf.meta.stackexchange.com/a/8427/31625

MATL, 12 bytes
[DEXIl]&mdZS

Input is an array of two numbers. Output is -1, 0 and 1 respectively for more than, equal to or less than.
Try it online!
Explanation
Consider input [1 4] as an example.
[DEXIl]    % Push [8 9 10 3 1]
           % STACK: [8 9 10 3 1]
&m         % Implicit input. Index (1-based) of membership, 0 if not member
           % STACK: [5 0]
d          % Consecutive difference
           % STACK: -5
ZS         % Sign. Implicit display
           % STACK: -1

Japt, 25 21 16 bytes

1 => more than
-1 => less than
0 => equal

£"78920"bXÉÃr- g

Try it online!

You can use the -g flag to save 2 bytes.

I have a 13 byte solution (also using the -g flag, if you want to try for it).

@Shaggy I wouldn't say that's saving two bytes, flagged submissions are just separate language solutions and don't count as pure Japt solutions.

If you don't want to use a flag then the solution I mentioned above becomes 15 bytes. (Hint: it uses the [8,9,10,3,1] array and base conversion)

Japt -g, 13 bytes
Outputs -1 for >, 1 for < and 0 for ===.
m!b#ù991ìD)rn

Try it or run multiple tests (The second line replicates the functionality of the -g flag to allow the flags to be used to process multiple inputs)

Explanation
                   :Implicit input of 2 integer array
m                  :Map
   #ù991           :  249991
        ìD         :  Convert to array of base-13 digits = [8,9,10,3,1]
 !b                :  Get the index of the current element in that
          )        :End map
           rn      :Reduce by subtraction
                   :Implicitly output the sign of the result

R, 35 bytes
rank(c(6,0,5,1:4*0,1:3)[scan()])[1]

Try it online!

-6 Bytes thanks to @JayCe suggestion to switch to full program instead of function

The program returns 2 for 'greater than', 1 for 'less than', 1.5 for 'equal'
Explanation :
      c(6,0,5,1:4*0,1:3)[v]          # extract the score of each card in v (got from scan());
                                     # cards in v are used as indexes in the cards rank
                                     # vector, which is based on briscola scores vector
                                     # c(11,0,10,0,0,0,0,2,3,4) but divided by 2 and rounded
                                     # to integer preserving the original order

rank(                      )[1]      # rank returns : c(1,  2)   if v[1] < v[2]
                                     #                c(2,  1)   if v[1] > v[2]
                                     #                c(1.5,1.5) if v[1] == v[2]
                                     # and we select the first value

rank(c(6,0,5,1:4*0,1:3)[scan()])[1] (full program) will save you 6 bytes

@JayCe: yes I noticed that, but I'm still confused about the necessity to add cat() when it's a full program... anyway, updated my code ;)

MarioLANG, 578 548 530 bytes
 )                    <
 ====================="
                   >-[!)
                   "==#)
                >-[!)) )
                "==#=) +
         >-----[!))) + +
         "======#==  + +
     >--[!)))   ++++              -(- <
     "===#===================    ====="
  >-[!)))+++++                    >) [!)+:
; "==#=======================     "===#===
>[!                      )))[!((>[!)[!):
"=#==========================#====#==#===
!;((                         <       >)-:
#============================"       "===

Try it online!
Explanation:

The first, big castle reads a card number as input and calculates its equivalent point value until it reads a 0 (no input). This supposes that there will be only two strictly positive values as input.
Note that I don't actually set the proper point values as they aren't needed, I just set as point value a number between [1-5] to help calculate which card has the most point values.
The second, small castle just compares the two calculated point values.
It returns 1 if the first point value is greater than the second one, -1 if the second point value is greater than the first one, and 0 if the point values are the same.

Java 8, 69 66 bytes
a->b->Math.signum("05040000123".charAt(a)-"05040000123".charAt(b))

Lambda taking parameters in currying syntax, port of Arnauld's JavaScript answer.
Returns 0.0 equal, 1.0 for greater than, and -1.0 for less than. Try it online here.
Thanks to Kevin Cruijssen for golfing 3 bytes.

You can save 3 bytes by doing a direct return with two times "05040000123".charAt(...) instead of the integer-array: a->b->Math.signum("05040000123".charAt(a)-"05040000123".charAt(b))

Python 2, 41 bytes
Outputs 1 for more than, -1 for less than, 0 for equal.
lambda a,b:cmp(s[a],s[b])
s="05040000123"

Try it online!

C (gcc), 57 bytes
Returns the usual [-1..1] for <, = and >, respectively.
char*s="-FAEAAAABCD";f(a,b){a=s[a];b=s[b];b=(a>b)-(a<b);}

Try it online!

Suggest *s=L"... instead of char*s="... and a=(s[a]>s[b])-(s[a]<s[b]) instead of a=s[a];b=s[b];b=(a>b)-(a<b)

PHP, 51 45 bytes
<?=($m=_5040000123)[$argv[1]]<=>$m[$argv[2]];

Try it online!
To run it:
php -n <filename> <card1> <card2>

Example:
php -n briscola_score.php 3 1

Note: This code uses PHP 7's spaceship operator. So it won't work on any PHP version before 7.

Output:

1 = more than (card1 > card2)
0 = equal (card1 == card2)
-1 = less than (card1 < card2)

How?
Same as the approach used in many other answers, but in PHP. Creates a value map for cards and compares the card values from it. The position of the value in the map is same as card number.

05AB1E, 14 bytes
ε78920S>sk}`.S

Returns 1, -1, or 0 for more than; less than; or equal respectively.
Try it online or verify all test cases.
Explanation:
ε              # Loop over the input-array
 78920S>       #  Convert 78920 to a list of digits, and increase each by 1,
               #  resulting in [8,9,10,3,1]
        sk     #  Index this list with the input-number (-1 if not found)
               #   i.e. [1,4] → [4,-1]
          }    # Stop the loop
`              # Put all items of the now mapped list separated onto the stack
 .S            # Take the signum (1 if a>b; -1 if a<b; 0 if a==b)
               #  i.e. 4 and -1 → 1

Javascript ES2016+, 73 chars
Not the shortest, but I hope interesting due to math and overflow :)
(x,y)=>Math.sign((x&8?x:(16-(x**40|0)%7)^16)-(y&8?y:(16-(y**40|0)%7)^16))

And the other version with 74 chars, unfortunately:
(x,y)=>eval('(x>y)-(x<y)'.replace(/\w/g,'($&&8?$&:(16-($&**40|0)%7)^16)'))

Test
Open browser console before running

f=(x,y)=>Math.sign((x&8?x:(16-(x**40|0)%7)^16)-(y&8?y:(16-(y**40|0)%7)^16))
console.table(Array(11).fill().map((x,i)=>Array(11).fill().map((x,j)=>f(i,j))))


text:
Two dozen kissing number approximations
Given a number from 1 to 24, output the kissing number to the best of current knowledge (some numbers will have more than one acceptable output). Knowledge of geometry is not essential as the outputs are all listed below.
From the Wikipedia page on the Kissing Number Problem:

a kissing number is defined as the number of non-overlapping unit spheres that can be arranged such that they each touch another given unit sphere

That is, given one unit sphere, how many more unit spheres can touch it without any of them overlapping? The question will be asked in N dimensional space, where a sphere is understood to be an N-1 dimensional sphere.
For example:

in 2 dimensional space, a unit circle can touch 6 other unit circles.
in 3 dimensional space, a unit sphere can touch 12 other unit spheres.

The Wikipedia page lists values for 1 to 24 dimensional space. However, some of these are not yet known accurately, so only a lower and upper bound are given. The table is reproduced here so that it will remain fixed, regardless of any future narrowing of the ranges due to new proofs. Solutions are judged against this fixed table, even if the Wikipedia page is modified in future.
Table of bounds
Dimension   Lower bound     Upper bound
1           2               2
2           6               6
3           12              12
4           24              24
5           40              44
6           72              78
7           126             134
8           240             240
9           306             364
10          500             554
11          582             870
12          840             1357
13          1154            2069
14          1606            3183
15          2564            4866
16          4320            7355
17          5346            11072
18          7398            16572
19          10668           24812
20          17400           36764
21          27720           54584
22          49896           82340
23          93150           124416
24          196560          196560

Input
The dimension: An integer from 1 to 24 (inclusive).
Here "integer" indicates that the input will have no fractional part - it may be 2 or 3 but never 2.5. A solution may still take input as a float, or a string, for example.
Output
A number in the relevant range, from the lower limit to the upper limit for that input (inclusive).
The output must be deterministic (always the same for the same input).
The output must be integer. For example, for input 5 the possible valid outputs are 40, 41, 42, 43, 44. Note this is a restriction on the value, not the type. It is acceptable to return a float, provided it has zero fractional part. For example, 41.5 would not be valid, but 41.0 would be valid.
Scoring
This is code-golf. Your score is the number of bytes in your code. For each language, the winner is the solution with the lowest score.

Really cool approximation problem.

Julia 0.6, 52 bytes
n->ceil(n<8?3.7exp(.51n)-5.1:n<24?9exp(.41n):196560)

Try it online!
How?
Machine learning! (Kinda. Maybe. Not really.)
First, from plotting the lower and upper limit data against N, and some manual trial and error, it seemed like an exponential function could fit well for N >= 8. After some attempts at manually finding this function, I resorted to using a parameter tuning function to tune \$ a * e^{b K} + c \$  (where K = 8 to 24) to find a, b, and c such that the expression gave values that lie within the correct range for each K (with successively smaller range of possible values and correspondingly higher precisions for a, b, c in different runs of the function). There were a few such set of values, though none of them could fit the N=24 case exactly, so I went with one that had 0 c and hardcoded the value for N=24.
For lower N, from 1 to 7, I was hoping to find some simpler expression or polynomial, but couldn't find any that fit. So back to fitting \$ a * e^{b K} + c \$ , this time for K = 1 to 7 (though I didn't really think an exponential would be a right fit in this case, based on visual plot trends). Thankfully, there were parameters a, b, c that could give correct values throughout the range here (at least to within a ceil call).

I wouldn't consider a gridsearch to be machine learning. It is brute force if anything.

But it's in MLBase!!! J/k, the lines around ML are blurry as always, but this probably is too basic to deserve the label machine learning. Then again, it's always useful to get a buzzword in!

when we say Machine Learning, we mainly think of polynomials with n=2 or regexps

when I say machine learning, I think of neural nets, decision trees, HMMs, perceptron...

@qwr I'm very late, but regression is indeed considered a part of machine learning, in addition to all of those things. (And more! SVMs, etc.)

JavaScript (ES6), 60 bytes
f=(n,k=2)=>n<24?--n?f(n,k*24/(17+~'_8443223'[n])):~~k:196560

Try it online!
How?
The last term \$a_{24}=196560\$ is hard-coded.
All other terms are computed recursively, using:
$$\begin{cases}a_1=2\\a_{n+1}=a_n\times\dfrac{24}{q_n}\end{cases}$$
where \$q_n\$ is defined as:
$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,&\text{for }n>7\end{cases}$$
leading to the following ratios:
$$3,2,2,\frac{24}{13},\frac{12}{7},\frac{12}{7},\frac{24}{13},\frac{3}{2},\frac{3}{2},\ldots,\frac{3}{2}$$
The final result is eventually floored and returned.
Results summary
Approximated results are given with 2 decimal places.
  n |   a(n-1) | multiplier |      a(n) | output |          expected
----+----------+------------+-----------+--------+-------------------
  1 |      n/a |        n/a |         2 |      2 |                2
----+----------+------------+-----------+--------+-------------------
  2 |        2 |          3 |         6 |      6 |                6
  3 |        6 |          2 |        12 |     12 |               12
  4 |       12 |          2 |        24 |     24 |               24
  5 |       24 |      24/13 |     44.31 |     44 |        [40,..,44]
  6 |    44.31 |       12/7 |     75.96 |     75 |        [72,..,78]
  7 |    75.96 |       12/7 |    130.21 |    130 |      [126,..,134]
  8 |   130.21 |      24/13 |    240.39 |    240 |              240
  9 |   240.39 |        3/2 |    360.58 |    360 |      [306,..,364]
 10 |   360.58 |        3/2 |    540.87 |    540 |      [500,..,554]
 11 |   540.87 |        3/2 |    811.31 |    811 |      [582,..,870]
 12 |   811.31 |        3/2 |   1216.97 |   1216 |     [840,..,1357]
 13 |  1216.97 |        3/2 |   1825.45 |   1825 |    [1154,..,2069]
 14 |  1825.45 |        3/2 |   2738.17 |   2738 |    [1606,..,3183]
 15 |  2738.17 |        3/2 |   4107.26 |   4107 |    [2564,..,4866]
 16 |  4107.26 |        3/2 |   6160.89 |   6160 |    [4320,..,7355]
 17 |  6160.89 |        3/2 |   9241.34 |   9241 |   [5346,..,11072]
 18 |  9241.34 |        3/2 |  13862.00 |  13862 |   [7398,..,16572]
 19 | 13862.00 |        3/2 |  20793.01 |  20793 |  [10668,..,24812]
 20 | 20793.01 |        3/2 |  31189.51 |  31189 |  [17400,..,36764]
 21 | 31189.51 |        3/2 |  46784.26 |  46784 |  [27720,..,54584]
 22 | 46784.26 |        3/2 |  70176.40 |  70176 |  [49896,..,82340]
 23 | 70176.40 |        3/2 | 105264.59 | 105264 | [93150,..,124416]
----+----------+------------+-----------+--------+-------------------
 24 |           (hard-coded)            | 196560 |           196560

The first thing I saw was bitwise operators inside a recursive JavaScript function; the first thing I thought was "What is Arnauld up to..."

Really nice table. Did you make it manually?

@qwr Yes, that's mostly some Notepad++ editing. I just used a script to generate the values in the first 4 columns.

x86, 62 59 53 50 bytes
My solution uses a byte lookup table and shifting by 2 (no FP computations). Dimensions 9 through 23 provide enough leeway for the shifting. Input in eax and output in ecx.
-3 by swapping eax and ecx since cmp $imm, %al is shorter than cmp $imm, %cl.
-4 by not treating the N=24 case separately but applying the adjustment to all times 1024 cases.
-2 by not returning early (stupid)
-3 by using table as offset and movzbl instead of zeroing with xor
start:
        dec     %eax                # 1-indexed table

        movzbl  table(%eax), %ecx   # return byte directly
        cmp     $8, %al
        jl      exit

        sal     $6, %ecx            # * 64
        cmp     $19, %al
        jl      exit

        sal     $4, %ecx            # * 16
        sub     $48, %ecx

exit:
        ret

#.data
table:  .byte   2, 6, 12, 24, 40, 72, 126, 240              # * 1
        .byte   5, 8, 10, 14, 19, 26, 41, 68, 84, 116, 167  # * 64
        .byte   18, 28, 49, 92, 192                         # * 1024 - 48

Hexdump (table in .text instead of .data)
00000502  48 0f b6 88 1c 05 00 00  3c 08 7c 0d c1 e1 06 3c  |H.......<.|....<|
00000512  13 7c 06 c1 e1 04 83 e9  30 c3 02 06 0c 18 28 48  |.|......0.....(H|
00000522  7e f0 05 08 0a 0e 13 1a  29 44 54 74 a7 12 1c 31  |~.......)DTt...1|
00000532  5c c0                                             |\.|

The table is read-only, so normally you'd put it in .rodata, not .data anyway.  (Or on Windows, apparently .rdata).  The .rodata section gets linked as part of text segment.

And BTW, normal people write shl, especially when your number is unsigned (you used movzbl to load it, not movsbl).  Of course sal is just another name for the same opcode.  gcc emits sal, but it's pretty rare to see it in hand-written code.

Jelly, 29 26 bytes
“~D=ⱮziEc+y’Dḣ+⁵÷7PĊ«“£#;’

Try it online!
How it works
“~D=ⱮziEc+y’Dḣ+⁵÷7PĊ«“£#;’  Main link. Argument: n

“~D=ⱮziEc+y’                Set the return value to 485523230101001100011122.
            D               Decimal; convert the return value to base 10.
             ḣ              Head; take the first n elements of the digit list.
              +⁵            Add 10 to each element.
                ÷7          Divide the sums by 7.
                  P         Take the product.
                   Ċ        Ceil; round up to the nearest integer.
                     “£#;’  Yield 196560.
                    «       Take the minimum.

JavaScript (Node.js), 120 99 bytes
Dropped 21 bytes. Big reduction thanks to tsh's suggestion to add a hole to the start of the array (saving two bytes going from n-1 to n, and aiming for round numbers within the lower- and upper-bounds, thus shrinking them from fixed-point notation like 1154 to exponential notation like 2e3.
Again, my original goal was to show how light the "dumb" way would be (eg not using any real math, like Arnauld's answer. It's impressive that there was still room to shrink it without any transformations or calculations.
n=>[,2,6,12,24,40,72,126,240,306,500,582,840,2e3,2e3,3e3,5e3,6e3,8e3,2e4,2e4,3e4,5e4,1e6,196560][n]

Try it online!
Twice the length of Arnauld's answer, 0 amount of the complexity.
JavaScript (Node.js), 129 128 bytes
(-1 byte thanks to suggestion to use bitshifting)

f=(n)=>[2,6,12,24,40,72,126,240].concat([5,8,10,14,19,26,41,68,84,116,167].map(x=>x<<6),[17,28,49,91].map(x=>x<<10),196560)[n-1]

Try it online!
To meet the demands of being interesting, I stole the logic from the x86 answer, and built the array from that. Making it 9 bytes longer. But slightly more interesting.

yawns at least try something interesting

I thought demonstrating the most straightforward approach (and thus technically the longest reasonable length) was pretty interesting. Arnauld's is quite possibly the shortest you can get in JS, yet the longest is only twice the bytes.

The point of the byte lookup table is to maybe use a bytestring or just something like "02060c1828487ef0" where each entry is one byte or 2 characters in hex if you prefer. Storing the numbers directly in decimal takes up to 3 characters. Also use bitshifting...

Bitshifting was what I thought about and then forgot. Good catch.

You should at least remove f=, change (x) to x, add a hole and change x-1 to x. TIO; and maybe round them up TIO 99 bytes

Welcome to PPCG! :)

Runic, 173 bytes
>i:8(?D5X1+1C,*212,+16,+1c2*,+1cX,+Sp3X7+a,*5X1+a,-1+kn$;
      R:c2*(?D4X1+1C,*212,+16,+1c2*,+Sp9*1+:4XY(?Dkn$;
             R`196560`r@;              ;$*C1nk,C1L

(Note that the lower right corner should be counted for bytes: they are implicitly filled with spaces.)
TIO's exe needs an update that this answer relies on (and I'm patching up some other holes before asking Dennis to rebuild). But plugging a value in (be sure to add whitespace on lines 2 and 3 if using more than one character for the value on the first line). Here's the easiest way to write the values needed:
0-9,a-f  ->  1-15
2Xn+     ->  20+n

Try it online!
Functionally this is a port of sundar's Julia answer (but Runic doesn't have a command for pushing e to the stack (or really, any decimal value), so an approximation was needed). The approximation for e for inputs less than 8 is more precise, as the loss of precision resulted in values lying outside the allowable range of outputs (e.g. 7 would produce 125). Ceil() was accomplished by converting to a character and then back to a number (this failed for exceptionally large values, so at 40k I had it divide by 100, do the conversion to and back, then multiply by 100 again).
There's probably some room to simplify the arrangement (e.g. running the entry point vertically, below, or finding a way to compress the approximations for e), but I'm happy with just being able to do the calculation.
/?D5X1+1C,*212,+16,+1c2*,+1cX,+Sp3X7+a,*5X1+a,-1+kn$;
  R:c2*(?D4X1+1C,*212,+16,+1c2*,+Sp9*1+:4XY(?Dkn$;
\(8:i<   R`196560`r@;              ;$*C1nk,C1L

161 bytes.
Interpreter Update:
With the push fixing input reading, Runic now has several math functions and the ability to parse strings as doubles. That will vastly simplify this answer, but I will leave it as is to show off the effort I put into it (I added the single-argument Math functions and string parsing shortly after posting: I'd already had Sin/Cos/Tan on my to-do list, but hadn't considered Exp, Abs, Log, etc. and was running out of characters). TIO should update in the next 24-48 hours, depending on when Dennis sees it.
212,+16,+1c2*,+1cX,+ would reduce to -> 1'eA with this interpreter update. A pops a character and a value and performs a Math operation on that value based on the character popped (e in this case is Exp() and Exp(1) returns e).


text:
Perfect Squares below \$n\$

A perfect square is an integer that is the square of an integer; in
other words, it is the product of some integer with itself.

Calculate the number of perfect squares below a number \$n\$ where \$n\$ will be taken as an input

Examples:
There are 9 perfect squares below 100: 1, 4, 9, 16, 25, 36, 49, 64, 81
Constraints:
\$0<n<10^6\$

Since this is a golfing challenge, the entry with least amount of bytes will win.
Best of Luck!

Fixed output challenges are typically discouraged. I recommend, perhaps, taking $n$ as input and outputting the number of perfect squares below it

@Mr.Xcoder I will edit the question

Note that the inline delimited for MathJax is \$, not $. Also, some test cases would be helpful

@Mr.Xcoder I will keep that in mind

This is a trivial challenge, and all it does is generate results that show which language(s) are more "golfy".

Let it be noted that although I agree this should be closed, I do not agree that this is a duplicate of the question cited.

I disagree that this should be closed at all. While this challenge is uninteresting (note the votes), it has a clear specification and no direct duplicates; I disagree with the duplicate-vote because the main approach to a solution is different (modulo 1 or built-ins like is_square are irrelevant here, for example). Thus, I hammer-reopened the challenge.

@JeffZeitlin, agreed - I was a bit hasty there, I breezed through the challenge and thought it was looking for all the squares below n, rather than the count. Voting to reopen.

The output is the amount of perfect squares or all perfect squares?

@user202729 - Disagree. Definitely related, but not a duplicate; the results required are different in nature.

@JeffZeitlin Well it's just decrement 1...

@JeffZeitlin the number of perfect squares below n is floor(sqrt(n-1)).

@user202729 I accidentally voted to close it as a duplicate because I miss pressed a key but I disagree it is a duplicate, the other challenge is essentially the same core task has a bunch of arbitrary unclear restrictions attached to it.

@user202729 - No, your proposed duplicate wants the value of the square root. This one wants a count of numbers below N that have integer square roots.

@gÓEûùIÿ In that case one of the challenges need to be clarified.

@JungHwanMin - Yes. And since that's the answer essentially by inspection, all this challenge does is test to see which language is "golfiest" for the trivial operation.

@user202729 I don't see how this question is unclear.  Perhaps you ought to clarify.

@gÓEûùIÿ So if you think this challenge is better than the other one, just hammer the other way.

@user202729 it doesn't make sense to retroactively hammer an earlier question. I'd hammer neither because the other challenge has arbitrary restrictions (i.e. prohibiting sqrt).

@JeffZeitlin We have a bunch of easy challenges. Easy challenges are not a problem. But of course if they're uninteresting feel free to downvote.

@user202729 I don't think they are duplicates.  The other one has two additional "restrictions" that this challenge does not.  They are horribly unclear and vague but they are definitely distinct.

@JeffZeitlin how the question approaches a sequence is not too relevant because we're not required to directly implement the challenge, as long as we get the correct answer. In fact, in many cases, algorithms are not given in the challenge at all, which allow users to come up with clever mathemagicks to compute the answer.

@user202729 - There's "easy", and then there's "trivial". This is the latter. A challenge should admit of multiple approaches to solve, such that there may be multiple answers in a given language to compare. Trivial challenges only show how "golfy" a language is.

@JeffZeitlin "If anyone feels that trivial challenges insult their intelligence, I encourage them to seek out languages that make the task less trivial." – Martin Ender #

In conclusion: Being too easy is not a close reason. Please do not close a challenge just because it's too easy. Feel free to downvote however.

Panacea, 3 bytes
<qc

Explanation:
<     decrement
 q    square root
  c   floor

brainfuck, 161 160 bytes
,>>>>>>+[-<<<<<+[>+>+>+<<<-]>[-<+>]>[>[>+<<<+>>-]>[<+>-]<<-]>[-]<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<[>+<<[>>[-]>+<<<-]>>>[<<<+>>>-]<[>>+<<-]<<->-]<[-]>>>>]<<<<<-.

Try it online!
Finally, a challenge simple enough that I could attempt some brainfuckery.
Credits to https://esolangs.org/wiki/Brainfuck_algorithms for the squaring algorithm and the comparison algorithm ideas, Fatih Erikli's brainfuck visualizer, and to El Brainfuck for quick runs.
(Also to user202729 for noticing an unnecessary space in the code and for a link with a bash I/O wrapper.)
Calculates \$ i^2 \$ for each \$ i \$ starting from 1, and checks if \$ i^2 < n \$. Returns the last \$ i \$ for which that's true.
Input and output are usually ASCII characters representing numbers. For eg., in the TIO link, input d (ASCII 100) returns character tab \t (ASCII 9).  Now links to a version that takes and returns numeric I/O directly. Assumes a wrapping implementation (for the comparison algorithm).
, n input
> i = 0
> isqr/temp0
> icopy1/ncopy/temp1
> icopy2/temp2
> temp3
> exitflag (is isqr lt n)
+[-                 while exitflag not 0
  <<<<<
  +                 increment i
  [>+>+>+<<<-]      make 3 copies of i (destructively)
  >[-<+>]           use one of them (temp0) to restore i

  Squaring by multiplying icopy1 with icopy2:
  >[                while icopy1 not 0
    >[>+<<<+>>-]    copy icopy2 to temp3 and add it to isqr
    >[<+>-]         restore icopy2 from temp3
    <<-             decrement icopy1
  ]
  >[-]              reset temp2 (icopy2) to 0

  Comparing n and isqr:
  <<<<[>>>+>+<<<<-] copy n to ncopy and temp2
  >>>>[<<<<+>>>>-]  restore n from temp2
  <[                while ncopy
    >+              increment temp2 as flag
    <<[>>[-]>+<<<-] if isqr gt 0 reset temp2 (destroys isqr & copies to temp3)
    >>>[<<<+>>>-]   restore isqr from temp3
    <[>>+<<-]       set exitflag to 1 if temp2 was not reset
    <<->-           decrement isqr & decrement ncopy
    ]
  <[-]              reset isqr (would have been set to negative of n minus isqr)
  >>>>              check the flag and exit if isqr gt n
]
<<<<<-.              decrement i by 1 and output

!

brainfuck, 49 bytes
Use byte-value input/output. Can only process numbers up to maximum cell value. Requires a tape that has at least 3 cells to the left and 2 cells to the right of the initial memory pointer.
+>>,[<[<<]<[[<+>>+<-]++<[>+<-]<<+>]>>>->-]<<<<<-.

Try it online!
(with nice Bash wrapper that converts decimal input/output to byte input/output)

Based on the identity \$1 + 3 + 5 + \dots + (2n-1) = n^2\$     (so it subtracts 1, then 3, then 5, then 7, ... from the input \$n\$ until it is \$\le 0\$, then count number of subtraction)
Explanation:
# Mem layout: {r t A a c x}. Ptr initially at {a}.
# {t} == 0. r == result. a == 1, then increase to 3, 5, ...
# {c} counts from {a} to 0.
# {x} is the input, gradually decremented.

+        # a=1
>>,      # read x
[        # while x:
  <        # goto c
  [<<]<    # if c, goto {t}, else goto {a}
  [        # if not c:
    [<+>>+<-]    # A=c=a; a=0
    ++<[>+<-]    # a=2+A; A=0
    <<+>         # r+=1
  ]
  # now mem pointer is at {t} regardless of initial
  # value of {c}, and c!=0
  >>>-     # c-=1
  >-       # x-=1
]
<<<<<-.  # print r-1

Compilable Python code works the same way -- explanation in reverse.

Brain-Flak, 58 bytes
({()<([]){({}{(<({}[()])>)}{}[()])}{}({}((<><>)))>}<>[()])

Try it online!

Jelly, 3 bytes
’Æ½

Try it online!
Simply takes the floor of the square root of \$n-1\$. Assumes \$0\$ should be counted and assumes that we ought to find the number of perfect squares strictly lower than \$n\$. (This is just an illustration of why such trivial challenges are discouraged)

More or less. I'd not include 0, and floor instead of ceiling.

Technically according to the phrasing of this question it would be incorrect as this would include n itself if it is a square while the question says less than n.

@JeffZeitlin You mean $\lfloor\sqrt{n-1}\rfloor$, no?

@Mr.Xcoder - Yes, actually.

Japt, 4 bytes
Port of Mr. XCoder Jelly Implementation
´U¬f

Try it online!

JavaScript, 25 bytes
f=n=>--n&&!(n**.5%1)+f(n)

Try it online

Not 100% sure about the spec but I think it should be f=n=>--n&&!(n**.5%1)+f(n). Now, n=>--n**.5|0 should work for 12 bytes.

Oh, right, it looks like 0 (wrongly) shouldn't be counted. Work away with that 12 byte version, was too rushed to figure out the Maths! ;)

Dodos, 121 120 bytes
Also based on the identity \$1 + 3 + 5 + \dots + (2n-1) = n^2\$    . Thanks to H.PWiz for saving some bytes.
	dip f 1
f
	+ 1 > - A f F
F
	> - i r
	+ 1 1 >
i
	i I
I
	>
	>
r
	>
	> - A
A
	+ >
	+
-
	- dip
1

	dip + _
_
+
	dot
>
	dab

Try it online!
Fortunately there are no scroll bar in the code...

_       Returns an empty list.
1       Append 1.
-       Assume x<y, given (x, y) return (0, y-x).
> - A   Get the first element of a list (return 0 for empty list).
r       Reverse a list of 2 elements.
i       Incremential: Given (x, y) return (x, y) if x<y else (y, y).
f       Main function.

Writing Dodos code is similar to Haskell that all functions are (effectively) pure.
Bonus Haskell code (ungolfed) which this solution bases on.

116 I think that is correct

MATL - 4 bytes
Using the same approach as others
qX^k

Try it at MATL Online
Explanation
      Implicitly grab input
q     Subtract 1
X^    Compute the square root
k     Round down
      Implicitly display the result

Hey @suever! Working to get to 10k? :-)

@LuisMendo trying to get back into it a little :)

Brain-Flak, 76 bytes
{({}[()]<(({})){(<{}({}[({})({}[()])])>)}{}({}({})({}())[()])>)}{}{}({}[()])

Try it online!
Explanation
Uses a simple counting method.  It has 3 counters, the number, the slice and the result.  We decrement the number until it reaches zero, each time we do we also decrement the slice if it is non-zero.  If the slice is zero we increment the result and set the slice to one less than twice the result.
This computes the square root via the sum of consecutive odds.

JavaScript (Node.js), 14 12 bytes
-2 bytes by @Shaggy
_=>--_**.5|0

Try it online!

12 bytes: n=>--n**.5|0

Neim, 7 bytes
Λq)<

Try it online!

This does not answer the challenge as written. This returns the squares, not the count of them.

@JeffZeitlin Fixed.

Better. Still doesn't answer the challenge, though; there are only 9 square below 100, not 10.

Noether, 9 bytes
I1-0.5^_P

Try it in the interpreter!
Explanation:
This is just an implementation of the formula \$\left\lfloor{\sqrt{n-1}}\right\rfloor\$:
I         - Push the user input onto the stack
 1        - Push 1 onto the stack
  -       - Pop two numbers a and b off the stack and push the result of a-b
   0.5    - Push 0.5 onto the stack
      ^   - Pop two numbers a and b off the stack and push the result of a^b
       _  - Pop the number on the top of stack, floor it and push the result
        P - Print the item on the top of the stack

Java 8, 22 bytes
n->(int)Math.sqrt(n-1)

Lambda using the formula \$\left\lfloor{\sqrt{n-1}}\right\rfloor\$. Trivial implementation. Try it online here.

C (gcc), 18 bytes
f(n){n=sqrt(n-1);}

Trivial implementation of the formula \$\left\lfloor{\sqrt{n-1}}\right\rfloor\$. Try it online here.