text:
Multiplication in the Steenrod Algebra
Here's yet another Steenrod algebra question. Summary of the algorithm: I have a procedure that replaces a list of positive integers with a list of lists of positive integers. You need to repeatedly map this procedure over a list of lists and flatten the output until you reach a fixed point. Then for each sublist, if it appears an odd number of times, delete all but one occurrence. If it appears an even number of times, delete all occurrences. There is reference code at the bottom. The procedure for replacing a list with a list of lists is determined by a formula called the "Adem relation."
In order to represent an algebra, we need to know a basis for the algebra and also how to multiply things. From my previous question, we know the basis of the Steenrod algebra. In this question we're going to learn how to multiply Steenrod squares. The Steenrod algebra is generated by Steenrod squares \$\mathrm{Sq}^{i}\$ for \$i\$ a positive integer. It has a basis consisting of "admissible monomials" in the Steenrod squares.
A sequence of positive integers is called admissible if each integer is at least twice the next one. So for instance [7,2,1] is admissible because \$7 \geq 2*2\$ and \$2 \geq 2*1\$. On the other hand, [2,2] is not admissible because \$2 < 2*2\$. So \$\mathrm{Sq}^7\mathrm{Sq}^2\mathrm{Sq}^1\$ is an admissible monomial, but \$\mathrm{Sq}^2\mathrm{Sq}^2\$ is not.
Every inadmissible Steenrod monomial can be expressed as a sum of admissible Steenrod monomials. For example \$\mathrm{Sq}^2\mathrm{Sq}^2 = \mathrm{Sq}^3\mathrm{Sq}^1\$, where we see that the right hand side is admissible because \$3>2*1\$. As another example, \$\mathrm{Sq}^2\mathrm{Sq}^3 = \mathrm{Sq}^5 + \mathrm{Sq}^4\mathrm{Sq}^1\$.
Our goal is to express inadmissible Steenrod monomials as sums of admissible ones. There is a formula to express an inadmissible product of two Steenrod squares as a sum of admissible monomials called the Adem relation:
\$\displaystyle\mathrm{Sq}^{a}\mathrm{Sq}^{b} = \sum_{j=0}^{a/2} \binom{b-j-1}{a-2j} \mathrm{Sq}^{a+b-j}\mathrm{Sq}^{j} \quad\text{for a < 2*b}\$
where it's understood that \$\mathrm{Sq}^{a+b}\mathrm{Sq}^0 = \mathrm{Sq}^{a+b}\$ and where the binomial coefficients are taken mod 2. In fact all arithmetic on Steenrod monomials is computed mod 2, so for instance \$\mathrm{Sq}^2\mathrm{Sq}^1 + \mathrm{Sq}^2\mathrm{Sq}^1 = 0\$.
The algorithm to express a Steenrod monomial as a sum of admissible ones is to repeatedly find the location of an inadmissible pair, apply the Adem relation and get a sum of monomials and recurse on the resulting sum.
Goal:
Take as input a list representing a Steenrod monomial. Output the set of the admissible Steenrod monomials that appear in the reduced sum. This can be represented as a list without repeats or as any sort of set / dictionary / map, where presence of a key in the map determines whether a monomial is in the set. This is code golf so shortest code wins.
Helpful Formulas for Mod 2 Binomial coefficients
\$\displaystyle\binom{n}{k} =\begin{cases} 1 & n | k = n\\ 0 & \text{else}\end{cases} = \begin{cases} 1 & (n-k) \& k = 0\\ 0 & \text{else}\end{cases}\$
where \$|\$ and \$\&\$ are bit-or and bit-and.
Examples:
Input: [4,2]
Output: [[4,2]]

Since \$4 \geq 2*2\$ the sequence is already admissible and nothing needs to be done.
Input: [2,4]
Ouput: [[6], [5,1]] (order doesn't matter)

\$2 < 2*4\$ and the sequence has length 2 so we just need to apply the Adem relation once. We get
\$\mathrm{Sq}^2\mathrm{Sq}^4 = \displaystyle\sum_{j=0}^{1} \binom{3-j}{2-2j} Sq^{6-j}Sq^j = \binom{3}{2}\mathrm{Sq}^6 + \binom{2}{0}\mathrm{Sq}^5\mathrm{Sq}^1 = \mathrm{Sq}^6 + \mathrm{Sq}^5\mathrm{Sq}^1\$ where we used \$3\%2=1\$.
Input: [2,4,2]
Output: [[6, 2]]

The pair [2,4] or \$\mathrm{Sq}^2\mathrm{Sq}^4\$ is inadmissible so applying the Adem relation there we get \$\mathrm{Sq}^2\mathrm{Sq}^4\mathrm{Sq}^2 = \mathrm{Sq}^6\mathrm{Sq}^2 + \mathrm{Sq}^5\mathrm{Sq}^1\mathrm{Sq}^2\$. Now \$6>2*2\$ so \$\mathrm{Sq}^6\mathrm{Sq}^2\$ is admissible and can be left alone. On the other hand, \$1 < 2*2\$ so there is more work to do on the other term. \$\mathrm{Sq}^1\mathrm{Sq}^2 = \mathrm{Sq}^3\$ so \$\mathrm{Sq}^5\mathrm{Sq}^1\mathrm{Sq}^2 = \mathrm{Sq}^5\mathrm{Sq}^3\$.
Since \$5<2*3\$ this can be reduced again and in fact \$\mathrm{Sq}^5\mathrm{Sq}^3 = 0\$. So \$\mathrm{Sq}^2\mathrm{Sq}^4\mathrm{Sq}^2 = \mathrm{Sq}^6\mathrm{Sq}^2\$.
Input: [2, 3, 2]
Output: []

Both [2,3] and [3,2] are inadmisible pairs so we can start in either location here. \$\def\Sq{\mathrm{Sq}}\Sq^3\Sq^2=0\$, so if we start in the second position, we immediately see the output is empty. Starting in the first position, we have \$\Sq^2\Sq^3 = \Sq^5 + \Sq^4\Sq^1\$. Then \$\Sq^5\Sq^2\$ is admissible, but \$\Sq^4\Sq^1\Sq^2\$ isn't.
\$\Sq^4\Sq^1\Sq^2 = \Sq^4\Sq^3 = \Sq^5\Sq^2\$ so the answer is \$\Sq^5\Sq^2 + \Sq^5\Sq^2 = 0\$ (all of our arithmetic is reduced mod 2).
Test cases:
Input: [1, 1]
Output: []

Input: [2,2]
Output: [[3,1]]

Input: [2, 2, 2]
Output: [[5,1]]

Input: [2,2,2,2]
Output: []

Input: [4, 2, 4, 2]
Output: [[8,3,1], [10,2]] (Again, order doesn't matter)

Input: [2, 4, 2, 4]
Output: [[8,3,1],[9,2,1],[9,3],[10,2],[11,1]]

Input: [6, 6, 6]
Output: [[12, 5, 1], [13, 4, 1], [13, 5]]

Input: [6,6,6,6]
Output: []

Input: [4, 2, 1, 4, 2, 1, 4, 2, 1]
Output: [[15,5,1],[17,3,1]]

Input: [4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1]
Output: []

Reference Implementations:
There is a javascript calculator here, which is an easy way to get more test cases.
https://math.berkeley.edu/~kruckman/adem/
Here is a python implementation:
def make_mono_admissible(result, mono):
    """Reduce a Steenrod monomial into a linear combination of admissible Steenrod monomials
       "mono" should be a tuple representing your Steenrod monomial.
       Writes answer into "result" which should be an empty dictionary.
    """
    inadmissible_indices = [j for j in range(len(mono) - 1) if mono[j] < 2*mono[j+1]]
    if not inadmissible_indices:
        if mono in result:
            del result[mono]
        else:
            result[mono] = 1
        return
    i = inadmissible_indices[0]
    a = mono[i]
    b = mono[i + 1]
    # Do adem relation for Sq^a Sq^b
    for j in range(1 + a//2):
        # check if binom(b - j - 1, a - 2j) % 2 == 1
        if (b - a + j - 1) & (a-2*j) == 0:
            new_pair = (a+b-j, j) if j>0 else (a+b,)
            make_mono_admissible(result, mono[:i] + new_pair + mono[i+2:])

As I was trying to make a TLDR, I made the following Mathematica code:
makeMonoAdmissibleStep[{a___Integer}] := {{a}}
(* If a < 2b for consecutive entries we can apply Adem relation *)
makeMonoAdmissibleStep[{start___, {p___, a_, b_, q___}, rest___}] /; a < 2 b :=
{start,
   Sequence@@
     (* If the mod 2 binomial coefficient is 1,
        add a new list with a, b replaced by a+b-#, # *)
     If[Mod[Binomial[b - # - 1, a - 2 #], 2] == 1, {p, a + b - #, # , q}, 0]&
         /@ Range[0, a/2],
 rest}] /. 0 -> Sequence[]
(* If the same list appears twice, drop it *)
makeMonoAdmissibleStep[{a___, x_List, b___, x_List, c___}] := {a, c}
(*If we can't do anything else, we're done *)
makeMonoAdmissibleStep[x_] := x
makeMonoAdmissible[l_] := FixedPoint[makeMonoAdmissibleStep, l]

Very well specified question but possibly a bit to verbose and technical for me. May try to golf the ref implementation but probably still won't understand what it is doing. +1 for the effort anyway.

Maybe I should add a suggestion to skip to the reference implementation since it's much shorter than the description.

The Sq notation is just a confusing way of writing sequences of positive integers. It's the math notation and it's psychologically difficult for me to get away from.

No prob. Maybe a  with a short summary at the top may help? I'll have a go at your Python code anyway :-)

@ElPedro How's the summary I have now? It's vague as far as what the procedure is, but the procedure involves those funny mod 2 binomial coefficients.

Neither reference implementation seems to work on TIO.

@lirtosiast The python implementation works but is a bit counterintuitive: say result = {}; make_mono_admissible(result, (2,2,2)); print(result). I don't see that TIO runs mathematica code which makes sense because it's proprietary.

Wolfram Language (Mathematica), 225 218 206 203 200 196 bytes
q=SetAttributes
{p,s}~q~Flat
s~q~Orderless
a_~s~a_:=s[]
p@0:=p[]
f=FixedPoint[#~Distribute~s&/@#/.a_~p~b_/;a<2b:>s@@(If[BitAnd[b+#-a-1,a-2#]<1,p[a+b-#,#],s[]]&)/@Range[0,a/2]&,s[p@@#]]/.s|p->List&

Try it online!
We represent the intermediate list as an expression with [[15,5,1],[17,3,1]] being s[p[15,5,1], p[17,3,1]]. In this format, Mathematica's expression engine does some heavy lifting, and allows us to use Distribute. However, it takes some work to convert between this format and lists.


text:
Generating edge cases in programming puzzles
Not exactly sure if it belongs in this site, but I always have trouble thinking of all the certain edge cases in any kind of competitive programming or puzzles.
For example, take this kind of problem

Find the size of the smallest list of squares that add up to n
f(16)-> 1 (16)
f(17)-> 2 (16+1)

One intuitive approach would be to take the largest square that fits into n, subtract, and taking the remainder and applying the function on that until n<4. This doesn't work as soon as you go to
f(18)-> 2 (9+9) rather than f(18)-> 3 (16+1+1)
While those edge cases may be easier to derive, many times edge cases will not be as intuitive. What are some general guidelines of finding such edge cases?

This is not a programming challenge, but a question about programming challenges, so it should go on meta, I think.

@Grimy Personally I'd disagree, since meta is for questions about this site, not about questions about programming challenges. The [tag:tips] tag is a good example of that kind of post being on topic here. However, I think this is irreparably broad as it is. If this were about a specific type of challenge or something, it might fit. Of course, for single challenges we have the sandbox to help with things like this.

I too think this might be better suited to Meta as it is about programming challenges; specifically how to think of  edge cases. Unfortunately, I do also think it's too broad as there is no "catch-all" answer; edge cases are, in general, specific to each challenge.

source: Stack Exchange

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

sort: votes


text:
Implement the EnScript CHS command
JonoCode9374 had almost completely implemented my language EnScript except for the CHS command. I was impatient of waiting for them to implement this command, so I chose to put this question here.
Challenge:
Write a solution that takes an input and returns the chased output. Standard loopholes are forbidden.
This is the CHS instruction reference copied from the website:

CHS means to chase all of the numbers inside an accumulator.
Chasing a number means to move a number forward inside the accumulator that-number of times.

Chasing an accumulator means to move all of the numbers inside an accumulator from the lowest number (0) to the highest number (9) sequentially, without repeating. Sequentially means: the values are moved in a sequential order that was presented in the accumulator, which is from left to right.

Here is an important note: The number is still there while the number is moved, and that number will be removed from the original number if and only if the currently chased number has been put in place.

Here is an extra note: A number with the lower magnitude should be "chased" first in the accumulator. For example, the number 1 should be chased prior to the numbers 2, 3, 4, etc.

One more note: Accumulators should be unbounded, i.e. without an upper limit. Also, they cannot and should not support negative numbers. The implementation does not have to detect that; it can assume that the input is valid.

The type of the accumulators should be in the unbounded integer form; The value of an accumulator should not be a floating-point integer.

If zeroes are in front of the number at the end of the process, they are deleted by default.

Examples:

Take A=123 as an example.
Value 1 will move forward 1 number. (It will be inserted behind 2.) So, the number will be 213. 1 will be marked as chased.
Likewise, 2 will also be moved. It will be moved forward twice, so the number will be 132.
3 will also be chased. It will move forward 1 time (finding that the end of the list is reached), and then it will go to the place before 1. Then, it will go back to where it was.
Accumulator A "chased" will be 132.

Also, take 3112 as an example, which is quite vague. Some people may ask: which '1' gets "chased" first?
Answer: The first '1' from left to right gets "chased" first. See the notes from above.
So, the chase after 1 iteration will be:
31121324→31131224
Another example. 10 will be chased to 01, as 0 cannot be moved and 1 will be moved for 1 digit. Then, this preceding 0 will be deleted, leaving a 1 to the accumulators.
Test Cases:
123 -> 132
12345 -> 14253
3141 -> 3141
123123 -> 312132
94634 -> 96434
1277 -> 7172
10 -> 1

Please comment for me if this question is too vague!

Comments are not for extended discussion; this conversation has been moved to chat.

For added clarity I would suggest showing the steps involved for each of your test cases.

Why does the EnScript link lead to the talk page?

Python 3, 262 ... 170 bytes
This program outputs the result via Stderr.
I'm a bit out of practice at golfing, since I have not been too active lately, so I'm sure it can be golfed more.
L=[[c,int(c)]for c in input()]
while 1:i=L.index(min([x for x in L if x[1]]or exit(str(int("".join(x[0]for x in L))))));L[i][1]-=1;q=i+1<len(L)and-~i;L.insert(q,L.pop(i))

Try it online
Ungolfed
# Index to shift, Times remaining
def Shift(i, t):
    if t<1:
        L[i][1]=0
        return
    if i+1<len(L):
        L[i],L[i+1]=L[i+1],L[i]
        Shift(i+1,t-1)
    else:
        L.insert(0,L.pop())
        Shift(0,t-1)
L=[[c,1]for c in input()]
while 1:
    t=[x for x in L if x[1]]or exit("".join(x[0]for x in L).lstrip('0'))
    i=L.index(min(t,key=lambda x:x[0]))
    Shift(i,int(L[i][0]))

str(int(...)) is two bytes shorter than ....lstrip('0')

@UserA The comments on that page seem to suggest that the short version doesn't actually work. Also, that's just a utility function used in the longer code below, which is actually the solution. Mine looks shorter than that.

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


text:
Proving that a Russian cryptographic standard is too structured
The aim of this challenge is to find an impossibly short
implementation of the following function p, in the langage of your
choosing. Here is C code implementing it (see
this TIO link that also prints its outputs) and a wikipedia page containing it.
unsigned char pi[] = {
    252,238,221,17,207,110,49,22,251,196,250,218,35,197,4,77,
    233,119,240,219,147,46,153,186,23,54,241,187,20,205,95,193,
    249,24,101,90,226,92,239,33,129,28,60,66,139,1,142,79,
    5,132,2,174,227,106,143,160,6,11,237,152,127,212,211,31,
    235,52,44,81,234,200,72,171,242,42,104,162,253,58,206,204,
    181,112,14,86,8,12,118,18,191,114,19,71,156,183,93,135,
    21,161,150,41,16,123,154,199,243,145,120,111,157,158,178,177,
    50,117,25,61,255,53,138,126,109,84,198,128,195,189,13,87,
    223,245,36,169,62,168,67,201,215,121,214,246,124,34,185,3,
    224,15,236,222,122,148,176,188,220,232,40,80,78,51,10,74,
    167,151,96,115,30,0,98,68,26,184,56,130,100,159,38,65,
    173,69,70,146,39,94,85,47,140,163,165,125,105,213,149,59,
    7,88,179,64,134,172,29,247,48,55,107,228,136,217,231,137,
    225,27,131,73,76,63,248,254,141,83,170,144,202,216,133,97,
    32,113,103,164,45,43,9,91,203,155,37,208,190,229,108,82,
    89,166,116,210,230,244,180,192,209,102,175,194,57,75,99,182,
};

unsigned char p(unsigned char x) {
     return pi[x];
}

What is p
p is a component of two Russian cryptographic standards, namely the hash function Streebog and the block cipher Kuznyechik. In this article (and during ISO meetings), the designers of these algorithms claimed that they generated the array pi by picking random 8-bit permutations.
"Impossible" implementations
There are \$256! \approx 2^{1684}\$ permutations on 8 bits. Hence, for a given random permutation, a program that implement it shall not be expected to need fewer than 1683 bits.
However, we have found multiple abnormally small implementations (which we list here), for
example the following C program:
p(x){unsigned char*k="@`rFTDVbpPBvdtfR@\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8",l=0,b=17;while(--l&&x^1)x=2*x^x/128*285;return l%b?k[l%b]^k[b+l/b]^b:k[l/b]^188;}

which contains only 158 characters and thus fits in 1264 bits. Click here to see that it works.
We talk about an "impossibly" short implementation because, if the
permutation was the output of a random process (as claimed by its
designers), then a program this short would not exist (see this page for more details).
Reference implementation
A more readable version of the previous C code is:
unsigned char p(unsigned char x){
     unsigned char
         s[]={1,221,146,79,147,153,11,68,214,215,78,220,152,10,69},
         k[]={0,32,50,6,20,4,22,34,48,16,2,54,36,52,38,18,0};
     if(x != 0) {
         unsigned char l=1, a=2;
         while(a!=x) {
             a=(a<<1)^(a>>7)*29;
             l++;
         }
         unsigned char i = l % 17, j = l / 17;
         if (i != 0) return 252^k[i]^s[j];
         else return 252^k[j];
     }
     else return 252;
}

The table k is such that k[x] = L(16-x), where L is linear in the sense that L(x^y)==L(x)^L(y), and where, like in C, ^ denotes the XOR. However, we did not manage to leverage this property to shorten our implementation. We are not aware of any structure in s that could allow a simpler implementation---its output is always in the subfield though, i.e. \$s[x]^{16}=s[x]\$ where the exponentiation is done in the finite field. Of course, you are absolutely free to use a simpler expression of s should you find one!
The while loop corresponds to the evaluation of a discrete logarithm in the finite field with 256 elements. It works via a simple brute-force search: the dummy variable a is set to be a generator of the finite field, and it is multiplied by this generator until the result is equal to x. When it is the case, we have that l is the discrete log of x. This function is not defined in 0, hence the special case corresponding to the if statement.
The multiplication by the generator can be seen as a multiplication by \$X\$ in \$\mathbb{F}_2[X]\$ which is then reduced modulo the polynomial \$X^8+X^4+X^3+X^2+1\$. The role of the unsigned char is to ensure that the variable a stays on 8 bits. Alternatively, we could use a=(a<<1)^(a>>7)*(256^29), in which case a could be an int (or any other integer type). On the other hand, it is necessary to start with l=1,a=2 as we need to have l=255 when x is equal to 1.
More details on the properties of p are presented in our paper, with a
writeup of most of our optimizations to obtain the previous short
implementation.
Rules
Propose a program that implements the function p in less than 1683
bits. As the shorter the program, the more abnormal it is, for a given
language, shorter is better. If your language happens to have
Kuznyechik, Streebog or p as a builtin, you cannot use them.
The metric we use to determine the best implementation is the program length in bytes. We use the bit-length in our academic paper but we stick to bytes here for the sake of simplicity.
If your language does not have a clear notion of function, argument or
output, the encoding is up to you to define, but tricks like encoding
the value pi[x] as x are obviously forbidden.
We have already submitted a research paper with our findings on this
topic. It is available here. However, should it be published in a scientific venue, we will
gladly acknowledge the authors of the best implementations.
By the way, thanks to xnor for his help when drafting this question!

I hope someone submits an answer in Seed.

That looks quite interesting:) Can you explain: What exactly does L do? Regarding input/output: By default we allow a variety of input and output methods for code-golf to accommodate for the different types of languages. If there is something that you think does not apply for this challenge please mention this. I'm curious to see what people come up with!

Similarily, can, for example, brainfuck code be scored at 3 bits per character if it has no nops? And is the 1683 bits at most a strict restriction [sic?] or the goal?

"If the permutation was the output of a random process (as claimed by its designers), then a program this short would not exist" I disagree (although it doesn't matter for the challenge). If it was the output of a random process, it would be unlikely that such program existed; or it would be difficult to find

@LuisMendo For probabilities less than 1 in 10^100, insisting on the term "unlikely" rather than "impossible" is just pedantry. (At least in a programming context. If we were doing pure math, the distinction would be important).

@Grimy The statement then a program this short would not exist is a conceptual one (not a programming one). Using your terms, it belongs to the pure-math world, not to the programming world

For your C program, you can assign the last value to any variable instead of returning it, and it'll work as if you returned it in GCC (I think that's UB though)

In the paper, an 80 byte solution was achieved. Perhaps this should be mentioned in the challenge.

Although the "program this short would not exist" statement is technically false, the chances of a program under 1300 bits existing for a completely random 1683-bit sequence are about 1 in 10^115

@lirtosiast That's what I was thinking. The S-box was reverse engineered into several different possible representations, and those representations would be far easier to compress and golf than the raw permutation of values.

It may have been already noticed, but just in case: $s_i \text{ XOR } s_{i-1}$ results in only 8 distinct values: $1,10,68,79,146,153,220,221$ (starting with $i=1$ and assuming $s_0=0$).

Also, there are countless ways of sorting $s$ such that $s_i\text{ XOR }s_{i-1}$ results in only 4 distinct values. Example: [ 11, 153, 146, 221, 79, 68, 214, 215, 152, 147, 220, 78, 1, 10, 69 ] can be built by XOR'ing with { 1, 11, 79, 146 }.

I am very impressed by the implementations found! Let me answer some questions. I stuck with the byte count as a measure of size as a more finer grained estimate can be difficult in some context. It also makes little difference between different programs in a given language. The patterns in the table found by Arnaud are consequences of the linearity of the corresponding component. Finally, the term "impossible" is indeed used a bit loosely here; I am more rigorous in the explanation on my website (and in the paper). Still, we are talking about very, very unlikely events.

This is likely a botched attempt to create a kleptographic backdoor.

@RobinRyder I can answer in Seed.

AMD64 Assembly (78 bytes or 624 bits of machine code)
uint8_t SubByte(uint8_t x) {
    uint8_t y,z;
    uint8_t s[]=
      {1,221,146,79,147,153,11,68,214,215,78,220,152,10,69};

    uint8_t k[]=
      {0,32,50,6,20,4,22,34,48,16,2,54,36,52,38,18,0};

    if(x) {
      for(y=z=1;(y=(y<<1)^((y>>7)*29)) != x;z++);
      x = (z % 17);
      z = (z / 17);
      x = (x) ? k[x] ^ s[z] : k[z];
    }
    return x^252;
}

64-bit x86 assembly

    ; 78 bytes of AMD64 assembly
    ; odzhan
    bits   64

    %ifndef BIN
      global SubBytex
    %endif

SubBytex:
    mov    al, 252
    jecxz  L2                ; if(x) {
    call   L0
k:
    db     0xfc, 0xdc, 0xce, 0xfa, 0xe8, 0xf8, 0xea, 0xde,
    db     0xcc, 0xec, 0xfe, 0xca, 0xd8, 0xc8, 0xda, 0xee, 0xfc
s:
    db     0x01, 0xdd, 0x92, 0x4f, 0x93, 0x99, 0x0b, 0x44,
    db     0xd6, 0xd7, 0x4e, 0xdc, 0x98, 0x0a, 0x45
L0:
    pop    rbx
    mov    al, 1             ; y = 1
    cdq                      ; z = 0
L1:
    inc    dl                ; z++
    add    al, al            ; y = y + y
    jnc    $+4               ; skip XOR if no carry
    xor    al, 29            ;
    cmp    al, cl            ; if(y != x) goto L1
    jne    L1

    xchg   eax, edx          ; eax = z
    cdq                      ; edx = 0
    mov    cl, 17            ; al = z / 17, dl = z % 17
    div    ecx

    mov    cl, [rbx+rax+17]  ; cl = s[z]
    xlatb                    ; al = k[z]
    test   dl, dl            ; if(x == 0) goto L2
    jz     L2
    xchg   eax, edx          ; al = x
    xlatb                    ; al = k[x]
    xor    al, cl            ; al ^= s[z]
L2:
    ret

Disassembled 64-bit code

00000000  B0FC              mov al,0xfc
00000002  67E348            jecxz 0x4d
00000005  E820000000        call qword 0x2a
; k[] = 0xfc, 0xdc, 0xce, 0xfa, 0xe8, 0xf8, 0xea, 0xde,
;       0xcc, 0xec, 0xfe, 0xca, 0xd8, 0xc8, 0xda, 0xee, 0xfc
; s[] = 0x01, 0xdd, 0x92, 0x4f, 0x93, 0x99, 0x0b, 0x44,
;       0xd6, 0xd7, 0x4e, 0xdc, 0x98, 0x0a, 0x45
0000002A  5B                pop rbx
0000002B  B001              mov al,0x1
0000002D  99                cdq
0000002E  FEC2              inc dl
00000030  00C0              add al,al
00000032  7302              jnc 0x36
00000034  341D              xor al,0x1d
00000036  38C8              cmp al,cl
00000038  75F4              jnz 0x2e
0000003A  92                xchg eax,edx
0000003B  99                cdq
0000003C  B111              mov cl,0x11
0000003E  F7F1              div ecx
00000040  8A4C0311          mov cl,[rbx+rax+0x11]
00000044  D7                xlatb
00000045  84D2              test dl,dl
00000047  7404              jz 0x4d
00000049  92                xchg eax,edx
0000004A  D7                xlatb
0000004B  30C8              xor al,cl
0000004D  C3                ret

32-bit x86 assembly

    ; 72 bytes of x86 assembly
    ; odzhan
    bits   32

    %ifndef BIN
      global SubBytex
      global _SubBytex
    %endif

SubBytex:
_SubBytex:
    mov    al, 252
    jecxz  L2                ; if(x) {
    call   L0
k:
    db     0xfc, 0xdc, 0xce, 0xfa, 0xe8, 0xf8, 0xea, 0xde,
    db     0xcc, 0xec, 0xfe, 0xca, 0xd8, 0xc8, 0xda, 0xee, 0xfc
s:
    db     0x01, 0xdd, 0x92, 0x4f, 0x93, 0x99, 0x0b, 0x44,
    db     0xd6, 0xd7, 0x4e, 0xdc, 0x98, 0x0a, 0x45
L0:
    pop    ebx
    mov    al, 1             ; y = 1
    cdq                      ; z = 0
L1:
    inc    edx               ; z++
    add    al, al            ; y = y + y
    jnc    $+4               ; skip XOR if no carry
    xor    al, 29            ;
    cmp    al, cl            ; if(y != x) goto L1
    jne    L1
    xchg   eax, edx          ; al = z
    aam    17                ; al|x = z % 17, ah|z = z / 17
    mov    cl, ah            ; cl = z
    cmove  eax, ecx          ; if(x == 0) al = z else al = x
    xlatb                    ; al = k[z] or k[x]
    jz     L2                ; if(x == 0) goto L2
    xor    al, [ebx+ecx+17]  ; k[x] ^= k[z]
L2:
    ret

Disassembled 32-bit code

00000000  B0FC              mov al,0xfc
00000002  E345              jecxz 0x49
00000004  E820000000        call dword 0x29
; k[] = 0xfc, 0xdc, 0xce, 0xfa, 0xe8, 0xf8, 0xea, 0xde,
;       0xcc, 0xec, 0xfe, 0xca, 0xd8, 0xc8, 0xda, 0xee, 0xfc
; s[] = 0x01, 0xdd, 0x92, 0x4f, 0x93, 0x99, 0x0b, 0x44,
;       0xd6, 0xd7, 0x4e, 0xdc, 0x98, 0x0a, 0x45
00000029  5B                pop ebx
0000002A  B001              mov al,0x1
0000002C  99                cdq
0000002D  42                inc edx
0000002E  00C0              add al,al
00000030  7302              jnc 0x34
00000032  341D              xor al,0x1d
00000034  38C8              cmp al,cl
00000036  75F5              jnz 0x2d
00000038  92                xchg eax,edx
00000039  D411              aam 0x11
0000003B  88E1              mov cl,ah
0000003D  0F44C1            cmovz eax,ecx
00000040  D7                xlatb
00000041  7404              jz 0x47
00000043  32440B11          xor al,[ebx+ecx+0x11]
00000047  C3                ret

Nice answer!  Since the OP was looking for bit count, this (85 bytes) comes out to 680 bits, using 8 bits per byte, or 595 bits using 7 bits per byte (possible since all the characters are ASCII).  You could probably go shorter if you compressed to an even more restrictive character set.

Welcome to PPCG; nice first solution.

@Cullub I don't understand your comment about ASCII, surely that doesn't apply to machine code?

It doesn't apply to this one in specific because amd64 uses 8 bit characters.  However, all of ASCII can fit into just 7bits, so if we're talking bit counts, and just counting up the number of bits used in the code above, which comprises solely of ASCII characters, we could use special counting methods if we wanted to

@Cullub My point was, the code in this answer is just C/Assembler that gets compiled, so the byte count isn't that of the given code, but of the compiled code. And that's not ASCII.

Just for clarification, the 84 bytes is the size of the machine code after this has been assembled? If so the title should be updated to reflect that this is a machine code answer rather than an assembly answer.

@odzhan: machine-code answers should include the actual answer (a hexdump of the machine code)!  e.g. like a nasm -l/dev/stdout listing or objdump -d, or a separate block of hexdump separate from the source code.  See Tips for golfing in x86/x64 machine code for examples.  My answer on The Chroma Key to Success shows how to use nasm | cut -b -28,$((28+12))- to get reasonably narrow listings that fit well into answers.

And BTW, you don't have to use a standard calling convention; you can use a custom convention where RBX is call-clobbered, saving 2 bytes for push/pop.  (And where uint8_t args are zero-extended to 64-bit for JRCXZ). Also, if you write position-dependent code you can put the table address into a register with a 5-byte mov ebx, imm32 instead of a 6-byte call/pop.  Or use it as a disp32 in mov al, [table + rax], but that might lose since you have two xlatb and a mov already.  The call+pop shellcode trick does win vs. 7-byte RIP-relative LEA with the data after the ret, though.

Have you considered using 32-bit mode for division by an immediate with aam 17?  You can still use a register-arg calling convention, and clobber as many regs as you want with a custom calling convention.

Hey all, thanks for the feedback. @PeterCordes I did consider writing a 32-bit version and using AAM for the division, but haven't tried. Wanted to avoid saving+restoring RBX. This works if assembled with NASM/YASM and linked with C code using MSVC or MinGW.

To make it testable from C, you can write a wrapper function in asm (that saves/restores extra registers and adapts for args / return value in different regs), and call that wrapper from C.  The wrapper isn't part of your answer / byte-count, because the language you're using is machine-code (where custom calling conventions for private helper functions is fine), not C.

Okay, I didn't know that would be allowed. I'll update the answer.

CJam, 72 67 66 63 bytes
ri{_2md142*^}es*]2#~Hmd{5\}e|Fm2b"Ý0$&Ü™ÖD’
˜×EO“N".*Lts:^i

es* repeats something by the current timestamp, which is a big number, and it would take too long to finish.
Actually testable version, 64 bytes:
ri{_2md142*^}256*]2#~Hmd{5\}e|Fm2b"Ý0$&Ü™ÖD’
˜×EO“N".*Lts:^i

00000000: 7269 7b5f 326d 6431 3432 2a5e 7d32 3536  ri{_2md142*^}256
00000010: 2a5d 3223 7e48 6d64 7b35 5c7d 657c 466d  *]2#~Hmd{5\}e|Fm
00000020: 3262 22dd 3024 2612 dc99 d644 0092 0b0a  2b".0$&....D....
00000030: 98d7 454f 934e 0122 2e2a 4c74 733a 5e69  ..EO.N.".*Lts:^i

Try it online!
Try all online!
To run this code (on a Linux machine), you need to add the line en_US.ISO-8859-1 ISO-8859-1 into /etc/locale.gen and run locale-gen. Then you could use:
LANG=en_US.ISO-8859-1 java -jar cjam.jar <source file>

Or you could try this equivalent 72 byte UTF-8 version:
00000000: 7269 7b5f 326d 6431 3432 2a5e 7d32 3536  ri{_2md142*^}256
00000010: 2a5d 3223 7e48 6d64 7b35 5c7d 657c 466d  *]2#~Hmd{5\}e|Fm
00000020: 3262 22c3 9d30 2426 12c3 9cc2 99c3 9644  2b"..0$&.......D
00000030: 00c2 920b 0ac2 98c3 9745 4fc2 934e 0122  .........EO..N."
00000040: 2e2a 4c74 733a 5e69                      .*Lts:^i

Explanation
ri               e# Read input.
{_2md142*^}      e# Copy and divide by 2. If remainder is 1, xor 142.
es*]             e# Repeat a lot of times and wrap all results in an array.
2#               e# Find the first occurrence of 2, -1 if not found.
~                e# Increment and negate.
Hmd              e# Divmod 17. Both the quotient and remainder would be negated.
{5\}e|           e# If remainder = 0, return 5, quotient instead.
Fm2b             e# Subtract 15 from the remainder and expand in base 2.
                 e# In CJam, base conversion only applies to the absolute value.
"...".*          e# Filter 221, 48, 36, 38, 18 by the bits.
                 e# 221, the characters after 18
                 e#   and 18 itself in case quotient - 15 = -15 won't change.
Lt               e# Remove the item s[quotient] xor 220.
                 e# Quotient is 0, 5 or a negative integer from the end,
                 e#   which doesn't overlap with the previously filtered items.
s                e# Flatten, because some characters become strings after the process.
:^i              e# Reduce by xor and make sure the result is an integer.

The characters in the string are:

221. See below.
48, 36, 38, 18. It's the linear decomposition of k based on the characteristics of L in the question.
220, the filler value of array s when only array k is used.
Array s xor 220 reversed, except for the last element, or the first element before reversed, which is the 221 at the beginning of the string.

What would you do with power set? PS I'm probably going to steal that trick of doing the finite field operation in reverse. Very neat.

@PeterTaylor You could get array k using the power set of [48 36 38 18] (or its reverse) with the most straightforward ordering, and reduce each by xor. But in the golfing languages used in this question so far, only 05AB1E had the right ordering. Jelly and Stax apparently had a different idea about what I thought should be straightforward.

I'm currently in the process of golfing your answer to 05AB1E. What are the integer values for your string "Ý0$&Ü™ÖD�’\n˜×EO“N"?

@KevinCruijssen Are you asking about what they meant, or their numeric values (which you could see from the hex dump)?

@jimmy23013 Ah, of course.. Forgot about the hex-dump..

Jelly 71 59 bytes
H^142ƊHḂ?Ƭi2d17U⁸⁴;$Ḣ?$CµṪạ⁴B¬T;;6ị“Œ0$&ØŀWð⁺Ṫ\ḢĠVı⁻¹]°Ẇ‘^/

Try it online!
Verify all possibilities
Now rewritten using a reworked version of jimmy23013’s clever CJam answer so be sure to upvote that one too! Uses only 472 bits (28.0% of the naive approach). @jimmy23013 has also saved another byte!
Explanation
Stage 1
         Ƭ        | Repeat the following until no new entries:
       Ḃ?         | - If odd:
     Ɗ            |   - Then following as a monad:
H                 |     - Halve
 ^142             |     - Xor 142
      H           |   - Else: Halve
          i2      | Index of 2 in this list

Stage 2
d17           | Divmod 17
          $   | Following as a monad:
   U          | - Reverse order
        Ḣ?    | - If head (remainder from divmod) non-zero:
    ⁸         |   - Then: left argument [quotient, remainder]
     ⁴;$      |   - Else: [16, quotient]
           C  | Complement (1 minus)
            µ | Start a new monadic chain

Stage 3
Ṫ                   | Tail (Complement of remainder or quotient from stage 2)
 ạ⁴                 | Absolute difference from 16
   B                | Convert to binary
    ¬               | Not
     T              | Indices of true values
      ;             | Concatenate (to the other value from stage 2)
       ;6           | Concatenate to 6
         ị“Œ...Ẇ‘   | Index into [19,48,36,38,18,238,87,24,138,206,92,197,196,86,25,139,129,93,128,207]
                 ^/ | Reduce using xor

Original approach
Jelly, 71 66 bytes
H^142ƊHḂ?Ƭi2d:j@“ÐḌ‘ɗ%?17ị"“p?Ä>4ɼḋ{zẉq5ʂċ¡Ḅ“`rFTDVbpPBvdtfR@‘^ƒ17

Try it online!
Verify all possibilities
A monadic link or full program that takes a single argument and returns the relevant value of pi[x]. This is 536 bits, so under a third of the naive storage of pi.
Saved 3 bytes by using the method for finding l from jimmy23013’s CJam answer so be sure to upvote that one too!
Explanation
Stage 1
         Ƭ        | Repeat the following until no new entries:
       Ḃ?         | - If odd:
     Ɗ            |   - Then following as a monad:
H                 |     - Halve
 ^142             |     - Xor 142
      H           |   - Else: Halve
          i2      | Index of 2 in this list

Stage 2
         %?17  | If not divisible by 17
d              | - Then divmod 17
        ɗ      | - Else following as a dyad (using 17 as right argument)
 :             |   - Integer divide by 17
  j@“ÐḌ‘       |   - Join the list 15,173 by the quotient

Stage 3
ị"“p...Ḅ“`...@‘     | Index into two compressed lists of integers using the output from stage 2 (separate list for each output from stage 2). The third output from stage 2 will be left untouched
               ^ƒ17 | Finally reduce using Xor and 17 as the first argument

59 bytes, another version.

C (gcc), 157 148 140 139 bytes
Modest improvement over the C example.
l,b=17,*k=L"@`rFTDVbpPBvdtfR@";p(x){for(l=256;--l*~-x;)x=2*x^x/128*285;return l%b?k[l%b]^"\xcer?\4@6\xc8\t{|\3q5\xc7\n"[l/b]-b:k[l/b]^188;}

Try it online!
C (gcc), 150 142 127 126 bytes
This one depends on gcc and x86 and UTF-8 quirks.
l,*k=L"@`rFTDVbpPBvdtfR@";p(x){for(l=256;--l*~-x;)x=2*x^x/128*285;x=l%17?k[l%17]^L"½a.ó/%·øjkò`$¶ù"[l/17]:k[l/17]^188;}

Try it online!
Thanks to @XavierBonnetain for -1 and less undefined behaviour.

Stax, 65 64 62 59 58 bytes
ç∙¼≥2▼Uó╤áπ╙º┐╩♫∟öv◘≥δ♦Θ╫»─kRWÑâBG")≥ö0╥kƒg┬^S ΔrΩ►╣Wü Ü╕║

Run and debug it
Unfortunately, this program uses some instructions that internally use some deprecated stax instructions.  I just forgot to update their implementation.  This causes some spurious warning to appear, but the results are still correct.
This is inspired by jimmy23013's excellent answer.  Some parts have been changed to suit stax better.
Stax programs written in printable ASCII have an alternative representation that saves slightly more than 1 bit per byte, since there are only 95 printable ASCII characters.
Here's the ascii representation of this program formatted for "readability" with comments.
{                       begin block
  2|%142*S              given n, calculate (n/2)^(n%2*142)
                         - this seems to be the inverse of the operation in the while loop
gu                      use block to generate distinct values until duplicate is found
                         - starting from the input; result will be an array of generated values
2I^                     1-based index of 2 in the generated values
17|%                    divmod 17
c{Us}?                  if the remainder is zero, then use (-1, quotient) instead
~                       push the top of the main stack to the input stack for later use
"i1{%oBTq\z^7pSt+cS4"   ascii string literal; will be transformed into a variant of `s`
./o{H|EF                interpret ascii codes as base-94 integer
                         - this is tolerant of digits that exceed the base
                        then encode big constant as into base 222 digits
                         - this produces an array similar to s
                         - 0 has been appended, and all elements xor 220
@                       use the quotient to index into this array
"jr+R"!                 packed integer array literal [18, 38, 36, 48]
F                       for each, execute the rest of the program
  ;                     peek from the input array, stored earlier
  v                     decrement
  i:@                   get the i-th bit where i is the iteration index 0..3
  *                     multiply the bit by value from the array literal
  S                     xor with result so far
                        after the loop, the top of the stack is printed implicitly

Run this one
Modified version to run for all inputs 0..255

Stax has S for power set. You could get the power set of [18 38 36 48], index and reduce by xor. (I don't know Stax and I'm not sure it would be shorter though.)

I think stax's ordering for subsets produced by the S operator aren't in the right order for that to work.  e.g. "abc"SJ (powerset of "abc" joined with spaces) produces "a ab abc ac b bc c".

05AB1E, 101 100 98 97 95 94 bytes
U•α">η≠ε∍$<Θγ\&@(Σα•₅вV₁[<ÐX*Q#X·₁%Xžy÷Ƶ¹*₁%^₁%U}D17©%DĀiYsès®÷•¾#kôlb¸ù,-ó"a·ú•₅вë\Ƶ∞s®÷Y}sè^

-3 bytes thanks to @Grimy.
Try it online or verify all test cases.
Explanation:
Port of Xavier Bonnetain's C function (1106 bits version) from here, with the same improvement @ceilingcat made in his C answer to save 3 bytes, so make sure to upvote him!
U                    # Store the (implicit) input in variable `X`
•α">η≠ε∍$<Θγ\&@(Σα• "# Push compressed integer 20576992798525946719126649319401629993024
 ₅в                  # Converted to base-255 as list:
                     #  [64,96,114,70,84,68,86,98,112,80,66,118,100,116,102,82,64]
   V                 # Pop and store this list in variable `Y`
₁                    # Push `i` = 256
 [                   # Start an infinite loop:
  <                  #  Decrease `i` by 1
   Ð                 #  Triplicate `i`
    X*Q              #  If `i` multiplied by `X` is equal to `i` (i==0 or X==1):
       #             #   Stop the infinite loop
  X·₁%               #  Calculate double(`X`) modulo-256
                     #  (NOTE: all the modulo-256 are to mimic an unsigned char in C)
  Xžy÷               #  Calculate `X` integer-divided by builtin integer 128,
      Ƶ¹*            #  multiplied by compressed integer 285,
         ₁%          #  modulo-256
  ^                  #  Bitwise-XOR those together
   ₁%                #  And take modulo-256 again
  U                  #  Then pop and store it as new `X`
 }D                  # After the loop: Duplicate the resulting `i`
   17©               # Push 17 (and store it in variable `®` without popping)
      %              # Calculate `i` modulo-17
       D             # Duplicate it
        Āi           # If it's NOT 0:
          Ysè        #  Index the duplicated `i` modulo-17 into list `Y`
          s®÷        #  Calculate `i` integer-divided by 17
          •¾#kôlb¸ù,-ó"a·ú•
                    "#  Push compressed integer 930891775969900394811589640717060184
           ₅в        #  Converted to base-255 as list:
                     #   [189,97,46,243,47,37,183,248,106,107,242,96,36,182,249]
         ë           # Else (`i` == 0):
          \          #  Discard the duplicated `i` modulo-17, since we don't need it
          Ƶ∞         #  Push compressed integer 188
          s®÷        #  Calculate `i` integer-divided by 17
          Y          #  Push list `Y`
         }s          # After the if-else: swap the integer and list on the stack
           è         # And index the `i` modulo/integer-divided by 17 into the list
            ^        # Then Bitwise-XOR the top two together
                     # (after which the top of the stack is output implicitly as result)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why •α">η≠ε∍$<Θγ\&@(Σα• is 20576992798525946719126649319401629993024; •α">η≠ε∍$<Θγ\&@(Σα•₅в is [64,96,114,70,84,68,86,98,112,80,66,118,100,116,102,82,64]; Ƶ¹ is 285; •¾#kôlb¸ù,-ó"a·ú• is 930891775969900394811589640717060184; •¾#kôlb¸ù,-ó"a·ú•₅в is [189,97,46,243,47,37,183,248,106,107,242,96,36,182,249]; and Ƶ∞ is 188.

@Grimy Thanks, I always forgot that kind of golf with the compressed integer lists.. (PS: You can surround code containing in the comments with two of them at both sides. I.e. with ' instead of: ''code'code''.)

Whoops, sorry about the messed up formatting. I know about doubling backticks, but I didn't realize the compressed list had a backtick in it. Also: s^ => ^ (XOR is commutative). Actually, isn't s^_ just the same as Q?

@Grimy Thanks! You're indeed right. We basically check if one of the following three things is truthy to exit the loop: i==0 || X==0 || X==1.

Python 3, 151 bytes
f=lambda x,l=255,k=b'@`rFTDVbpPBvdtfR@':f(x*2^x//128*285,l-1)if~-x*l else[k[l%17]^(0x450a98dc4ed7d6440b99934f92dd01>>l//17*8&255),k[l//17]][l%17<1]^188

Try it online!
A function that implements the permutation. The code uses only 7-bit ASCII chars.
Encodes k as a Python 3 bytestring, shifted ^64 into the printable range. In contrast, s is encoded as the base-256 digits of a numerical constant, and the digits are extracted as [number]>>[shift]*8&255. This was shorter than encoding s in a string due to the number of escape characters this required, even with an optimal shift ^160 to minimize those.
The discrete-log computation is done backwards. The update x=x*2^x//128*285 loops forward in the cyclic group by simulating multiplying by the generate, until it reaches the identity x=1. We start the discrete log at l=255 (the cycle length), and decrement it each iteration. To handle the x=0 case and make it not loop forever, we also terminate when l=0, which makes x=0 map to l=0 as specified.

Python 2 loses out on not having nice bytestrings, so we need to do map(ord,...) (ArBo saved a byte here). It lets us use / rather than // for integer division.
Python 2, 156 bytes
f=lambda x,l=255,k=map(ord,'@`rFTDVbpPBvdtfR@'):f(x*2^x/128*285,l-1)if~-x*l else[k[l%17]^(0x450a98dc4ed7d6440b99934f92dd01>>l/17*8&255),k[l/17]][l%17<1]^188

Try it online!

JavaScript (ES6), 139 bytes
Similar to the Node.js version, but using characters beyond the ASCII range.
f=(x,l=256,b=17,k=i=>"@`rFTDVbpPBvdtfR@¬p?â>4¦é{zãq5§è".charCodeAt(i))=>--l*x^l?f(x+x^(x>>7)*285,l):l%b?k(l%b)^k(b+l/b)^b:k(l/b)^188

Try it online!

JavaScript (Node.js),  149  148 bytes
Based on Xavier Bonnetain's C implementation (which is presented here).
f=(x,l=256,b=17,k=i=>Buffer("@`rFTDVbpPBvdtfR@,p?b>4&i{zcq5'h")[~~i]|3302528>>i-b&128)=>--l*x^l?f(x+x^(x>>7)*285,l):l%b?k(l%b)^k(b+l/b)^b:k(l/b)^188

Try it online!
Encoding
In Xavier's original answer, the tables s[] and k[] are stored in the following string:
"@`rFTDVbpPBvdtfR@\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8"
 \_______________/\__________________________________/
         k                         s

The first 17 characters are the ASCII representations of k[i] XOR 64 and the
next 15 characters are the ASCII representations of s[i-17] XOR 173, or s[i-17] XOR 64 XOR 17 XOR 252.
All the ASCII codes for k[i] XOR 64 are matching printable characters, but 7 ASCII codes for s[i-17] XOR 173 are beyond \$126\$ and need to be escaped. We force them into the printable range by subtracting \$128\$.
Here is what we get:
original value : 172 112  63 226  62  52 166 233 123 122 227 113  53 167 232
subtract 128?  :   1   0   0   1   0   0   1   1   0   0   1   0   0   1   1
result         :  44 112  63  98  62  52  38 105 123 122  99 113  53  39 104
as ASCII       : "," "p" "?" "b" ">" "4" "&" "i" "{" "z" "c" "q" "5" "'" "h"

By reversing the bitmask formed by the 2nd row in the above table, we get 110010011001001 in binary, or \$25801\$ in decimal.
This bitmask is multiplied by \$128\$, so that we can directly perform a bitwise OR with the extracted bit. Hence the formula:
| 3302528 >> i - b & 128

Building \$s\$
NB: This is just a side note, unrelated to the above answers.
This code demonstrates how \$s\$ can be built by XOR'ing only 4 distinct values together.
In this example, we are using all 15 non-empty subsets of \$\{1, 11, 79, 146\}\$, but other values can be chosen.
console.log(
  [ 0b0001, 0b1100, 0b1000, 0b0100, 0b1001, 0b1010, 0b0010, 0b0110,
    0b1110, 0b1111, 0b0101, 0b1101, 0b1011, 0b0011, 0b0111
  ].map(x =>
    [ 1, 11, 79, 146 ].reduce((p, c, i) =>
      p ^= x >> i & 1 && c,
      0
    )
  )
)

Try it online!

Python 3, 182 bytes
def p(x,t=b'@`rFTDVbpPBvdtfR@\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8',l=255,d=17):
 if x<2:return 252-14*x
 while~-x:x=x*2^(x>>7)*285;l-=1
 return(188^t[l//d],d^t[l%d]^t[d+l//d])[l%d>0]

Try it online!
Python isn't going to win first prize here, but this is still a 10-byte golf of the best Python program here.
Python 3, 176 bytes
p=lambda x,l=255,t=b'@`rFTDVbpPBvdtfR@\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8',d=17:2>x<l>254and-14*x+252or(p(x*2^(x>>7)*285,l-1)if~-x else(188^t[l//d],d^t[l%d]^t[d+l//d])[l%d>0])

Try it online!
As a lambda, it's six bytes shorter still. It pains me to have to use if... else, but I don't see another option for short-circuiting, given how 0 is a possible answer.
Python 3, 173 bytes
p=lambda x,l=255,t=bytes('@`rFTDVbpPBvdtfR@¬p?â>4¦é{zãq5§è','l1'),d=17:2>x<l>254and-14*x+252or(p(x*2^(x>>7)*285,l-1)if~-x else(188^t[l//d],d^t[l%d]^t[d+l//d])[l%d>0])

Try it online!
Even shorter in bytes (though I'm not sure about bits, because this isn't pure ASCII anymore), courtesy of ovs.

3 bytes shorter by using the literal chars instead of \x.. escapes

slightly different method, same byte count

@ovs Thanks! Probably increases the bit count somewhat (not sure which is most important to the OP), so I'll keep my old answer too.

C# (Visual C# Interactive Compiler), 141 bytes
x=>{var k="@`rFTDVbpPBvdtfR@¬p?â>4¦é{zãq5§è";int l=256,b=17;for(;--l*x!=l;)x=2*x^x/128*285;return l%b>0?k[l%b]^k[b+l/b]^b:k[l/b]^188;}

Just a port of the example solution, ported to C#.
Try it online!

Rust, 170 163 bytes
|mut x|{let(k,mut l)=(b"QqcWEUGsaASguewCQ\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8",255);while l*x!=l{x=2*x^x/128*285;l-=1}(if l%17>0{l+=289;k[l%17]}else{173})^k[l/17]}

Try it online!
This is a port of my solution in C, with a slightly different string, that do not require to xor 17. I expect that most of the solutions based the string "@`rFTDVbpPBvdtfR@\xacp?\xe2>4\xa6\xe9{z\xe3q5\xa7\xe8" can be improved as well (just change the string, remove the xor 17, and xor 173 instead of 188).
I removed one of the lookups by conditionally adding 17*17 to l, as we (more or less) did in the ARM machine code solution.
Rust has type inference and closures, but its casts (even for booleans or between integers) are always explicit, mutability has to be marked, it does not have a ternary operator, integer operations, by default, panic on overflow, and mutating operations (l+=1) returns unit. I did not manage to obtain a shorter solution with iterators, as closures+mapping is still fairly verbose.
This seems to make Rust a pretty bad choice for golfing. Nevertheless, even in a language that stresses readability and safety over conciseness, we're far too short.
Update: used an anonymous function, from manatwork's suggestion.

Except when called recursively, anonymous functions/lambdas are acceptable, so you can move let p= to Header and not count it. Unsure about the ;, as for anonymous call is not needed: Try it online!.

05AB1E, 74 bytes
₄FÐ;sÉiƵf^])2k>17‰Dθ_i¦16š}<(Rć16α2в≠ƶ0Kì6ª•5›@¾ÂÌLìÁŒ©.ðǝš«YWǝŠ•ƵŠвs<è.«^

Port of @NickKennedy's first Jelly answer. I was working on a port of @jimmy23013's CJam answer directly, but I was already at 78 bytes and still had to fix a bug, so it would have been larger. This can definitely still be golfed quite a bit, though.
Try it online or verify all test cases.
Explanation:
₄F              # Loop 1000 times:
  Ð             #  Triplicate the current value
                #  (which is the implicit input in the first iteration)
   ;            #  Halve it
    s           #  Swap to take the integer again
     Éi         #  If it's odd:
       Ƶf^      #   Bitwise-XOR it with compressed integer 142
]               # Close the if-statement and loop
 )              # Wrap all values on the stack into a list
  2k            # Get the 0-based index of 2 (or -1 if not found)
    >           # Increase it by 1 to make it 1-based (or 0 if not found)
     17‰        # Take the divmod-17 of this
Dθ_i    }       # If the remainder of the divmod is 0:
    ¦16š        #  Replace the quotient with 16
         <      # Decrease both values by 1
          (     # And then negate it
R               # Reverse the pair
 ć              # Extract head; push head and remainder-list
  16α           # Get the absolute difference between the head and 16
     2в         # Convert it to binary (as digit-list)
       ≠        # Invert booleans (0 becomes 1; 1 becomes 0)
        ƶ       # Multiply all by their 1-based indices
         0K     # And remove all 0s
           ì    # And prepend this in front of the remainder-list
            6ª  # And also append a trailing 6
•5›@¾ÂÌLìÁŒ©.ðǝš«YWǝŠ•
                # Push compressed integer 29709448685778434533295690952203992295278432248
  ƵŠв           # Converted to base-239 as list:
                #  [19,48,36,38,18,238,87,24,138,206,92,197,196,86,25,139,129,93,128,207]
     s          # Swap to take the earlier created list again
      <         # Subtract each by 1 to make them 0-based
       è        # And index them into this list
.«^             # And finally reduce all values by bitwise XOR-ing them
                # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why Ƶf is 142; •5›@¾ÂÌLìÁŒ©.ðǝš«YWǝŠ• is 29709448685778434533295690952203992295278432248, ƵŠ is 239; and •5›@¾ÂÌLìÁŒ©.ðǝš«YWǝŠ•ƵŠв is [19,48,36,38,18,238,87,24,138,206,92,197,196,86,25,139,129,93,128,207].


text:
Shortest Gomoku (5 in a row) implementation
I suspect Gomoku may be one of the simplest games to implement in code. https://en.wikipedia.org/wiki/Gomoku The game is this: players BLACK and WHITE take turns putting down black and white stones. Black traditionally goes first. If, when a player puts down their stone, they now have 5 in a row of their color, they win. That's it.
A simple way to implement this is to just keep two lists of (x, y) integer coordinates, one for black stones and one for white stones. Players simply specify an integer x,y coordinate, any x,y coordinate at all! The game checks if there is already a stone there of either color, and if not x,y is added to the list, and then the game checks if that stone made them have 5 in a row now.
Notice I have said nothing about board size, or checking if a move is on the board or not. My thought is that specifying board size and determining what to do at edges actually complicates things more! Gomoku can be played on an infinite board, and the game still works actually!
Anyway, to be clear, I believe the specifications are, implement Gomoku on a board of size between or including 15x15 and infinity x infinity (I actually suspect inifinite may be simpler.) Let the user know who's turn it is to play, by alternately printing "b>","w>". If an invalid entry is made, such as playing where there already is a stone there, just keep asking the user who played the invalid move until they play a valid move. To keep things extra short, no need to print the board state, actually! But if on a user's turn, they have completed 5 in a row orthogonaly or diagonally, print, or throw an error, that can simply say "w" or "b", to say who won. Shortest code that does the specified, wins.
If you want to print the board state or make things look nicer or make an AI or whatever, no need to do that, but you can add with or separately to your submission if you feel like it.
I wrote a non-golfed but still shortish implementation in Python, with simple board printing and stuff before. Here it is: https://github.com/jeffkaufman/game-complexity/blob/master/gomoku.py
And here's my entire attempt at a golfed version with the basic IO and move checking, but without board printing. I am quite sure this is not optimal at all, I'm not often a golfer. All I mostly did was make variables one character / remove whitespace and stuff, you guys can *easily* do better, I know.
w,b=[],[]
def o((x,y),s,(v,u)):
 if (x,y) in s:return o((x+v,y+u),s,(v,u))
 if v:return x
 return y
d=((0,1),(1,0),(1,1),(-1,1))
def W(m,s):
 for (x,y) in d:
  if o(m,s,(x,y))-o(m,s,(-x,-y))>5:return 1
 return 0
def t(c,p):
 while 1:
  C=raw_input(c+'>')
  try:
   x,y=C.split()
   m=(int(x),int(y))
  except ValueError:continue
  if m in b+w:continue
  p.append(m)
  if W(m,p):raise Exception(c)
  break
while 1:t("b",b),t("w",w)

an example run from that, which throws a Python error saying who won, at the end:
b>0 0
w>-4 5
b>0 1
w>0 1
w>7 12
b>0 2
w>7 12
w>4 5
b>0 -1
w>4 4
b>0 3

Traceback (most recent call last):
  File "C:/Users/udqbp/OneDrive/Desktop/test.py", line 22, in <module>
    while 1:t("b",b),t("w",w)
  File "C:/Users/udqbp/OneDrive/Desktop/test.py", line 20, in t
    if W(m,p):raise Exception(c)
Exception: b

Welcome to PPCG. This is a good idea for a challenge, and you have included a winning criterion (code golf = shortest code) which is very important. But it needs to be tightened up to make it indisputable whether an answer is valid or not. For example does the board have to be 15x15, or infinite, or can we choose? Note that you can post draft challenges to our sandbox for feedback. https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?cb=1

i think i was trying to say it could be between between 15x15 and infinite, really either one is fine by me. i think infinite may actually be easier, but if you find 15 x 15 or some larger integer easier, that's cool by me actually. should i post in the sandbox?

Yes you did specify shortest code wins, that is good. 2. it would be clearer if you had a description of Gomoku as an introduction at the top, and specific challenge rules (such as between 15 x 15 and infinite, input/output spec etc.) in a separate, titled section near the bottom. 3. You don't need to speculate about which we might find easier to implement. It's clearer if you simply state the rules  and let answer posters decide what works best. 4. you don't have to post in the sandbox, I was just making you aware of it. Many people find it useful, as writing a good challenge is hard.

I'll not compete, but to make it clear : no 3 and 3 rule, or overline(6 in a row), right?

Suggested tag: interactive. (Although I think it would have been better to just take a list of valid moves as input and return 3 distinct values for black / white / no winner.)

How strict are the requirements re input/output during the game? Most code-golf questions here are flexible on details like that which aren’t critical to the main challenge. I’ve posted an answer where the player whose turn it is is indicated using 1 and -1. Is that permissible? I’ve used the same to indicate the winner. Also input validation (e.g. checking whether the coordinates are numbers and are within the board dimensions) is usually not required as part of the spec. Is that the case here?

Sorry, guys. I'll have to find some time to re-do this all. Asking if a list of valid moves wins or loses seems to easy actually, in that case, you just check if there's five in a row of either / both colors and you're done, so it's just a "check for five in a row" "problem." I do want to say that more than 5 in a row is still valid, because I want to make it a simple game to implement that's still a game so I'm paring down to the simplest rules. So 5 or more. continued...

...continued also, allowing print whatever you want to say who's turn it is as long as it's differentiated so that should be fine. I do want to check for a valid move, I think, or again it's just an "is there five in a row" problem. Jelly's answers are great by the way.

Jelly, 54 bytes
Ḋ,Z,ŒD$ŒrFs2ḢƇ<5Ȧ
0x⁹s⁴-;N1¦Ṅ©+Ɠœị®Ḋ¤$¿ṪṬṭ0x$Ʋ¹NƭƊƊ$Ç¿

Try it online!
A full program that reads input on stdin. For each loop through it prints the current player (1 or -1) and the 16x16 grid. Moves are input on stdin as a Python array (e.g. [3,2]) with or without the surrounding square brackets. The only validation done is to make sure that the relevant cell is empty. When there are 5 (or more) in a row, the program ends and prints out the winner and final grid.
If checking for a valid move can be omitted, 10 bytes can be saved:
Jelly, 44 bytes
Ḋ,Z,ŒD$ŒrFs2ḢƇ<5Ȧ
0x⁹s⁴-;N1¦Ṅ+ƓṪṬṭ0x$¹Nƭ¤ƲÇ¿

Try it online!
Conversely, if the w/b designation in the spec is strict, that costs 15 bytes:
Jelly, 69 bytes
ị“wb ”Ḣ
Ḋ,Z,ŒD$ŒrFs2ḢƇ<5Ȧ
0x⁹s⁴-;N1¦Ñ;”>ṄṛƲ©+Ɠœị®Ḋ¤$¿ṪṬṭ0x$Ʋ¹NƭƊƊ$Ç¿Ñ

Try it online!


text:
Insert commas into numbers
Write a program that reads a string, and inserts commas to divide large numbers in groups of 3. i.e. 10000 => 10,000. It should 'fix' incorrectly formatted numbers as described below.

It must work for all numbers on the same line
It should not modify numbers after a decimal point. i.e. 1234.5678 => 1,234.5678
Leading zeros should be removed (or inserted where appropriate):

00000 => 0
00001234 => 1,234
.1234 => 0.1234
00.1234 => 0.1234
1000.1234 => 1,000.1234

All non-digit characters should not be altered.
It should correct, incorrectly placed "," characters only when followed before or after a digit:

10,,00 => 1,000
00,000 => 0
a,2 => a2
2,a => 2a
,a2 => ,a2
0,a2 => 0a2
,,, => ,,,
,,,. => ,,,.
,,,1 => 1
,.,,1 => 0.1

Numbers that contain multiple "." should not be treated as a number, and therefore no comma separation should be used:

1..3 => 1..3
1234.5678.9012 => 1234.5678.9012
1234,,.5678abc.123 => 1,234.5678abc0.123
1234.,.5678abc.123 => 1234.,.5678abc0.123

Explanations to unusual cases:

,,,. => ,,,. (not a number, no special meanings to ",", ".")
,,,.0 => 0 (these characters are neighbouring a number and treated as such)
1,,, => 1
,,,1 => 1
,.,,1 => 0.1 (the "." indicates decimal number, remove incorrectly placed "," in number).
,.,,.1 => ,.,,.1 (not a number because multiple ".")
a,,,b1234 = > a,,,b1,234 (first few characters are not neighbouring a number and treated as text)

Example inputs:
10000
10,000
$1234.12
~$123456789.12345~
HELLO123456.99BYE
The_amount_€45678_is_$USD51805.84
5000000-1999999=3000001
!1234567.1234+1234567.1234=2469134.2468!
00000a00
0b0001234
.a.1234
00.1234
1000.1234
10,,00
00,000
a,2
2,a
,a2
0,a2
,,,
,,,.
,,,1
,.,,1
1..3
1234.5678.9012
1234,,.5678abc.123
1234.,.5678abc.123
,,,.
,,,.0
1,,,
,,,1
,.,,1
,.,,.1
a,,,b1234

Corresponding outputs:
10,000
10,000
$1,234.12
~$123,456,789.12345~
HELLO123,456.99BYE
The_amount_€45,678_is_$USD51,805.84
5,000,000-1,999,999=3,000,001
!1,234,567.1234+1,234,567.1234=2,469,134.2468!
0a0
0b1,234
.a0.1234
0.1234
1,000.1234
1,000
0
a2
2a
,a2
0a2
,,,
,,,.
1
0.1
1..3
1234.5678.9012
1,234.5678abc0.123
1234.,.5678abc0.123
,,,.
0
1
1
0.1
,.,,.1
a,,,b1,234

Code golf: shortest code wins.

What's the expected output for 00000? Or for 10,0001?

Another ambiguous case: 1234.9876.5678

I've VTCed as unclear until the test cases in the comments have been addressed. Please ping me once they have so I can retract my vote or cast my vote to reopen.

@Shaggy I have just edited the post with a lot more detailed information

Retina, 71 bytes
/[\d.,]+/_/\d/&/\..*\./^&(`,

^0+

^\B
0
'.&`\.?0+$

/^\d+/_r`\B...
,$&

Try it online! Link includes test cases. Explanation:
/[\d.,]+/_

Find all runs of digits, .s and ,s.
/\d/&

Ignore those with no digits.
/\..*\./^&

Ignore those with two .s.
(`

Process the rest of the script on each remaining match.
,

Delete all commas.
^0+

Delete all leading zeros.
^\B
0

Insert a leading zero if the number does not begin with a digit.
'.&`

If the number contains a ....
\.?0+$

... delete trailing zeros and any preceding ..
/^\d+/_

On the part of the number before the ....
r`\B...
,$&

Match groups of three starting from the end, but leave at least one digit at the beginning, and insert commas before each match.

0000 returne 0,000. 10,0000 returns 10,0,00.

I suggest deleting this and VTC as unclear.

@Neil, I have just edited the post with a lot more detailed information on various cases. Thanks for your answer so far.

@Brandon I don't think I can update my Retina 0.8.2 answer for the new requirements. Would you mind if I tried using Retina 1 instead?

@Neil any language is fine. Edit as much as possible or delete and start a new answer.


text:
Find 77 7-letter Magic Words
A magic word is a word whose Braille spelling contains precisely 26 dots (because the Morse code alphabet can be circularly encoded within). For example:
 ⠎ ⠝ ⠥ ⠛ ⠛ ⠇ ⠽ snuggly
 ⠏ ⠕ ⠇ ⠽ ⠛ ⠕ ⠝ polygon
 ⠝ ⠥ ⠛ ⠛ ⠑ ⠞ ⠽ nuggety
 ⠽ ⠕ ⠛ ⠓ ⠥ ⠗ ⠞ yoghurt

are all magic words.
Objective:
Craft a program to identify 77 such magic words and output the word along with its Braille spelling.

Does the word have to be a valid english dictionary word? If so, which dictionary do we use? Lastly, we can use any words that are seven letters and are magic, right?

@EmbodimentofIgnorance there’s nothing in the question that requires 7 letters is there?

@Nick Kennedy It's in the title.

@lirtosiast oops. Should really be in the spec too

If you took the requirement to write a program to do this, it would be a better fit on puzzling.SE. Either way I think we need to know which dictionary is applicable. The trouble is, once we know the dictionary, the output of the program will be fixed and we may as well use some kind of hard coding rather than solve using an algorithm. That may not be a huge issue though, as a naive hard coded program is probably not going to beat a more ingenious one.

The words must be valid however the pool from which they are found is not specified.

@BbJug Is the dictionary / pool allowed to be external to the byte count or not? Also if you don't specify the pool from which they are found then the number of words found depends on the external pool so it's not guaranteed to be exactly 77. What should happen if the program finds less/more? If you don't specify a dictionary you get arguments about what is a valid word. What about these for example?  WOWEEEE OOOOOOH HEHEHEH

should you choose to use a dictionary its size would not be included in the byte tally. how you end up with precisely 77 words is up to you 8). And a valid word is simply one that has a tangible definition and has seen plenty of unironic use

Would've been nice if the challenge was just to get magic words from an input list of strings... it's hard to define what constitutes "using a dictionary" and the bytecount stuff that you're mentioning.

Very valid point @ValueInk. In hindsight this is definitely the right approach for the most consistency.

Jelly, 77 74 bytes
×6‘ḃØ⁵ịØJ⁾“»jVŒu
“¢~ỌƈY⁴⁸ġƁUP©¥!ḃ^⁶ẹøD’ḃ61
ÑOị¢BSS×LƲ⁼182µ77#Ñ€Ożị¢+⁽$ṁƊ$Ọ

Try it online! (Times out)
Demo using 4 words and starting the search later in the dictionary
All 77 words produced if enough time allocated
A full program that generates 77 seven-letter words from Jelly’s dictionary that require exactly 26 dots in Braille. Now outputs a list of lists with the word in ASCII and then Braille.

heh, I didn't actually expect anyone to try this one out. Nicely done Nick.

I converted all your words into base 36 and subtracted each word from the previous one. The biggest difference was a 33 bit number (should be well within 32 bits in base 26.) So I think you have a little under 308 bytes of entropy here. So good use of the Jelly dictionary!

Honestly you should've kept the 77 byte answer (because then it matches the challenge specification of 77 words).

@LevelRiverSt thanks. Note I’ve also had to encode the translation from ASCII to Braille because the Unicode Braille codepoints are effectively a binary encoding rather than being I ASCII order


text:
ASCII Meme Arrow Generator
Specifications
Given a number n, output an ASCII "meme arrow" (greater-than symbol, >) of size n.
n will always be a positive integer, greater than 0.
Examples
n = 2
\
 \
 /
/

n = 5
\
 \
  \
   \
    \
    /
   /
  /
 /
/

Sample code
Here is a sample program, written in Crystal, that returns the correct results. Run it as ./arrow 10.
arrow.cr:
def f(i)
        i.times { |j|
                j.times { print ' ' }
                puts "\\"
        }
        i.times { |j|
                (i-j-1).times { print ' ' }
                puts '/'
        }
end

f(ARGV[0].to_i)

Rules

This is code-golf. The shortest answer wins. However, I will not select an answer, because the shortest answer may change over time.
Standard loopholes are not allowed.

Are you sure this is not a duplicate (that is, did you sandbox this)? I think this is likely to be, but it's slightly nearly impossible to search for.

@someone didn't think about the sandbox, but i did search around a bit and didn't find something similar. i should remember to do that next time

Can n be zero?

@xnor No. I'll add it to the specification.

I think it's pretty silly to call this common symbol a "meme arrow". They're obviously comedy chevrons.

@Christian They're actually amusing angles

@dkudriavtsev Officially, it's a playful pointer.

@ArtemisFowl I thought they were interesting increases

@dkudravtsev Not silly signage?

Is me
Challenge about meme arrows exists
Writes comment using meme arrows because it's ironic
No one reads comment
Frick

@lyxal thanks to your comment i know what this challenge is about lol

Ok to output with extra whitespace on each line that doesn't effect how the image looks?

Canvas, 2 bytes
＼═

Try it here!

Code itself is like smile actually.

C (gcc), 56 bytes
f(n,i){for(i=-n;n;printf("%*c\n",i?++i+n:n--,i?92:47));}

Try it online!
f(n,i){for(i=-n;i;printf("%*c\n",  ++i+n    ,  92   ));     //first print descending '\'s
       for(    ;n;printf("%*c\n",        n--,     47));}    // then print returning  '/'s

Python 2, 54 bytes
f=lambda n,p='':n*'?'and p+'\\\n'+f(n-1,p+' ')+p+'/\n'

Try it online!
Outputs with a trailing newline.

C# (Visual C# Interactive Compiler), 66 bytes
n=>new int[n*2].Select((a,b)=>"".PadLeft(b<n?b:n*2+~b)+"\\/"[b/n])

Saved a byte thanks to @someone.
Try it online!

n*2-b-1 -> n*2+~b

Perl 5 -p, 36 bytes
$\=($q=$"x$_)."\\
$\$q/
"while$_--}{

Try it online!

05AB1E, 6 bytes
'\3.Λ∊

Try it online!
Explanation
   .Λ    # draw
'\       # the string "\"
         # of length input
  3      # in the south-eastern direction
     ∊   # then vertically mirror it

Ruby, 111 99 77 73 68 64 57 56 bytes
-12 bytes thanks to Benjamin Urquhart, -43 thanks to manatwork and -2 bytes thanks to Value Ink.
->i{s=[];puts (0...i).map{|j|s=(p=' '*j)+?/,*s;p+?\\},s}

Try it online!
Explanation:
f=->i{                      # instead of a function, use a lambda
  s=[]                      # needs a helper variable *now*, for scope
  puts(                     # puts takes arbitrary num of args; \n after each
    (0...i).map{|j|         # not from 0 to i but from 0 to i-1 (*three* dots)
      s=(
        p=' '*j             # p will remain in scope inside of .map,
      )
      +?/                   # character literal instead of string
      ,*s                   # essentially appending to the array

      p+?\\                 # p is what's returned by .map, not s!

    },                      # up until here, 1st arg to display
    s                       # NOW, as the *2nd* arg, s is displayed
  )
}

Alternative (but longer) Solutions
A friend read this answer and then tried to come up with a couple more approaches. Putting them here, too, so that they're not lost to the vast interwebs.
inject and unshift, 72 bytes
->n{puts (0...n).inject([]){|s,i|i=' '*(n-1-i);s.unshift i+?\\;s<<i+?/}}

Try it online!
downto, inject and unshift, 80 bytes
->n{puts n.downto(1).map{|i|' '*(i-1)}.inject([]){|s,i|s<<i+?/;s.unshift i+?\\}}

Try it online!
intriguing, two non-nested loops, 127 bytes
->n{
r=->s,c{s[0..-(c+1)],s[-c..-1]=s[c..-1],s[0..c-1];s};
n.times{|i|puts r[' '*n+?\\,n-i]}
n.times{|i|puts r[' '*n+?/,i+1]}
}

Try it online!

Can't a lot of that whitespace be removed?

Yes, 12 bytes in total, thank you! This was the first time I submitted anything to a code golf game...

Then you may find interesting the Tips for golfing in Ruby, or even the Tips for golfing in .

You could replace the inner loops for padding with String#rjust (Try it online!).

Here I applied some of the tips from the above mentioned 2 collections to reduce it to 57 characters: Try it online!

I've worked my way forward to 64 bytes and feel like I (mostly) understand what you're doing in your 57 bytes version. What I don't get at all yet: why is ?something equivalent to 'something'? Also: is it generally considered not-cheating in Code Golf to outsource the f= as you've done in your TIO?

If your string interpolation is at the end of the string AND the variable is a string, you're better off going ..."+s than ...#{s}". Also, Ruby strings can go through multiple lines, so you can replace \n with a literal newline. Try it online! And yes, it isn't cheating to outsource the f= because ->{yourcode}[input] is also valid code, so technically assigning it to a variable is optional.

@manatwork already did the ..."+s and the literal newline things in the version linked to in his last comment. I'm holding back on them until I feel I also understand the ?\\ thing. Thank you for the comment on f=, @Value Ink!

@RainerVerteidiger, looking for this? “There is also a character literal notation to represent single character strings, which syntax is a question mark (?) followed by a single character or escape sequence that corresponds to a single codepoint in the script encoding” — Literals / Strings.

Aha! Yes, that's what I'd been looking for, thank you!

It's now fully down to the 57 bytes version originally by @manatwork, for which I totally don't deserve any credit. Thanks to all of you, this taught me an awful lot about the language I (have to) do my day-to-day chores in, and on top of it, was fun to do! :-D

Martin Ender's splat tip helped reduce it with 1 more character: ->i{s=[];puts (0...i).map{|j|s=(p=' '*j)+?/,*s;p+?\\},s} — Try it online!

Took me a while to understand that change, but finally added to the answer now. I like it much better than the previous one with a newline inside of it, as it's back to being a true one-liner.
Still nowhere close to beating-Haskell-territory, unfortunately :-P

PowerShell, 44 41 bytes
filter f{if($_){'\'
--$_|f|%{" $_"}
'/'}}

Try it online!

MarioLANG, 719 677 bytes
+
+
+
+
+
+         ((((+)+++++)))<
+>======================"
+)++++++)+++++++++++((-[!)
========================#=-
) ![-    <+;)+++)---)++++)<
)=#======"=================
) >)+)+((!
+ "======#
         <))))).(((((((<
 ========">============"
>)+)+((-[!+))        -[!((((((((.)).))))+(-[!)
"========#=============#====================#<
!)                                          <
#==========================================="
                  >(((((.)))>
                  "========<"========
 ![-)).))).(((((((![-    ))+![-((+)+)<((![<
 #================#=========#========"==#="===
 >                                   !  >-!
 "===================================#  "=#

Try it online!
This was harder than expected...

C64Mini/C64 BASIC (and other CBM BASIC variants), 52 tokenized BASIC bytes used
 0INPUTN:N=N-1:FORI=0TON:PRINTTAB(I)"\":NEXT:FORI=NTO0STEP-1:PRINTTAB(I)"/":NEXT

Here is the non-obfuscated version for exaplantion:
 0 INPUT N
 1 LET N=N-1
 2 FOR I=0 TO N
 3  PRINT TAB(I);"\"
 4 NEXT I
 5 FOR I=N TO 0 STEP -1
 6  PRINT TAB(I);"/"
 7 NEXT I

What ever number is entered into N in line zero is reduced by one as the TAB command is zero-indexed; The FOR/NEXT loops in lines two through to four and five through to seven then output the upper and lower part if the meme arrow respectively (represented by a shifted M and shifted N in graphics mode source)

Did you know that in Commodore Basic all keywords can be abbreviated? Here's a link: https://www.c64-wiki.com/wiki/BASIC_keyword_abbreviation
For example, for can be fO (f - shoft o), print is ?,  etc.

52 bytes is misleading in Code Golf, the binaries don't count, just the source code.
It shoulf be something ike this: 0inputn:n=n-1:fOi=0ton:?tA(i)"\":nE:fOi=0ton:?tA(i)"/":nE - it takes 57 bytes.

As discussed here -> https://codegolf.meta.stackexchange.com/questions/11553/how-should-the-length-of-a-commodore-64-basic-program-be-measured/11574#11574 I count the tokens used as this is more representative of how much of the memory is being used.

Oh, I didn't know this. Is there a decision about this? Even the answer has not been accepted there.

Well I state tokenized BASIC bytes (rather than number of PETSCII characters) as this is the most consistent way to count the memory used in Commodore BASIC. I have known about keyword abbreviations since I was 8 years old a long time ago.

Also if you enter a whole listing, however long, with abbreviations, when you list it you will see it non-abbreviated. You only need them to get >80 characters per line in C64 BASIC (or >160 in C128 BASIC)

My first computer was a C16, I did a lot of assembly on that, too, so no offence, I love Commodore. C16 had Basic 3,5, 80 chars per line, I also had a book with the ROM listings explained, so I exactly knew how the tokenization and listing worked,

Seeing the fact that the listing contains untokenized text, it makes sense that the "source code" should not be the abbreviated version. But I'm still in doubt whether the number of bytes should be the measure, because that is a compiled code (binaries) - using this principle, Java code should be golfed based on the compiled class size.
Anyways, this solution is good, upvoted, and I also made my contribution here with Rockstar language.

brainfuck, 125 bytes
++++++++++[->+>+++++++++>+++<<<]>>++>++>,[->[->+<<<.>>]<<<.<.>>>>>[-<+>]<+<]<<[--<<+>>]<<+>>>>>[-[-<+<.>>]<<<<<.>.>>>[->+<]>]

Try it online!
++++++++++[->+>+++++++++>+++<<<]>>++>++>    ; Initialize with " \"
,                                           ; Get input
[->                                         ; loop and decrement n
    [->+<<<.>>]                             ; output number of spaces, copy n
    <<<.                                    ; output \
    <.                                      ; output newline
    >>>>
    >[-<+>]<+                               ; copy copy of n back to original place
<]
<<[--<<+>>]<<+>>                            ; change "\" to "/"
>>>
[                                           ; second loop for bottom half
 -                                          ; decrement n
 [-<+<.>>]                                  ; output n spaces
 <<<<<.>.                                   ; output \ and newline
 >>>[->+<]>                                 ; copy n back
]

Charcoal, 5 bytes
↘Ｎ‖Ｍ↓

Try it online! Link is to verbose version of code. Explanation:
↘Ｎ

Input a number and print a diagonal line of \s of that length.
‖Ｍ↓

Reflect the line vertically.

T-SQL code, 80 bytes
DECLARE @ INT=3

,@z INT=0
x:PRINT
space(@-abs(@-@z-.5))+char(92-@z/@*45)SET
@z+=1IF @z<@*2GOTO x

Try it online
T-SQL query, 96 bytes
In order to make this work online i had to make some minor alterations.
Spaces in the beginning of a row doesn't display in the online snippet. So I am using ascii 160 instead. When running in management studio, it is possible to change the settings to show result as text, which would result in the correct spaces in this posted script.
DECLARE @ INT=3
SELECT space(@-abs(@-number-.5))+char(92-number/@*45)FROM
spt_values WHERE number<@*2and'p'=type

Try it online

MAWP, 69 bytes
%@!0//[!1A]%[1A[1A84W;]%99W25WM1M;25W;]%[!1A]~[1A[1A84W;]%67W5M;25W;]

I am not going to golf this further bcause funny number. Sorry, guys.
Try it!

+1 for 69!! (15chrs)

APL(NARS), 40 chars, 80 bytes
{f←{⍺,⍨⍵⍴' '}⋄⊃('\'f¨k),('/'f¨⌽k←¯1+⍳⍵)}

test:
  h←{f←{⍺,⍨⍵⍴' '}⋄⊃('\'f¨k),('/'f¨⌽k←¯1+⍳⍵)}
  h 2
\
 \
 /
/
  h 5
\
 \
  \
   \
    \
    /
   /
  /
 /
/

TypeScript's type system, 87 bytes
//@ts-nocheck
type F<N,S="">=N extends[{},...infer N]?`
${S}\\${F<N,`${S} `>}
${S}/`:""

Try it at the TypeScript playground
Takes input as a unary number represented by a tuple type N. If I instead took the unary number as a string type of spaces, this becomes 71 bytes:
type F<S,O=''>=S extends` ${infer S}`?F<S,`${S}\\
${O&string}${S}/
`>:O

Try it at the TS playground
I like the shorter version better because it's tail-recursive and just overall really elegant, but I think the I/O format is a little cheaty.

Vyxal, 8 bytes
ɾ\\↳↲øṀ§

Try it Online!
   ↳     # Right-pad
 \\      # \
ɾ        # To length each of range(1, n+1)
    ↲    # Left-pad each to length n
     øṀ  # Mirror, flipping slashes
       § # Vertical join, transposing and joining by newlines

Pyth, 19 bytes
VQ+*dN\\)V_Q+*dhN\/

Try it online!
TIL multiplying a string by a negative value multiplies it by its absolute value.

C (gcc), 67 65 bytes
-2 bytes thanks to ceilingcat
f(n,i){for(i=~n;i++<n;)i&&printf("%*c\n",n-abs(i)+1,"/\\"[i<0]);}

Try it online!

Retina 0.8.2, 32 bytes
.+
$* ¶$&$*
\G.
¶$`\
r`.\G
$'/¶

Try it online! Explanation:
.+
$* ¶$&$*

Generate two lines of n spaces.
\G.
¶$`\

Turn the top line into a \ diagonal.
r`.\G
$'/¶

Turn the bottom line into a / diagonal.

Haskell, 52 49 bytes
-3 bytes thanks to Sriotchilism O'Zaic.
unlines.g
g 0=[]
g n="\\":map(' ':)(g$n-1)++["/"]

Try it online!

You can save a byte with g$n-1 instead of g(n-1).  You also don't need to count the f= since f never gets referenced.

Python 2, 85 84 81 80 75 bytes
def a(n):l="for i in range(n):print' '*";exec l+"i+'\\\\'\n"+l+"(n+~i)+'/'"

Try it online!

-1 with r-strings: def a(n):l="for i in range(n):print' '*";exec l+r"i+'\\'\n"+l+"(n+~i)+'/'"

@Makonede Leads to a SyntaxError unfortunately :(

Ah, maybe r-strings weren't a thing in Python 2. Oh well.

They were, but the \n can't be in a raw string even in Python 3.

PowerShell, 50 bytes
param($n)0..--$n|%{' '*$_+'\'}
$n..0|%{' '*$_+'/'}

Try it online!
Will look into making it so it only goes through the range once. Not bad for the no brain method though.

Twig, 115 bytes
Builds the string backwards, "returning" it in the end.
Uses a macro to generate all the results.
{%macro a(N,s="")%}{%for i in N..1%}{%set s=('%'~i~'s
'~s~'%'~i~'s
')|format('\\','/')%}{%endfor%}{{s}}{%endmacro%}

This macro has to be in a file, and imported like this:
{% import 'macro.twig' as a %}

{{ a.a(<value>) }}

You can try it on https://twigfiddle.com/5hzlpz (click on "Show raw result").

MATL, 14 13 12 bytes
Xy92*t45-Pvc

1 Byte saved thanks to @LuisMendo
Explanation
        % Implicitly grab the input as an integer
Xy      % Create an identity matrix this size
92*     % Multiply by 92 (ASCII for '\')
t       % Duplicate the matrix
45-     % Subtract 45 from every element yielding 47 (ASCII for '/') on the diagonal
        % and -45 everywhere else
P       % Vertically flip this matrix
v       % Vertically concatenate the two matrices
c       % Convert to characters (negative numbers are replaced with a space)
        % Implicitly display the result

Try it out at MATL Online

Python 3, 90 83 bytes
lambda n:'\n'.join([' '*i+'\\'for i in range(n)]+[' '*(n+~i)+'/'for i in range(n)])

Try it online!
-7 bytes thanks to @squid

83 bytes, but I feel like it can still go down

I wish this was possible.

Soon...

Oh yeah I forgot about that. Maybe you should submit it!

Rockstar, 133 bytes
Try it online here!
F takes N,S
If N is 0
Give back N

Say S+"\"
Let T be S+" "
Let M be N-1
F taking M,T
Say S+"/"

Listen to X
F taking X,""

Since Rockstar is not famous for string operations, it takes relatively lots of code to do it (recursively was even longer).
The size of the arrow is taken as input.

\/\/>, 74 bytes
jp100o
-84*}!o:?!x1
@+:q:p=?x:o~$:0(pa"\/"q?$~}}:
x2-:p$1-y$:0(?
.{suh?!;2

Explanation: (lines rotated based on start point)
jp100o                        //setup
:?!x1-84*}!                   //add leading spaces, loop and decrement until 0
~$:0(pa"\/"q?$~}}:@+:q:p=?x:o //add correct slash, go back to loop or switch sides
$:0(?x2-:p$1-y                //flip direction state or continue to print
{suh?!;2.                     //remove extra data and print stack

\/\/> (pronounced wɜrm) Thanks, I hate it. (jk, I'm looking forward to giving it a try)

@JoKing hahaha, gotta wear my inspiration on my sleeve. (thanks!)

PHP, 79 63 61 bytes
function f($x,$s=''){if($x)echo"$s\\
",f($x-1,"$s "),"$s/
";}

Try it online!
Recursive in PHP.
-12 bytes by @manatwork

Better count down. Try it online!.

@manatwork very very nice!

Python 3, 55 bytes
f=lambda n,i="":n and i+"\\\n"+f(n-1,i+" ")+i+"/\n"or""

Try it online!

54 bytes.

Erlang (escript), 69 bytes
Port of xnor's Python answer.
r(0,_)->"";r(I,X)->X++"\\\n"++r(I-1,X++" ")++X++"/\n".
r(I)->r(I,"").

Try it online!

Python 3, 91 86 bytes
n=range(int(input()))
for i in n:print(' '*i+'\\')
for i in n:print(' '*(n[-1]-i)+'/')

Try it online!
Edit 1: saved 5 bytes by making n a range instead of integer

You can golf this a bit if you port this to Python 2 :) And there are definitely more optimizations you can make!

@RGS, Thanks! Don't really want to switch to python 2, but here is your port in 77 bytes Try it online!

80 bytes

Or even 73 bytes using exec

71 even if trailing spaces after \ are acceptable...

Vyxal j, 95 bitsv2, 11.875 bytes
ƛI\\JøṀ;½fyRṘJ

Try it Online!
Bitstring:
00001000000011101111110001100110011110111010010010110001001000111000011010000100001110000011111

Beats all non-canvas users

Well it’s 14 SBCS which loses to MATL, and I can’t tell if the 10-byte Stax is using a canvas

stax has byte packing

So? That's not so different from vyncode

YASEPL, 58 bytes
=i=a'(`1=b;space,i~>"\"!+}7,a`2!-=b;space,i~>divide!}7,0,2

and just for fun...
ibe, 118 bytes
adadadadadadaddsRafWmreafYmpeafUmtiakqskTagTmwakwafTmwslWssTmQmwaaYafQmwssQmRmqakeskTakrafTmwslWssTmQmraaUagQmwsaQmqme

(this is an esolang i made a while ago that i dont plan on releasing)

Java 8, 80 bytes
n->{for(int i=0;i<2*n;)System.out.printf("%"+(i++<n?i:n-~n-i)+"c\n",i>n?47:92);}

Try it online.
Explanation:
n->{                    // Method with integer parameter and no return-type
  for(int i=0;i<2*n;)   //  Loop `i` in the range [0, 2 * input `n`):
    System.out.printf(  //   Print with format:
      "%"+(i++<n?       //    If `i` is smaller than input `n`:
                        //    (and increase `i` by 1 right after this check with `i++`)
            i           //     Use `i` leading spaces
           :            //    Else:
            n-~n-i)     //     Use `2 * n - i + 1` leading spaces
      +"c\n",i>n?       //    If `i` is larger than input `n`:
              47        //     Append a trailing '/' and newline
             :          //    Else:
              92);}     //     Append a trailing '\' and newline

Japt -R, 15 bytes
"\\/"¬c@õ!ùX zY

Try it
õ!ù'\ cUÆ'/ ùU´

Try it

Pyth, 23 bytes
V2VQ
+*?N--QH1H\ ?N\/\\

Try it online!
Note that the program must not have a terminating newline! If saving it on linux, you can remove the last byte in a file using head -c -1 <file>.
I think this is the first time I have used for loops in pyth? Anyways, this is a rather direct port of the example source code in the question (though the 2 loops are combined, and the innermost loop is converted into string multiplication, and the remaining 2 prints are joined into one).

 Batch File, 117 + 9 bytes
Executed using cmd/v/q/c.
for /l %%i in (1,1,%1)do (for /l %%j in (2,1,%%i)do set %%i= !%%i!)&echo !%%i!\
for /l %%i in (%1,-1,1)do echo !%%i!/

Pyth, 18 bytes
js.e+R?k\/\\b_B*L;

Try it online!

Python 2, 63 bytes
f=lambda n,s='':n and f(n-1,~-n*' '+'\\\n'+s+~-n*' '+'/\n')or s

Try it online!

Stax, 10 bytes
Ç₧¥╗M'gQ9⌂

Run and debug it

JavaScript (Node.js), 42 bytes (If trailing new line is allowed)
n=>(F=s=>n--?s+`\\
`+F(s+" ")+s+`/
`:"")``

Try it online!
JavaScript (Node.js), 48 46 bytes
n=>(F=s=>s+`\\
${--n?F(s+" ")+`
`:""}${s}/`)``

Try it online!

SimpleTemplate, 100 bytes
This was quite a fun challenge, but some bugs in the language made it hard to optimize.
{@set_ argv.0}{@while_}{@callstr_repeat intoS" ",_}{@setO S,"\\\n",O,S,"/\n"}{@incby-1_}{@/}{@echoO}

Basically, cycles throught the values backwards, working the string from the middle out.

How the answer should be
Due to the bugs, the code wasn't being interpreted properly.
This is how the code would be, if the compiler didn't had any bug (86 bytes):
{@forfrom argv.0to0step-1}{@callrepeat intoS" ",_}{@setO S,"\\
",O,S,"/
"}{@/}{@echoO}

Oh, well, at least the solution works :x

Swift 5/Xcode 10.2.1, 91 bytes
(0..<n*2).map{String(repeating:" ",count:$0<n ?$0:n*2-$0-1)+($0<n ?"\\":"/")+"\n"}.joined()

Try it online!

Python 3.8 (pre-release), 80 bytes
lambda n:'\n'.join([' '*i+'\\'for i in(r:=range(n))]+[' '*(n+~i)+'/'for i in r])

Try it online!
Same approach as the one I suggested to @Artemis Fowl, but takes advantage of the walrus operator.

Pepe, 91 bytes
rErEeEeEEEeeREeEREErereeereeERrEeeEeeeeeRrEeeeReereRerEEEererEeeEeEEEErEEEEREErereeereeERee

Try it online!

Perl 5, 59 bytes
$_--;say$"x$_."\\"for(0..$_);say$"x$_."/"for(reverse 0..$_)

Example execution:
perl -nE '$_--;say$"x$_."\\"for(0..$_);say$"x$_."/"for(reverse 0..$_)'

Waits for an integer to be provided on STDIN when executed. Once provided, it will display the arrow.

Rockstar, 85 bytes
listen to N
X's0
while N-X
say " "*X+"\"
let X be+1

while X
let X be-1
say " "*X+"/"

Try it here (Code will need to be pasted in)

Husk, 23 bytes
+mo`:'\R' ŀ¹mo`:'/R' ↔ŀ

Try it online!
There is probably a way to halve the size of this program.

Forth (gforth), 72 bytes
: f dup 0 ?do i spaces 92 emit cr loop 1- for i spaces 47 emit cr next ;

Try it online!
there's probably a better way to do this.

Zsh, 46 bytes
/ \\()for a;<<<${(l:a:)0};\\ {1..$1};/ {$1..1}

Try it online!
It really ought to be possible to get shorter than this...

J, 19 bytes
' \/'{~(,2*|.)@=@i.

Try it online!

JavaScript (Node.js), 59 bytes
n=>eval("for(o='';s=''.padEnd(n--);)o=s+`\\\\\n${o+s}/\n`")

Attempt This Online!
I had a different idea, it didn't turn out as golfy as the obvious method but I still felt like posting it.
The program constructs the string with a for loop, counting down from n, and continuously sets a string o to: n spaces, backtick, newline, o, n spaces, forward slash, newline.

Go, 133 bytes
import."strings"
func f(n int)(o string){for i:=0;i<n;i++{o+=Repeat(` `,i)+"\\\n"}
for i:=n;i>0;i--{o+=Repeat(` `,i-1)+"/\n"}
return}

Attempt This Online!
Go 1.22+, 131 bytes
import."strings"
func f(n int)(o string){for i:=range n{o+=Repeat(` `,i)+"\\\n"}
for i:=range n{o+=Repeat(` `,n-i-1)+"/\n"}
return}

You cannot Attempt This Online!
Run it on the Go Playground!

Perl 5 + -p, 20 bytes
Uses non-printable characters (backspace 0x08 and form feed 0x0c) to position the characters in the terminal.
$_='\.'x$_."./.."x$_
Try it online!
Explanation
Stores in $_ a repetition of the literal string \<FF> $_ (implicit input) times, concatenated with <BS>/<FF><BS> repeated $_ times.
$_ is then output implicitly by -p.


text:
Make Gimbap cutter
Gimbap(김밥) is Korean food, somewhat looks like sushi roll.
Here is Korean emoticon represent Gimbap : @))))))))))
Your quest is make ASCII Gimbap cutter.
Rule
Input is string made with only @ and ).
Output cuts every valid Gimbap with ), and then add   @ between them. So for example @)) to @) @).
Valid Gimbap starts with @ and followed by any amount of ).
If there is no valid Gimbap, output is blank.
Input and output
Input | Output
@))))) | @) @) @) @) @)
@))))))) | @) @) @) @) @) @) @)
@))@))) | @) @) @) @) @)
@) | @)
)) |
@ |
@@)@@@))) | @) @) @) @)
@)@)@)) | @) @) @) @)
@@@)) | @) @)
))@) | @)

Winning condition
This is code-golf, so shortest code wins.
from sandbox

Is the rule equivalent to "output one copy of @)  for every ) in the input not counting those before any @? May our output include a trailing space, like "@) @)  "?

It is. And output can include a trailing space.

Do we have to output a space delimited string or can we output an array of slices? Also, are we limited to those 2 characters or can we use any 2 characters of our choosing?

My first time trying to read the title, "Gimp-bat clutter? What?"

Haskell, 32 bytes
f(')':s)=f s
f s=do ')'<-s;"@) "

Try it online!
Recursion beats using span for removing the initial ('s.
Haskell, 33 bytes
f s=do ')'<-snd$span(<'@')s;"@) "

Try it online!

JavaScript, 42 41 bytes
s=>s.split(/(?<=@.*)\)/).fill``.join`@) `

Try It Online!

Canvas, 10 9 bytes
@ｓｊ∑Ｌ@) ×

Try it here!

C (gcc), 53 bytes
i;f(char*_){for(i=1;*_;!i&*_++&&printf("@) "))i&=*_;}

Try it online!
i;f(char*_){for(    *_;                      )      }   //loop over the string:
                i=1;   !i&                    i&=*_;    //skip leading `)`s
                       !i&*_++&&printf("@) ")           //and print "@) "for each `)` thereafter

JavaScript (Node.js), 48 47 bytes
x=>"@) ".repeat(x.split(/(?<=@.*)\)/).length-1)

Try it online!
JavaScript (Node.js), 53 49 bytes
x=>[...x].map(y=>y<"0"?m+=s&&"@) ":s=1,s=m="")&&m

Try it online!
JavaScript (Node.js), 60 bytes
x=>x.replace(/(@?)(\)*)/g,(_,a,b)=>a&&b.replace(/./g,"@) "))

Try it online!

Retina 0.8.2, 14 bytes
^\)+|@

\)
@)

Try it online! Link includes test cases. Explanation:
^\)+|@

Delete leading )s and all @s.
\)
@)

Replace all )s with @)s. (Note: trailing space.)

Python 2, 39 bytes
lambda s:'@) '*s.lstrip(')').count(')')

Try it online!

Jelly, 8 bytes
ṣṀḊẎ”@pK

Try it online!
-1 thanks to Jonathan Allan.

brainfuck, 49 bytes
,[[-<+>>++++<]>[[-]<<<[[.>]<---------.[-]]>[-]],]

Try it online!

Perl 5 -p, 26 bytes
$_=s/^.*?@//&&'@) 'x y/)//

Try it online!

24 bytes

05AB1E, 12 bytes
')Û'@KS'@ìðý

Try it online!
Explanation
')Û            # trim leading ")"
   '@K         # remove all "@"
      S        # split to list of characters
       '@ì     # prepend "@" to each
          ðý   # join on spaces

Batch, 58 bytes
@set s=%1@
@set s=%s:*@=(%
@set s=%s:@=%
@echo%s:)=@) %

Takes input as a command-line parameter. Explanation:
@set s=%1@

Suffix an @ in case the input doesn't contain any.
@set s=%s:*@=(%

Delete up to the first @, replacing it with a ( to ensure that the string is not empty (because %:% doesn't work on empty strings). The ( also makes the echo work if the rest of the string is empty.
@set s=%s:@=%

Delete any remaining @s.
@echo%s:)=@) %

Expand any remaining )s.

Japt v2.0a0 -S, 15 bytes
r/^\)+|@/ ¬mi'@

Try it
r/^\)+|@/ ¬mi'@     :Implicit input of string
r                   :Remove
 /^\)+|@/           :  "@"s and leading ")"s
          ¬         :Split
           m        :Map
            i'@     :  Prepend "@"
                    :Implicit output, joined with spaces

Alternative
e/^\)/ è\) Æ"@)

Try it
e/^\)/ è\) Æ"@)     :Implicit input of string
e                   :Recursively remove
 /^\)/              :  Leading ")"
       è\)          :Count remaining ")"s
           Æ        :Map the range [0,Count)
            "@)     :  Literal string
                    :Implicit output, joined with spaces

05AB1E (legacy), 10 bytes
Z¡¦JS'@ìðý

Try it online!
This bug forces me to use the legacy version. This is the code for the current version of 05AB1E (11 bytes):
'@¡¦JS'@ìðý

Try it online!
Port of my Jelly answer.

Ruby -p, 28 bytes
$_= ~/@/&&'@) '*$'.count(?))

Try it online!
Explanation
                                # -p gets a line of STDIN
$_=                             # Set output to
    ~/@/                        # Find first '@' in input
                                # nil (falsey) if not found
        &&                      # If found, set output to
          '@) '                 # Sliced gimbap
               *                # Repeat
                $'              # In the string after the first '@',
                  .count(?))    # ... count the number of ')'
                                # -p outputs the contents of $_
                                # nil outputs as a blank string

Java 10, 49 bytes
s->s.replaceAll("^\\)+|@+","").replace(")","@) ")

Try it online.

Wolfram Language (Mathematica), 91 90 85 71 70 59 57 bytes
StringReplace@{(StartOfString~~")"..)|"@"->"",")"->"@) "}

Try it online!

sed, 30 bytes
s/)\?@\()\?\)/\1/g; s/)/@) /gp

Try it online!

Welcome to PPCG. Unfortunately, your code can't handle leading )s and multiple @ properly. And, how about using Try it online?

As you can see in 5th or last example, leading )s have to be ignored.

@LegenDUST, you are right! it was not that easy. I guess the working version is much uglier

28 chars: s/^)*//;s/[^)]//g;s/./@) /gp

Pyth, 20 bytes
*?}\@z/>zxz\@\)0"@)

Try it online! Note that there is a trailing space at the end of the program. This one is (or rather, started out as) a rather direct translation of the Python 2 answer (though the lstrip part was surprisingly difficult).
Explanation:
*            # repeat string
  ?          # repeat count: ternary
    }\@z     # condition: check whether input contains @
    /        # if condition is true: count occurrences of one string in another
      >      # array slice: all elements of array (or string) from a specific index and upwards
        z    # the thing to slice (input)
        xz\@ # the index first occurrence of \@ in z
      \)     # string to count occurrences of (\x is shorthand for "x")
    0        # value when ternary condition is false
  "@) "      # the string to be repeated (automatically terminated by end-of-line)

Japt v2.0a0 -P, 15 bytes
f/@\)+/ ËÅç"@)

Saved 2 bytes thanks to @Shaggy.
Try it

15 bytes

@Shaggy Thanks, I haven't golfed in Japt recently

Jelly, 12 bytes
œl”)ḟ”@⁾@ jⱮ

Try it online!

Perl 6, 34 bytes
{~map {'@)'xx.chars-1},m:g/\@\)+/}

Try it online!

krrp, 63 bytes
^":\L,^*':?#?E'E!-@1#!r'?=#!f'$64.-?*L$64.L$41.L$32.-@0#!r'.0".

Try it online!

Explanation
^":                   ~ take the string as a parameter named `"`
 \L                   ~ import the list module
 ,^*':                ~ apply a binary function
  ?#?E'               ~  if the string is empty,
   E                  ~   return the empty string; else
   !-@1#!r'           ~   define `-` as the cut Gimbap
   ?=#!f'$64.         ~    if an at sign is seen,
    -                 ~    return the cut Gimbap; else
    ?*                ~    if an at sign has been seen,
     L$64.L$41.L$32.- ~     return a Gimbap piece together
                      ~     with freshly cut Gimbap; else
     @0#!r'           ~     proceed to cut
 .0".                 ~ to zero and the above taken string

Try it online!

PowerShell, 42 bytes
''+($args|sls '(?<=@.*)\)'-a|% m*|%{'@)'})

Try it online!
Unrolled:
$arrayOfCuttedGimbaps = $args|select-string '(?<=@.*)\)' -AllMatches|% Matches|%{'@)'}
''+($arrayOfCuttedGimbaps)    # toString and output