text:
Is this a winning *Frustration* configuration?
Frustration is a solitaire card game which is played by calling out the sequence:
“Ace”, “Two”, “Three”, ... , "Nine", "Ten", “Jack”, “Queen”, “King”, “Ace”, “Two”, etc.
With each call, you simultaneously flip over a card from a shuffled deck of 52 cards. You win the game if you get through the entire deck without ever calling out the rank of the card being flipped over.
Challenge
Given a string or list of characters representing an ordered deck of cards, return "Truthy" if the deck is a winning Frustration configuration, and return "Falsy" otherwise
Input
Input will be a single string (or a list of characters, or a list of codepoints) consisting solely of the following 13 characters (you may choose to take the letters as uppercase or lowercase):
A 2 3 4 5 6 7 8 9 T J Q K

Each character will be repeated 4 times in the input. An example of a valid input is:
A23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQK

You may assume that the input is always valid (ie. it will contain exactly 52 characters and the 13 characters mentioned above will be repeated exactly 4 times each)
Output
Output one of two distinct "Truthy" and "Falsy" values. The values you choose must be consistent (ie. different "Truthy" inputs must produce the same "Truthy" output and different "Falsy" inputs must produce the same "Falsy" output)
Examples
The input KA23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQ would be a winning Frustration configuration (hence a "Truthy" input) because none of the cards in the sequence match the name called out when flipping that card over.
The input 2K3A456789TJQKA23456789TJQKA23456789TJQKA23456789TJQ would not be a winning Frustration configuration (hence a "Falsy" input) because the 3rd card flipped over matches the name called out when flipping it (3).
Test Cases (one per line)
Truthy
KA23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQ
2A2A2AKQKQK3Q456789345678934567893456789A2JJJJTQKTTT
KQJT98675432AKQJT98675432AKQJT98675432AKQJT98675432A
55667987TAQK8TAQK8TAQK8TAQK325476979965432JJJJ234234
JAK3TTJAK3TT33KAA2456789456789456789222456789JJQQQKQ

Falsy
A23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQK
2A2A2AKQKQKQ3456789345678934567893456789A2JJJJTQKTTT
KQJT98765432AKQJT98765432AKQJT98765432AKQJT98765432A
8TAQK8TAQK8TAQK8TAQK234567999765432JJJJ2342345566797
JAK3TTJAK3TT33KAA2456789456789456789222456789JJQQQQK

Scoring
This is code-golf. Shortest answer in bytes wins

@KevinCruijssen Yes, that's fine

Python 2, 45 42 bytes
-5 bytes thanks to @ovs
lambda s:all(map(cmp,s,'A23456789TJQK'*4))

Try it online!

Can you use all instead of 0not in ?

Thanks for the tip! I've never thought of using all for integers.

Perl 5 -p, 29 bytes
$_^="A23456789TJQK"x4;$_=/\0/

Try it online!
Perl allows XOR on strings, how awesome is that?!

-p means that the language is perl 5 -p. The add bytes to your score is an old rule that has been superseded.

thanks for that, for anyone else wanting a reference to the rule, i found it here: https://codegolf.meta.stackexchange.com/questions/14337/command-line-flags-on-front-ends

Jelly, 14 bytes
QṢ“ṡ=2E’œ?ṁn⁸Ạ

A monadic Link accepting a list of characters which yields 0 or 1.
Try it online!
How?
QṢ“ṡ=2E’œ?ṁn⁸Ạ - Link: list of characters, D
Q              - de-duplicate D
 Ṣ             - sort
  “ṡ=2E’       - base 250 integer = 3,832,012,820
        œ?     - nth permutation
          ṁ    - mould like (D)
           n   - not equal? (vectorises):
            ⁸  -   chain's left argument, D
             Ạ - all?

Does nth permutation require sorting?

We need to sort before applying it as the right argument defines the 1st permutation. "Permutation at index x of the items in y (where y defines the sort order of those items)."

Bash + Core utilities, 48 bytes
egrep "`echo \([^A ][^{{2..9},T,J,Q,K} ]\){4}`"

Try the test cases online!
Input is on stdin.
Output is the exit code: 0 for truthy, 1 for falsy.

Retina 0.8.2, 57 bytes
([^A][^2][^3][^4][^5][^6][^7][^8][^9][^T][^J][^Q][^K]){4}

Try it online! Link includes test cases. Explanation: Simply matches a string of 52 bytes that doesn't match the specified character at each given position.

Haskell, 37 bytes
and.zipWith(/=)(cycle"A23456789TJQK")

Try it online!

05AB1E, 19 bytes
-2 bytes thanks to EdgyNerd,
-1 byte thanks to Grimmy.
'A8L>"TJQK"JJ4×ø€Ëà

Try it online!

And I've asked OP if lowercase input is allowed, in which case 'A8L>"TJQK"JJ could be 8L>J.•§®т•«Á (if not, an additional u is required and it's the same byte-count for this first part). Also @petStorm, you might want to mention you inverted the truthy/falsey in your output..

OP confirmed that taking the input as lowercase is allowed, so here is 17: 8L>J.•§®т•«ÁÞø€Ëà (still outputs 0 for truthy; 1 for falsey).

Wolfram Language (Mathematica), 58 bytes
Inner[Equal,#,Characters[#<>#<>#<>#&@"A23456789TJQK"],Or]&

Try it online! Pure function. Takes a list of characters as input and returns True or False as output. Note that this function checks for losing configurations (since Equal and Or are shorter than Unequal and And), so False is the truthy value and True is the falsy value.

JavaScript (ES6), 48 bytes
With the input being a string:
t=>![...t].some((v,i)=>"A23456789TJQK"[i%13]==v)
With the input as an array of char it's down to 43 bytes:
t=>!t.some((v,i)=>"A23456789TJQK"[i%13]==v)

var f=
t=>![...t].some((v,i)=>"A23456789TJQK"[i%13]==v);

[
"KA23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQ",
"2A2A2AKQKQK3Q456789345678934567893456789A2JJJJTQKTTT",
"KQJT98675432AKQJT98675432AKQJT98675432AKQJT98675432A",
"55667987TAQK8TAQK8TAQK8TAQK325476979965432JJJJ234234",
"JAK3TTJAK3TT33KAA2456789456789456789222456789JJQQQKQ"
].map(v=>console.log(v,f(v)));

[
"A23456789TJQKA23456789TJQKA23456789TJQKA23456789TJQK",
"2A2A2AKQKQKQ3456789345678934567893456789A2JJJJTQKTTT",
"KQJT98765432AKQJT98765432AKQJT98765432AKQJT98765432A",
"8TAQK8TAQK8TAQK8TAQK234567999765432JJJJ2342345566797",
"JAK3TTJAK3TT33KAA2456789456789456789222456789JJQQQQK"
].map(v=>console.log(v,f(v)));

Java (JDK), 63 bytes
s->s.matches("A23456789TJQK".repeat(4).replaceAll(".","[^$0]"))

Try it online!

APL (Dyalog Unicode), 44 bytesSBCS
{A T J Q K←10+¯9 0 1 2 3⋄~∨/(13|⍳52)=13|⍎¨⍵}

Try it online!

Charcoal, 19 bytes
⬤θ¬⁼ι§⁺⪫…²χωTJQKA⊖κ

Try it online! Link is to verbose version of code. Outputs a Charcoal boolean; - for truthy, nothing for falsy. Explanation:
 θ                  Input string
⬤                   All characters satisfy
    ι               Current character
  ¬⁼                Not equal to
        …²χ         Digits from 2 to 9
       ⪫   ω        Joined together
      ⁺     TJQKA   Suffixed with picture cards
     §              Indexed by
                 ⊖κ Current index incremented

Perl 5, 36 bytes
sub f{('A23456789TJQK'x4^pop)!~/\0/}

Try it online!
'A23456789TJQK' x 4 results in the 52 byte string of A23456789TJQK repeated four times.
This string is bitwise XOR-ed (operator ^) by the equal length input string from pop.
Any equal byte (char) at the same positions in the two strings results in a null-byte from xor.
And !~ (not regex-match) returns true if no null-byte \0 exists. Otherwise false.

C (gcc), 64 bytes
i;f(char*s){for(i=0;i<52&&s[i]-"A23456789TJQK"[i++%13];);i-=52;}

Outputs zero for truthy and non-zero for falsy.
Try it online!

-4 bytes by looping backwards with *s++

J, 26 bytes
1 e.(52$'A23456789TJQK')&=

Try it online!
0 is truthy, 1 is falsy.
Straightforward as possible, posted mostly as a straw man because I thought it was interesting that there didn't seem to be a trick to compress 'A23456789TJQK' that was shorter than the literal.

K (oK), 24 bytes
~|/(52#"A23456789TJQK")=

Try it online!

(52#"A23456789TJQK") build the frustration sequence
(...)= compare it to the input
~|/ do none (i.e. not any) match?

Pyth, 24 20 bytes
!sqV*X1"ATJQK"jkr2T4

Try it online!

X1"ATJQK"jkr2T Construct the string "A23456789TJQK". Inserting the range 2-9 at position 1 of "ATJQK" is one byte shorter than using the full string literal
* ... 4 Duplicate that string 4 times
V Vectorize the above string and the input string as inputs to the following function:

q (arg1) == (arg2)

!s Return true if the result sums to 0 (ie. none of the cards from the input match the above string)

GolfScript, 29 bytes
"A23456789TJQK"4*]zip{1/~=},!

Try it online!
"A23456789TJQK"4*               # Push this string repeted 4 times
                 ]zip           # Zip the input and the previous string
                     {    },    # Find all elements that pass this test
                      1/        # Divide in groups of 1      "XY" -> ["X" "Y"]
                        ~=      # Are they equal?
                            !   # Is it an empty array?

Outputs 1 for truthy and 0 for falsy.

Japt -e, 16 bytes
kVg"tjqk"i9õ ¬ha

Try it

x86 machine code, 33 32 bytes
Replace xx xx xx xx with the address of .Llut.
Machine code:
00000034: bb xx xx xx xx 6a 34 59 89 c8 d4 0d d7 ae 74 02  .....j4Y......t.
00000044: e2 f6 c3 41 4b 51 4a 54 39 38 37 36 35 34 33 32  ...AKQJT98765432

Commented assembly:
        .intel_syntax noprefix
        .section .text
        .globl frustration
        // Input: EDI: 52 byte string to test
        // Clobbers: EAX, ECX, EBX, EDI
        // Output: ECX: Zero for true, non-zero for false
frustration:
        // Load the lookup table into EBX.
        mov     ebx, offset .Llut
        // Set ECX to 52 for our loop iterator
        push    52
        pop     ecx
.Lloop:
        // Copy ECX to EAX
        mov     eax, ecx
        // Convert to the LUT index. Read the .Llut comment before
        // questioning my math. ;)
        //
        // AL = AL % 13, AH = AH / 13
        aam     13
        // Load the corresponding card rank into AL.
        // AL = EBX[AL]
        xlatb
        // Compare to the byte in EDI, increment EDI
        scas    al, byte ptr [edi]
        // If it was equal, return. ECX will be nonzero.
        // Note that loopne wouldn't work: it decrements first, so it
        // won't work for the last card. :(
        je      .Lfalse
        // Loop for 52 iterations
        loop    .Lloop
        // At this point, ECX is zero from the loop, our "truthy" value
.Lfalse:
        ret
.Llut:
        // We store our LUT in a slightly unsual order.
        // This is because we are looping from 52->0, and using
        // the index mod 13 to get the index. However, we read
        // forwards, and we decrement AFTER the modulo.
        //
        // This means we need to reverse, then rotate one byte.
        //  0  52  0
        //  1  51 12
        //  2  50 11
        // ....
        // 12  40  1
        .ascii "AKQJT98765432"

Try it online!
The function takes the string pointer in edi and returns, in ecx, either zero for a win, or non-zero for a loss.
Doesn't follow standard calling convention.
I finally found a good use for both aam and xlatb, I feel accomplished.
See the comments for details.
This could use 2 fewer bytes on 16-bit, but that is solely because the LUT address is 2 bytes smaller. No fancy 16-bit tricks, so I'll leave it at x86 because it is easily testable on TIO.
I'd love to trim down this LUT a bit, but I'm not currently sure how. The LUT is 13 bytes plus a 5 byte mov, making more than half of the code.


text:
Bl lu ur rr ry yv vi is si io on - Blur the text
Task
Given a string as input, generate a "blurred" version of that string.
Input
Your input will be a single-line string of ASCII characters, containing a minimum of 2 alphanumeric characters
Output
A string that is the "blurred" version of the input string.
A blurred string is one where every alphanumeric character from the original string has been paired with the ones adjacent to it, and each pair is separated by a space.
Any non-alphanumeric characters (whitespace, puncuation) in the input string must be ignored when determining adjacency of alphanumeric characters, and they must not included in the blurred string.
There must be no leading or trailing whitespace in the output string.
Examples
Ab -> Ab
Abc -> Ab bc
Abcd -> Ab bc cd
E?h? -> Eh
Blurry vision -> Bl lu ur rr ry yv vi is si io on
We're #1! -> We er re e1
I'm an example! -> Im ma an ne ex xa am mp pl le
This is _not_ legible -> Th hi is si is sn no ot tl le eg gi ib bl le
(a*b*c)+5^-x -> ab bc c5 5x
??a_%,1!=z#@ -> a1 1z

This is code-golf, so fewest bytes wins!

The non-alphanumeric characters have to be ignored or can be ignored?

@RGS Thanks for the clarification question, non-alphanumeric characters must be ignored

Might the input contain the character _? If so, would we need to explicitly ignore it?

I would suggest to add test cases with “*leading-non-alphanumeric” and “multiple<=>non<=>alphanumeric”.

@mathjunkie Correct, the input may contain _ and it must be ignored

I feel like this challenge suffers from a lot of poorly motivated add-ons.  For example removing certain characters from the string, or requiring no trailing whitespace.  These additions don't really have a reason to exist or an internal logic, they just get in the way of writing an answer.  I started to write an answer but found these extra conditions inflated my code by nearly three times, making them actually the bulk of the challenge.

Here are some posts 1 2 where you can read more about why I disagree with these extraneous elements.

What characters qualify as whitespace?

Why no trailing whitespace? Why do we have to ignore non-alphanumeric characters? These just seem like a lot of extra requirements that make the challenge less fun.

In future it's best to post questions to meta so the kinks can be worked out to give a question that is more about the essence of problem solving, than handling edge cases

Totally agreeing with @AdHocGarfHunter, I started to write a solution in BF and then realized that checking for allowed characters will probably inflate the solution by factor 4 or 5. This probably could be a different challenge "Only print numbers and characters from a string".

@S.S.Anne, bucause without it it would be too simple. The only thing I'm surprised with is ignoring _ as it adds at least 3 chars to regex-based solutions and has no additional value. Maybe this point should've been left unspecified.

Python 3, 57 55 bytes
lambda s:"".join((c+" "+c)*c.isalnum()for c in s)[2:-2]

Try it online!
How:

For each alpha-numeric character c in the string, replace it with c+" "+c.
E.g: "abcd" -> "a ab bc cd d"
Remove the redundant first and last 2 characters:
E.g: "a ab bc cd d" -> "ab bc cd"

I like this answer because it's elegant, and, esoterically, very useful. I might use this if I, for some reason, decide to add bluriness (how do you even type that?) to some program.

@mazunki bl lu ur rr ri in ne es ss

Husk, 5 bytes
wX2f□

Try it online!
Explanation
   f   Keep all items that
    □  Is an alphanumeric character.
 X     Pick all sublists
  2    With a length of 2.
w      Join the output list by spaces.

K (ngn/k), 27 24 22 21 bytes
" "/2':(2!"/9@Z`z"')_

Try it online!
"/9@Z`z"' binary search in the given string
2! mod 2
(2!"/9@Z`z"')_ drop non-alphanumeric chars
2': make a list of pairs of adjacent chars
" "/ join with spaces

[sed] -E (C locale), 46 33 23 bytes
s/\W|_//g;s/\B.\B/& &/g

Try it online!
Thanks to pizzapants184 for a 13-byte improvement.
10 more bytes off thanks to Dom Hastings.

Input on stdin, and output on stdout.
If your locale isn't set to C, you can set it with: export LC_ALL=C

I think you can replace s/\B(.)\B/\1\1 /g;s/(.) / \1/g with s/\B(.)\B/\1 \1/g for 33 bytes

@pizzapants184 Thank you -- I thought I had tried that :) .

You can drop this to 23 bytes with a couple of minor tweaks: Try it online!

It's almost a polyglot with Perl too, if the replacement string is $& $& instead of & &!

@DomHastings Thank you!

Pyth, 14 bytes
jd.::Q"\W|_"k2

Try it online!

:Q"\W|_"k replaces each non-alphanumeric character of the input with the empty string by matching each character against the regex \W|_
.: --- 2 finds all substrings of length 2
jd joins the substrings using spaces

05AB1E, 8 7 8 bytes
-1 byte thanks to @CommandMaster
+1 byte again thanks to @KevinCruijssen finding an issue
žKÃüJðý?

Try it online!

7 bytes: žKÃüJðý

You forgot a trailing ?, since the challenge disallows a trailing newline (for whatever stupid reason..)

Solid gravedigging @KevinCruijssen, I've updated

Jelly, 6 bytes
fØB;ƝK

A monadic Link accepting a list of characters which yields a list of characters.
Try it online!
How?
fØB;ƝK - Link: list of characters, S
 ØB    - base-62 characters = "01...89AB...YZab...yz"
f      - (S) filter keep if in (that)
    Ɲ  - for neighbours:
   ;   -   concatenate
     K - join with spaces

MATL, 17 16 bytes
t8Y2m)2YC!Z{0&Zc

Try it online! Or verify all test cases.
Explanation
Consider input 'Blurry vision'.
t      % Implicit input. Duplicate
       % STACK: 'Blurry vision', 'Blurry vision'
8Y2    % Push '012...9ABC...Zabc...z' (predefined literal)
       % STACK: 'Blurry vision', 'Blurry vision', '012...9ABC...Zabc...z'
m      % Ismember: true for chars of the first string that are in the second
       % STACK: 'Blurry vision', [1 1 1 1 1 1 0 1 1 1 1 1 1]
)      % Use as logical index. This keeps only letters and numbers in the input
       % STACK: 'Blurryvision'
2YC    % Character matrix with sliding blocks of length 2 as columns
       % STACK: ['Blurryvisio';
                 'lurryvision']
!      % Transpose
       % STACK: ['Bl';
                 'lu';
                 ...
                 'on']
Z{     % Cell array of matrix rows
       % STACK: {'Bl' 'lu ... 'on'}
0&Zc   % Join with character 0 (which will be displayed as space)
       % STACK: 'Bl lu ur rr ry yv vi is si io on'
       % Implicit display

This doesn't seem to properly handle input strings that contain numbers

@mathjunkie Thanks for pointing that out. I have corrected it

Save a byte: "@32v!

@Sanchises Thanks! But that produces a trailing space, which is not allowed

Oh yes overlooked the overly restrictive spec

TEX (INITEX), 372 bytes
\catcode`~13\let~\catcode~`{1~`}2~`#6~`\ 12~`|13\let|\expandafter\def\z{}\def\f#1{#1}\def\i#1{}\def\b#1#2{\ifx#2\e|||\i|\i\else|\f\fi{\ifcat#1a|\f\else|||\b|||#2|\i\fi}{\ifcat#2a #1#2|\b|#2\else|\b|#1\fi}}\def\t{~`011~`111~`211~`311~`411~`511~`611~`711~`811~`911~`\|12~`\~12~`\#12~`\{12~`\}12~127=12~`\%12~`\\12\read16to\x\edef\r{|\b\x\e}\immediate\write16{|\i\r\z}\end}\t

For example, the program being saved in a file named "codegolf.tex", provided with input ??a_%,1!=\z#@, initex codegolf.tex outputs:
This is TeX, Version 3.14159265 (TeX Live 2019/dev/Debian) (INITEX)
(./codegolf.tex
\x=??a_%,1!=\z#@
a1 1z
 )
No pages of output.
Transcript written on codegolf.log.

In the case of a degraded input, for example the strings ??, ?a, or a?, this implementation does not print any pair.
Explanation
Basis for a TEX program
\read16

Per this Meta answer, the input of a program written in TEX should come from standard input, which is the in register number 16.
\immediate\write16

The TEX Codegolf community prefers to output to DVI or PDF, because it is simpler than writing to the terminal.  However, this requires a valid \output routine, which either requires a format (with more category codes to alter1) or is longer to define.  So I write to the terminal. (\message could also have been used, but I don't like how the output is surrounded by TEX chat on the same line).
Because I output to the terminal, I also feel that no DVI file should get produced, so \immediate is required2.
\end

This is a complete program, so it must end with \end to run cleanly.
Category codes
Running on alphanumerics and ignoring punctuation is a trivial matter for TEX.  All I have to do is to customize the category codes of those characters.
For this subject, I will use category code 11 ("letter") for characters that need to be blurred, and category code 12 ("other") for characters that are to be dropped. That choice comes from the defaults of (ini)TEX, where letters are already set to 11 and most of the other characters to 12.
\catcode`~13\let~\catcode

To save bytes, I make ~ an active character and set its meaning to \catcode.  In the rest of the explanation, that alias will be ungolfed.
\catcode`{=1 \catcode`}=2 \catcode`#=6 \catcode`\ =12

These are required for INITEX to interpret my program correctly: { is now the begin-group character, } the end-group, # the macro argument, and ␣ is considered a normal character (so that the first spurious space of output can be removed).  These choices are widely used in the TEX world and do not cost bytes3.
\catcode`|=13 \let|=\expandafter

This is an useful alias for later.
\def\t{\catcode`0=11 ... \end}
\t

This is a TEX design pattern that fools TEX's eyes.  Everything that is written in the \todo macro definition will get a category code assigned, and this category code will not be reconsidered when TeX expands the macro.  Most notably:
\catcode`\\=12

This makes the escape character \ a normal character when read from the user input.
\read16to\x \edef\r{|\b\x\e} \immediate\write16{|\i\r\z} \end

When reading the macro definition, TEX has decided that these were control words, and TEX will not reconsider this choice after the macro has been expanded, even if \ has lost its special meaning in the meantime.
\catcode127=12

The DEL character is contained in ASCII, so it should be valid input per the subject's rules.  But in order to change its category code to 12, the DEL character has to be written, and the most efficient4 way to input it in TEX is to name it by its code point.
\catcode`0=11 ... \catcode`\\=12

Here are three groups of category code assignments: make the digits like letters, revert the changes made at the beginning of the program, and cancel other INITEX defaults (DEL, %, \, but not the new line because the subject emits the hypothesis:)

Your input will be a single-line string

The blurring command
Because I opted for terminal output, and because \write does not executes its argument (only expands it), I am forced to write the \blur macro as fully expandable.
\def\z{} \def\firstofone#1{#1} \def\ignore#1{}

As a prolog, I define three macros, which are commonly used in various fully-expandable design patterns.  The first one is the empty macro, the second one is the identity macro, and the third one is the zero macro.
\def\blur#1#2{ ... }

The \blur macro is recursive5.  It takes two characters at a time (because the rules say that the input is longer than two).  Its definition is made of three parts.
\ifx#2\e \expandafter\expandafter \expandafter\ignore \expandafter\ignore
\else    \expandafter\firstofone
\fi

is the recursion condition: if the end-of-string marker (the undefined command \e6) is found, ignore the two other parts. (More precisely, drop the unused portion of the conditional \else...\fi at \expandafter level 0, then ignore the second part at \expandafter level 1, then ignore the third part at \expandafter level 2.)  Otherwise, close the conditional and interpret the second part.
\ifcat#1a \expandafter\firstofone
\else \expandafter\expandafter \expandafter\blur
      \expandafter\expandafter \expandafter#2
      \expandafter             \ignore
\fi

handles the first character.  If it is a letter or digit, go analysing a second character.  Otherwise, skip the remaining of the conditional, ignore the third part, and call \blur recursively with #1 being dropped and #2 as the first character7 (an other one will get extracted from input).
\ifcat#2a ␣#1#2 \expandafter\blur \expandafter#2
\else \expandafter\blur \expandafter#1
\fi

handles the second character.  If it is a letter or digit, output a space then the first part of the blur, then forget about #1 and call \blur recursively on #27.  Otherwise, forget about it and call \blur recursively on #17.
Calling the blurring command on real input
\read16 to \x

will store the input into an (expandable) macro \x.
\expandafter\blur \x \e

This is how the \blur macro is called. Because \blur acts on tokens, the input contained in \x must be expanded first.  The end-of-string marker follows.
\edef\result{\expandafter\blur \x \e}

The result of the expansion, including the whitespace at front, is stored into the \result macro.
\expandafter\ignore \result \z

Inside the \write16 command, the \result macro is first expanded.  Then, \ignore eliminates the first token of output: the first space if the output is non-empty, or the \z macro call if the output is empty.  In the first case, the \z macro will survive; but \write16 will finally expand it, and its expansion is a no-op.  This is the most efficient way of handling the “no trailing space” requirement, even if it requires 24 bytes (the definition and call of \z and \return); suppressing a space at the end of the output would have been nearly impossible.
☡ Footnotes

$, &, ^, _, NUL, SPC, TAB, ~ for plain TEX; 5 bytes each = 40 bytes.
Without \immediate, \write adds its content to a whatsit box, thus generating a page of output.
Because there are only three category code changes, it is not worth putting them in a group to save the reverting.
Decimal: 127= (4); Hexadecimal: "7F= (4, harder to read); Octal: '199= (5); Escape sequence: ``\^^? (5, plus \catcode`^7 and revert)
It is even tail-recursive, which in TEX has the meaning of "it does not add tokens after the recursive call", and by doing so is more memory-friendly.
Because all input other than my program does not get interpreted, the \e command cannot be defined later.
This would fail if #2 was a simple group of arguments, but fortunately the input cannot contain simple groups, because no character has category code 1 nor 2.

Retina, 13 bytes
\W|_

Lw| `..

Try it online!
Explanation
\W|_ Replace each character NOT in the regex group \W (which is A-Z,a-z,0-9,_) or a _ with nothing
Lw| `.. Compute lists (L) for each set of two characters (..) starting at all positions in the string (w) and separate the lists with a space (| )

$& is the default output for L so no need to use $. (But I didn't know you could omit the ' after L|.)

@Neil Thanks for the tip - first Retina answer so still learning and madly skimming the documentation!

(Technically w allows the match to start and end at all positions in the string while v only allows the longest possible matches starting at all positions. Of course it makes no difference in a case like this where there is only one possible match per position.)

Factor, 51 37 bytes
-14 bytes thanks to chunes
[ [ alpha? ] filter 2 clump " "join ]

Try it online!
Factor, 51 bytes
: b ( s -- s ) [ alpha? ] filter 2 clump " " join ;

Try it online!
Unbelievably Factor is competitive with Python and JavaScript :)

37 bytes

@chunes Thanks! I have several more answers formatted this way, as a function. I didn't know then that a quotation is acceptible.

C# (Visual C# Interactive Compiler), 74 bytes
This ended up very similar to the Python answer. I was trying something noticeably more interesting with Aggregate, but the terrible no trailing whitespace requirement made it too long.

s=>s.SelectMany(c=>char.IsLetterOrDigit(c)?c+" "+c:"").Skip(2).SkipLast(2)

Try it online!

This is really great - I love seeing C# answers. I originally thought of flattening the list with SelectMany, but decided not to. I ended up utilizing the c+" "+c pattern as well. I need to utilize SkipLast!

I'm  also realizing that char is way more powerful than I originally thought. There's no need to do the String -> char -> String

Kotlin, 77 76 bytes
{it.filter{it.isLetterOrDigit()}.zipWithNext{a,b->"$a$b"}.joinToString(" ")}

Old solution
{it.replace("\\W|_".toRegex(),"").zipWithNext{a,b->"$a$b"}.joinToString(" ")}

AWK, 52 54 bytes
{gsub("\\W|_",a);for(b=$0;c=substr(b,++d,2);)$d=c}--NF

Try it online!
Fixed underscore rule goof (+2 chars), thanks to Pedro Maimere
Here's what's going on with this one...
gsub("\\W",a)

Removes all the non-alphabetic characters from the input string since $0 is the default target for gsub.  Using an unitialized variable a instead of "" saves a byte.
Next the code loops through the string taking 2 character slices and assigns them to positional variables.
for(b=$0;

The setup has to save $0 to another variable, since changing the positional variables impacts the collected input in $0 as well.
c=substr(b,++d,2);

The "test" at the top of the loop does a couple of things in one statement:

increments d, the "current character" pointer
sets variable c to the next 2 character slices of the input
the true/false test simple has the code looping until we run off the string and get a null

The body of the loop sets the next positional variable to the slice we just took.
$d=c

After all the positional variables have been set, there's one "garbage" entry on the end with one character.  So the test:
--NF

effectively drops that last positional variable and triggers the default action, which prints all the positional variables separated by a space.

Great explanation, again.

Nice piece of code! According to the question's examples, underscores (_) are meant to be erased. Unfortunately, gawk's \W is the same as [^[:alnum:]_], so the underscores are not erased. Thus, the regex would become "\\W|_".

Nice catch!  I'll update the code to add the underscore.

05AB1E, 23 19 18 bytes
žKÃ©g<F®Nè?®N>è?ð?

Try it online!
This probably could be really shorter, but I just wasn't able to find the right tools for the job. -4 bytes thanks to petStorm and a further byte thanks to Command Master.
Old Answer Explained
žj'_ммм©g<F®Nè?®N>è?' ?
žj                      # Push [a-zA-Z0-9_]
  '_м                   # Remove the "_" from the above string
     м                  # Remove all alphanum characters from the input, leaving non-alphanum chars
      м                 # Remove those non-alphanum chars from the input, leaving alphanum chars
       ©                # Put this string into the register
        g<F             # For N in range(0, len(input) - 1):
           ®Nè?         #   Index the string at position N and print
               ®N>è?    #   Index the string at position N + 1 and print
                    ' ? #   Print a space

19 bytes.

18 bytes

Retina 0.8.2, 17 16 bytes
\W|_

M&!`..
¶

Try it online! Link includes test cases. Explanation: Now basically a port of @Jarmex's Retina 1 solution, except that M! always joins with newlines, so I have explicitly change them to spaces. Previous 17-byte approach:
\W|_

\B.\B
$& $&

Try it online! Link includes test cases. Explanation:
\W|_

Delete any non-word character and any underscore (which is the only non-alphanumeric character that counts as a word character).
\B.\B
$& $&

Duplicate each inner character and space separate the results.

Another 17-byte solution, slightly different approach: Try it online!

@mathjunkie Actually I was just working on that approach myself, although I had it as 16 bytes because I used a pilcrow instead of \n.

JavaScript (ES6), 57 bytes
s=>s.replace(/\W|_|(.)/g,(_,c)=>c?c+' '+c:'').slice(2,-2)

Try it online!

The approach looks promising so far.

Q/KDB+, 38 bytes
Solution:
{" "sv -2_2#'next\[x inter .Q.an _52]}

Examples:
q){" "sv -2_2#'next\[x inter .Q.an _52]}"Ab"
"Ab"
q){" "sv -2_2#'next\[x inter .Q.an _52]}"Abc"
"Ab bc"
q){" "sv -2_2#'next\[x inter .Q.an _52]}"E?h?"
"Eh"
q){" "sv -2_2#'next\[x inter .Q.an _52]}"This is _not_ legible"
"Th hi is si is sn no ot tl le eg gi ib bl le"

Explanation:
{" "sv -2_2#'next\[x inter .Q.an _52]} / solution
{                                    } / lambda taking implicit x
                           .Q.an       / "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"
                                 _52   / drop element at index 52
                   x inter             / intersection of x and alphanumerics
             next\[                 ]  / scan along input
          2#'                          / take first 2 characters of each
       -2_                             / drop final two items
 " "sv                                 / join (sv) with " "

APL (Dyalog Unicode), 32 bytes (SBCS)
Port of Surculose Sputum's Python answer.
{¯2↓2↓⊃,/{⍵' '⍵}¨⍵∩⎕A,819⌶⎕A,⎕D}

Try it online!

QuadR, 18 bytes
1↓∊' ',¨2,/⍵
\W|_

Try it online!
Replaces all non-word characters and underscores (\W|_) with nothing , and then:
2,/⍵ adjacent pairs
' ',¨ prepend a space to each pair
∊ ϵnlist (flatten)
1↓ drop the first space

C (gcc), 80 bytes
p,b;f(char*s){for(p=b=0;*s;s++)isalnum(*s)?p&&printf(" %c%c"+!b--,p,*s),p=*s:0;}

Try it online!

Javascript ES6, 55 54 chars
s=>s.replace(/\W|_/g,"").replace(/.(?=(.).)/g,"$&$1 ")

Test:

f=s=>s.replace(/\W|_/g,"").replace(/.(?=(.).)/g,"$&$1 ")

console.log(`Ab -> Ab
Abc -> Ab bc
Abcd -> Ab bc cd
E?h? -> Eh
Blurry vision -> Bl lu ur rr ry yv vi is si io on
We're #1! -> We er re e1
I'm an example! -> Im ma an ne ex xa am mp pl le
This is _not_ legible -> Th hi is si is sn no ot tl le eg gi ib bl le
(a*b*c)+5^-x -> ab bc c5 5x
??a_%,1!=z#@ -> a1 1z`.split`
`.map(s=>s.split` -> `).map(([s,k])=>f(s)==k).every(x=>x))

@tsh, yep, nice. I removed +, but forgot about braces.

J, 32 bytes
[:}:[:,/2,&' '\]-.-.&AlphaNum_j_

Try it online!
               -.-.&AlphaNum_j_   remove non-alphanumeric
       2,&' '\                    append space to each pair of adjacent chars
     ,/                           join
 }:                               remove trailing space

Nice answer, I think [:}:@,2,&' '\]-.-.&AlphaNum_j_ works for -2.

R, 98 bytes
function(x,y=grep("[a-z0-9]",el(strsplit(x,"")),T,,T))for(i in seq(y)[-1])cat(y[i-1:0],' ',sep='')

Try it online!
Unusually for R, a for loop is significantly shorter than a matrix-based approach, mainly because it allows us to just use cat instead of the much-more-verbose Reduce(paste vectorized way to build a text string from a list of characters.

78 bytes

@Giuseppe Much better than mine: please post it yourself.

R, 76 bytes
function(s)cat(substring(S<-gsub("[^a-z0-9]","",s,T),N<-1:(nchar(S)-1),N+1))

Try it online!
Similar to Dominic van Essen's answer, uses cat to join by spaces; uses substring which recycles (as opposed to substr which doesn't).

Perl 5 -p, 25 bytes
s/\W|_//g;s/\B.\B/$& $&/g

Try it online!

Nice! I'm surprised I didn't post this, given the sed answer! You can also save a byte using s/\Pl//g too!

Charcoal, 26 bytes
≔ΦＳ№⁺α⁺β⭆χλιθ⪫Ｅ⊖Ｌθ✂θι⁺²ι¹

Try it online! Link is to verbose version of code. Explanation:
≔ΦＳ№⁺α⁺β⭆χλιθ

Filter out any character that can't be found in the upper or lower case alphabet and isn't a digit.
⪫Ｅ⊖Ｌθ✂θι⁺²ι¹

Extract all substrings of length 2 and join them together on spaces.

[C#], 163 155 133 128 127 128 114 112 133 98 bytes
i=>{var b=i.Where(char.IsLetterOrDigit);return b.Select((n,i)=>i==0|i==b.Count()-1?n+"":n+" "+n);}

Run it
Have not used a Regex yet in a Codegolf, so very excite. Regex uses way too many characters. No longer excite.

127 bytes: removed a "." in the regex string
126 bytes: replaced String.Join("" with String.Concat
114 bytes: changed || to |, removed the ( ) { return; } from inside the Select
112 bytes: Removed + from regex
128 bytes: Reverting back to older solution. Entry now legal (thanks to @Neil and @my pronoun is monicareinstate)
98 bytes:  Realization that char is way more powerful than I thought (thanks to @my pronoun is monicareinstate's C# solution), removed the string -> char -> string conversions

Under standard rules this is a snippet rather than a function so you should include the (i,j,p)=>{} to make it legal, but you can at least copy the "\\W|_" that everyone else is using (with two backslashes because it's inside a string literal). Also I think i==0 can be i<1 to save another byte.

Actually you don't use j or p, so they can go too, so with the other changes you're still ahead overall.

Besides, for some weird reason you have to count using directives. While the awesome interactive compiler imports several, you still have to count using System.Text.RegularExpressions; :(

Ah Neil, thanks, I will change it.

@ my pronoun is monicareinstate  do  you have a link for more info on that rule? Thanks

Icon, 92 bytes
procedure f(s)
t:=""
find(k:=!s,&letters++&digits--'_')&t||:=k||' '||k&\z
return t[3:-2]
end

Try it online!

Haskell, 86 74 bytes
-12 bytes thanks to Khuldraeseth na'Barya
import Data.Char
unwords.map(\(x,y)->[x,y]).(zip<*>tail).filter isAlphaNum

Try it online!

\x->zip x$tail x is zip<*>tail for four bytes of savings.

uncurry$(.pure).(:) is \(a,b)->[a,b] for another six.

Japt v2.0a0 -S, 6 bytes
r\W ä+

Try it
r\W ä+     :Implicit input of string
r          :Replace
 \W        :  Regex /[^a-z0-9]/gi
    ä+     :Consecutive pairs reduced by concatenation
           :Implicit output, joined with spaces

C (gcc), 159 bytes (-2 more bytes thanks to S.S. Anne and JustinCB)
main(a,b)char**b;{b++;for(a=0;a<strlen(*b);a++){if(isalnum((*b)[a])){a?putchar((*b)[a]):0;a&&a<strlen(*b)-1?putchar(32):0;a<strlen(*b)-1?putchar((*b)[a]):0;}}}

Try it online!

You can save some bytes: i;main(a,b)char**b;{b++;for(i=0;i<strlen(*b);i++){if(isalnum((*b)[i]))putchar(i?(*b)[i]:0);putchar(i&&i<strlen(*b)-1?32:0);putchar(i<strlen(*b)-1?(*b)[i]:0);}}

The above version moves the declaration of i outside of main, allowing it to be implicitly declared as an int(saving 4 bytes) & moves the declaration of b's type after the function declaration, K&R-style, which allows a to be implicitly declared as an int(saving 2 bytes)

Actually, for your code to work properly for the more advanced test cases, you need to wrap the putchar's in brackets, adding 2 bytes: i;main(a,b)char**b;{b++;for(i=0;i<strlen(*b);i++){if(isalnum((*b)[i])){putchar(i?(*b)[i]:0);putchar(i&&i<strlen(*b)-1?32:0);putchar(i<strlen(*b)-1?(*b)[i]:0);}}}

Cool, thanks! I'll update the answer.

I don't think outputting null bytes is allowed. Also, you can remove i; and use a instead.

@S.S.Anne cool, i'll update the answer!

I think this fails for cases like ’??a_%,1!=z#@’.

You can fix outputting null bytes by moving the ternary operator outside of the putchar(this also includes @S.S.Anne 's byte reduction): main(a,b)char**b;{b++;for(a=0;a<strlen(*b);a++){if(isalnum((*b)[a])){a?putchar((*b)[a]):0;a&&a<strlen(*b)-1?putchar(32):0;a<strlen(*b)-1?putchar((*b)[a]):0;}}}

@JustinCB thanks, I'll update the post.

128 bytes

Red, 130 bytes
func[s][a: charset[#"0"-#"9"#"A"-#"Z"#"a"-#"z"]parse s[any[p: change
a(rejoin[p/1" "p/1])| remove skip]]take/part/last s 2 at s 3]

Try it online!

J, 42 bytes
1}.[:,/2' '&,\]#~'/9@Z`z'(2|I."#.)&(3&u:)]

Try it online!
Inspired by ngn's ngn/k solution
Explanation
                                   (3&u:)     convert to integer both
                                         ]    the input
                 '/9@Z`z'                     and the symbols surrounding the digits,
                                              uppercas and lowercase letters
                         (2|I."#.)&           and find in which interval lies each char
                                              then check if it's an odd one
              ]#~                             use the above to filter the input
       2' '&,\                                prepend each pair of adjacent chars
                                              with a space
   [:,/                                       flatten the result
1}.                                           and drop the leading space

JavaScript (ES6), 54 76 bytes
a=>[...a.replace(/[\W_-]/g,'')].map((a,b,c)=>a+c[b+1]).slice(0,-1).join(' ')

Try it online!

Hello and welcome to CGCC! Looks like this code isn't ignoring special characters as the spec requires (eg. ??a_%,1!=z#@ should become a1 1z). Hopefully it's an easy fix :)

@mathjunkie Sorry, completely missed the comment saying that non-alphanumeric characters must be removed, it's fixed but it makes my answer a lot less competitive.

You can save 2 bytes with .join\ ``

C (gcc), 123 \$\cdots\$ 117 116 bytes
i;f(char*s){char*t=s;for(i=0;t[i+=!!isalnum(*s++)]=*s;);for(putchar(*t++);t[1];)printf("%c %1$c",*t++);putchar(*t);}

Try it online!

Stax, 6 bytes
£Q·H°·

Run and debug it at staxlang.xyz!
Unpacked (7 bytes) and explanation:
VL|&2BJ
VL         Push string of all alphanumeric characters.
  |&       Remove from the input all letters not in this string.
    2B     All length-2 substrings
      J    Join with spaces

Elixir, 120 bytes
b=fn w->import String;l=replace(w,~r/[\W_]/,"");for(i<-0..String.length(l)-2,do: at(l,i)<>at(l,i+1))|>Enum.join(" ") end

Try it online!

Raku, 31 bytes
{@$_ Z~.skip}o{S:g/\W|_//.comb}

Try it online!
The extra requirement for stripping non-alphanumeric characters takes up more than half of the bytes.

F#, 130 bytes
let f s=s|>Seq.filter Char.IsLetterOrDigit|>fun x->Seq.tail x|>Seq.zip x|>Seq.map(fun(a,b)->string a+string b)|>String.concat" "

K (ngn/k), 47 bytes
{" "/2':x^"!@#$%^&*()~`_-+={}[]|\:;\"'<>?,./ "}

Try it online!
The window adverb finally got a use for once. Also, removing non-alphanumeric is such a huge pain to write.
Anyways, here's the explanation:
{" "/2':x^"!@#$%^&*()~`_-+={}[]|\:;\"'<>?,./ "}  Main function. Takes x as input
          "!@#$%^&*()~`_-+={}[]|\:;\"'<>?,./ "   Hard-coded non-alphanumeric string
        x^                                       Remove all of them in x
     2':                                         Window (Get chunks of x at length 2)
 " "/                                            Join the chunks with whitespace

Lua, 57 bytes
io.write((...):gsub('%W',''):gsub('.','%1 %1'):sub(3,-3))

Try it online!
Performs three steps:

Removes all non-alphanumerics
Blurry vision -> Blurryvision

Double all characters, with a space in between
Blurryvision -> B Bl lu ur rr ry yv vi is si io on n

Remove the excess characters
B Bl lu ur rr ry yv vi is si io on n -> Bl lu ur rr ry yv vi is si io on

Erlang (escript), 110 bytes
Port of the Python answer.
f(X)->R=lists:flatten([[I]++" "++[I]||I<-X,re:run([I],"[A-Za-z0-9]")/=nomatch]),string:slice(R,2,length(R)-4).

Try it online!

Java (JDK), 59 bytes
s->s.replaceAll("\\W|_","").replaceAll(".(?=(.).)","$0$1 ")

Try it online!

Swift, 141 bytes
{let a=$0.unicodeScalars.filter{CharacterSet.alphanumerics.contains($0)};return zip(a,a.dropFirst()).map{"\($0)\($1)"}.joined(separator:" ")}

Ungolfed:
let ungolfed: (String) -> String = { input in
    let unicodeScalars = input.unicodeScalars.filter { char in CharacterSet.alphanumerics.contains(char) }
    return zip(unicodeScalars, unicodeScalars.dropFirst())
        .map { "\($0)\($1)" }
        .joined(separator: " ")
}

Test case runner:
import Foundation

let testCases: [(input: String, expectedOutput: String)] = [
    (input: "Ab", expectedOutput: "Ab"),
    (input: "Abc", expectedOutput: "Ab bc"),
    (input: "Abcd", expectedOutput: "Ab bc cd"),
    (input: "E?h?", expectedOutput: "Eh"),
    (input: "Blurry vision", expectedOutput: "Bl lu ur rr ry yv vi is si io on"),
    (input: "We're #1!", expectedOutput: "We er re e1"),
    (input: "I'm an example!", expectedOutput: "Im ma an ne ex xa am mp pl le"),
    (input: "This is _not_ legible", expectedOutput: "Th hi is si is sn no ot tl le eg gi ib bl le"),
    (input: "(a*b*c)+5^-x", expectedOutput: "ab bc c5 5x"),
    (input: "??a_%,1!=z#@", expectedOutput: "a1 1z"),
]

for (input, expectedOutput) in testCases {
    let actualOutput = f(input)
    assert(actualOutput == expectedOutput, """
    Wrong answer.
        input: '\(input)'
        actualOutput: '\(actualOutput)'
        expectedOutput: '\(expectedOutput)'

    """)
}
```

Python 3, 82 chars
a=[c for c in input() if c.isalnum()]
print(' '.join(a+b for a,b in zip(a,a[1:])))

Try it: https://ideone.com/dxJU8e

PowerShell Core, 48 47 bytes
''+($args-match'[a-z\d]'|%{,"$p$_"*!!$p;$p=$_})

Try it online!

APL (NARS2000 dialect) 24 bytes
{¯1↓1↓⍕2,/⍵/⍨⍵∊A←⎕a,⎕A,⎕D}

Vyxal, 5 bytes
kr↔zṄ

Try it Online!
kr↔   # Remove non-alphanumeric
   z  # Get chunks of length 2
    Ṅ # Join with spaces

20 bytes: Try it Online!

@astonearachnid Thanks! Building on that, I got to 15 bytes.

Try it Online! for 10

Try it Online! for 7

now 5 bytes

Ruby -pl, 48 39 35 bytes
Similar to my own original solution, this is now basically a port of Xcali's Perl 5 solution; give them an upvote.
gsub /\W|_/,""
gsub /\B.\B/,'\& \&'

Attempt This Online!

Rust, 144 129 127 126 123 120 106 bytes
-3 bytes, thanks @mousetail
-14 bytes, thanks @corvus_192
Playing with strings can be subtle, and as such it is easy to slam face first into the borrow checker when trying to golf string manipulation in rust. As a result I welcome any improvement to this code:
|s|{let a:String=s.filter(|c|c.is_alphanumeric()).flat_map(|c|[c,' ',c]).collect();a[2..a.len()-2].into()}

The solution is the same as for the Python one above.
Ungolfed:
// This first line is not part of the code snippet,
// but needs to be present in the driving code in order for type inference to work.
let blur: fn(std::vec::IntoIter<char>) -> String =
    |s| {                                    // Take in an iterator over
                                             // a vector of chars and
        let a: String = s                    // build a new string
            .filter(|c| c.is_alphanumeric()) // by taking all alphanumeric characters
            .flat_map(|c| [c, ' ', c])       // and replacing them with a copy
                                             // of themselves around a space
            .collect();                      // and collecting them into a String.
        a[2..a.len() - 2].into()             // Then make a string slice of every
                                             // character except the first and last
                                             // two and convert that slice
                                             // into a String.
                                             // `.into()` works because of the
                                             // function signature that is specified
                                             // on the first line.
};

println!(
    "{}",
    // We call this closure by passing it an iterator over a vector of characters
    // that we build by iterating over the characters in a string.
    blur("This is a string"
        .chars()
        .collect::<Vec<_>>()
        .into_iter())
);

Attempt this online

Or -3 more bytes if you use .flat_map(|c|[c,' ',c]) instead

Consider using ATO instead of TIO which has more up to date versions of many major languages

103 bytes: |s|{let a:String=s.filter(|c|c.is_alphanumeric()).flat_map(|c|[c,' ',c]).collect();a[2..a.len()-2].into()}, usable as a fn(&mut std::vec::IntoIter<char>) -> String

Thanks @corvus_192! When you say 103 bytes, how are you counting them? I get it to 106.

You're right it's 106. I think I had some version with 103 bytes, but I can't remember .

PHP, 70 bytes / 69 bytes
while(~$c=($s=preg_replace('/\W/','',$argn))[++$i])echo$s[$i-1],"$c ";

run these 70 bytes as pipe with -nr, ignore the warnings
or run this port of Qwertiy´s JavaScript solution (69 bytes) as pipe with -nR:
<?=preg_replace('/.(?=(.).)/','$0$1 ',preg_replace('/\W/','',$argn));

Try them online

Zsh, 65 bytes
b=(${(s::)@//[^0-9A-Za-z]});for i ({2..$#b})printf $b[i-1]$b[i]\

try it online!
There is a a space character after the backslash: \

Pip, 17 16 bytes
_.BMP(aXA,XD)J:s

Attempt This Online!
Explanation
_.BMP(aXA,XD)J:s
       XA         ; Regex matching any letter character
          XD      ; Regex matching any digit
         ,        ; Combine them using alternation (match one OR the other)
     (a     )     ; Find all matches in command-line argument
   MP             ; Map this function to each pair of adjacent results:
_                 ;  The first
 .                ;  concatenated with
  B               ;  the second
             J:s  ; Join the resulting list on spaces

Using the -s flag would remove the need for the final three bytes.

It looks like calling a function BMP on an object _ lol

Scala 3, 75 bytes
_.map(c=>if(c.isLetterOrDigit)c+" "+c else"").mkString.drop(2).dropRight(2)

Attempt This Online!

Uiua, 22 bytes
/$"_ _"◫2▽+⌵⊃±∊,+@0⇡10

Try it
-1 + fix thanks to chunes :)
Explanation:
+@0⇡10

Take each number 0 to 9 and convert to character by adding it to character literal 0
⊃±∊,

Apply sign ± to each character of the input, and member ∊ to the digit list and each character of the input. The former gives 0 for non-letters, 1 for uppercase letters, and -1 for lowercase letters. The latter gives 1 if the character is a digit and 0 otherwise.
+⌵

Take the absolute value of each result from sign ±, yielding a list of 1 and 0. Then, add this list to the results of member ∊. This results in a list with 1 at every position where there's a letter or a digit, and 0 everywhere else.
▽

keep ▽ takes two lists and, in the case of the top containing only 0's and 1's, acts as a filter, removing any items from the first list that correspond with a 0 in the second. Here, the first list is the input string, and the second list is the filter created above.
So far, everything has just been the task of removing non-alphanumeric characters. The main task itself is much shorter:
◫2

The size-2 windows ◫ of the list. This gives the overlapping pairs of the string.
/$"_ _"

reduce / passes the first two items through a function, then that result and the next item through the same function, repeatedly until there are no more items left. $"_ _" is a format string, which becomes a function where each _ becomes replaced with an item from the stack. This operation results in the list joined by spaces.

You also need to get rid of underscores, which inconveniently are matched by the \w regex.

-1 without the underscore problem.

@chunes thanks! That’s close to what my original idea was but a bit shorter

PowerShell Core, 56 bytes
$n=$args|% t*y|%{$_+" "+$_}
-join$n[0..($n.length-2)+-1]

Try it online!
-20 bytes for @mazzy

nice. you don't need $s. see Try it online!

@mazzy thanks for it!

Wasif, I think improvements are needed here. See test case Blurry vision

Java 8 (OpenJDK 8), 144 bytes
No regexp, using only a single inline Stream
s->s.chars().filter(e->e>47&e<58|e>64&e<91|e>96&e<123).mapToObj(e->""+(char)e).reduce("",(a,b)->a+(a.length()<2?b:" "+a.charAt(a.length()-1)+b))

Try it online!

Nibbles, 9 bytes (18 nibbles)
*" "`'`:<<;|@\$n>>$

Attempt This Online!
Explanation
*" "`'`:<<;|@\$n>>$
            @        Line of stdin
           |         Filter its characters on this function:
             \$n      Character is alphanumeric
          ;          Store the result as $
        <<           Remove last character
                >>$  Take another copy of $ and remove first character
      `:             Put both strings in a list
    `'               Transpose, giving a list of 2-character strings
*" "                 Join on spaces

Thunno 2 Ṡ, 5 bytes
œȦDḣZ

Attempt This Online!
Explanation
œȦDḣZ  # Implicit input
œ      # Filter the input by:
 Ȧ     #  Is alphanumeric?
  D    # Duplicate
   ḣ   # Remove the first item
    Z  # Zip them together
       # Join by spaces
       # Implicit output

Vyxal 3 S, 4 bytes
/““o

Try it Online!
janky formatting allows for a 3 byter

source: Stack Exchange

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

sort: votes


text:
Exactly N in a line
Given a number N from 2 to 8, place any nonzero number of queens on a grid of any size so that every queen has exactly N queens (counting itself) in each of its row, column, and each diagonal.
This challenge has a significant restricted-time runtime limit. Your code must finish all N from 2 to 8 (combined) within the 60-second timeout on TIO. This makes brute force unlikely to work.
Some example outputs are below. You can use this verification script to confirm your outputs.
N=2
.OO.
O..O
O..O
.OO.

N=3 (by Christian Sievers)
..OOO......
.O.O...O...
OO...O.....
O...O....O.
O......O..O
..O...O..O.
..O..O....O
.O...O..O..
.......OO.O
...O..O..O.
....O.O.O..

N=4 (by Christian Sievers)
...OO..OO...
..OO....OO..
.O...OO...O.
OO........OO
O....OO....O
..O.O..O.O..
..O.O..O.O..
O....OO....O
OO........OO
.O...OO...O.
..OO....OO..
...OO..OO...

Your output grid can be square or rectangular. It may have empty rows and/or columns, even ones on the outside as a "margin" that makes the array bigger than necessary.
You can output as a 2D array of two distinct values of your choice, or as a string that displays as such.
For the 60-second time limit, running verification code doesn't have to happen within this time. If your language is not on TIO, you test it on any reasonable machine. On the off chance that your grids might be so big that TIO can't print them, it's allowed to run the test with storing all 7 grids instead of printing them, such as to a size-7 list where that any of them may be retrieved.

Great challenge! I've tried to run the verification script on some of my shorter output but I get an error message (not true or false.)

@LevelRiverSt Is it one of the assertions, or something else? What's the output? Do you have the format mentioned in the footer?

@LevelRiverSt Oh, oops, my verification code is assuming the grids are square. Let me fix this.

Ok, I thought it might be that. Anyway, I've added a TIO link for the verification to my answer, so you can check if there is anything else I'm doing wrong.

@LevelRiverSt I updated the snippet, I think it should work now.

Verified Up to 5 now. That's the biggest output TIO will run without truncating. I guess you didn't expect output this big! Thanks again for the challenge.

@LevelRiverSt Yeah, I expected huge outputs but not quite this huge. Do you think it would be reasonable to require that each of the grids in the submissions is stored to a variable within the time limit during the test even if it can't be printed?

Cardboard Box's answer runs in about 11 seconds and mine runs way faster than that. So it wouldn't invalidate any existing answers, so yes, I think it would be reasonable. The idea for this type of output was Cardboard box's, they deserve the credit, I just improved on the idea slightly. I doubt the outputs will get any bigger. The interesting question now is if anyone can come up with a different soluton that gives shorter output with reasonably short code.

Wow, I think the awesome answers help understand why some existance proofs in math involve unnecessaryly huge numbers. I have a nice solution for N=4 that I wouldn't like to stay unknown: ...OO..OO.../..OO....OO../.O...OO...O./OO........OO/O....OO....O/..O.O..O.O../..O.O..O.O../O....OO....O/OO........OO/.O...OO...O./..OO....OO../...OO..OO.../

@ChristianSievers That's a beautiful solution, and vaguely reminiscent of an example on wikipedia for the recent question about 3 in a row. If you have code to produce solutions like this, I personally think you should post it. There will be sticklers that say you should only post competitive golf answers, but in cases like this I disagree.

@LevelRiverSt My program is also not competitive wrt time, and not very interesting. It's just some integer linear programming: one 0-1 variable for each possible queen on a grid point, and one for each line indicating that this line has no queens. One constraint for each line: sum of queens on this line plus N times the this-line-has-no-queens-variable equals N. And don't forget: at least one queen!

Python 2, 141 138 bytes
Try it online!
n=input()
P=[280]
for t in[1j,9,40j-40,64j+64]:P={p+i*t for i in range(n)for p in P}
r=range(792)
print[[x+y*1jin P for x in r]for y in r]

Takes n as input and prints a list of lists of booleans.
While the grids are generated within the 60 second time limit, they are larger than TIO's 128KiB limit, so they were simplified to be printable via TIO thanks to math junkie.
I added in the verification script to the TIO link so it can also be verified within TIO.
Here's my attempt at drawing my original solution for n=3. Hopefully this helps visualize it. Replace 57 with 40 and 408 with 64 for the current solution.

Looking at the TIO output for n=3, I'm not sure this works, though the output I'm looking at is cut off. What is supposed it supposed to look like? I see 3 queens in the first 3 rows in the same columns, which seems like will cause a problem with the short diagonal of the first queen, as there aren't any queens in the displayed rows after, and the cut off rows seem too late to be in that diagonal. (Edit: n=2 seems to have the same issue.)

I've attempted to simplify the printed output to better show the shape of the grid: Each of the xyz: headings show the character number of that O on the current line. The --- ... --- headings are meant to show the line number after a bunch of empty lines. I've edited it into your post since the TIO link is too long to be a comment

Nice solution! I'm curious where you got the constants from. Do they give the smallest displacements to always avoid unwanted sharing of lines?

@xnor Yeah I just found them through brute force. I originally used [1j, n, n**2*(1+1j), n**3*(1-1j)] but changed them to constants to save bytes.

Ruby, 85 77 bytes
->n{j=n**3+n
((0...n*n).map{|i|((?.*n*n+?O)*9)[~i%n+i/n*n,j]}+[?.*j]*j)*n*$/}

Try it online!
Similar to and inspired by cardboard_box's answer, but rotated by 45 degrees.
Below are the first 16 lines of the output for n=4. It should be apparent that that within each 16x16 box, the queens form diagonal lines of 4. In between the boxes there is a single blank column. If this was not there, the diagonal lines of each n**2 x n**2 box would line up exactly with its neighbour when n is even.
There are clearly 4 queens on each horizontal row and 1 queen in each vertical column (except the blank ones.) The rest of the pattern is a repeat of the below, interspersed with n**3+n rows of blanks to ensure the diagonals do not clash (I could get away with just a few rows less, but the code is shorter this way.)
The output is truncated by TIO so it's only possible to get full output up to 5, but it's apparent from the way the pattern is constructed that it meets the rules. Output has been verified up to 5.
.............O................O................O................O...
..............O................O................O................O..
...............O................O................O................O.
................O................O................O................O
.........O................O................O................O.......
..........O................O................O................O......
...........O................O................O................O.....
............O................O................O................O....
.....O................O................O................O...........
......O................O................O................O..........
.......O................O................O................O.........
........O................O................O................O........
.O................O................O................O...............
..O................O................O................O..............
...O................O................O................O.............
....O................O................O................O............

...many blank rows, then repeat the above a total of 4 times...

How is this so fast?! For n=20, the computation takes about 1 second even though the array has size 1,313,852,399.

@xnor I was a little shocked by how fast it is as well. But see what it does: A) generate an array of 20**2=400 strings 20**3+20=8020 elements long, similar to the block for n=4 shown above. B) generate a string of 8020 periods, and make an array of 8020 pointers to this string. C) take the whole thing, and make 20 copies of all the pointers. D) join the array elements into a string with the operation *$/ (where $/ is a special variable preinitialized to newline) and return the combined string. Only in step D do we have to handle the 20*(400+8020) lines of 8020 characters.

@xnor To show that we work at the pointer level until the very end, try the following program. You will find every identical line in the output is modified with an X at the begining. n=4;j=n**3+n;s=((0...n*n).map{|i|((?.*n*n+?O)*9)[~i%n+i/n*n,j]}+[?.*j]*j)*n;s[17][0]=?x;puts s*$/ Note that comments have additional control characters inserted in them at end of line so if you copy and paste code from comments you have to remove the formatting before running.

also the code as written doesn't produce the correct result for n>8. The constant 9 needs to be at least n+1, but this can be fixed for 1 or 2 more bytes; for arbitary sized n use -~n. The question specifically asked up to n=8 so I left it like this.

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


text:
The Koszul Sign Rule
A Bit of Background
The exterior algebra is a central object in topology and physics (for the physics concept cf. fermion). The basic rule dictating the behavior of the exterior algebra is that \$yx = -xy\$ (and consequently \$x^2 = -x^2 = 0\$). Applying this rule twice we see that \$yzx = -yxz = xyz\$.
The product of two monomials is 0 if any repeated variable occurs, e.g. \$vxyz * stuv = 0\$ because \$v\$ is repeated. Otherwise, we want to put the variables into some standard order, say alphabetical order, and there is a sign introduced that counts how many variables we passed by each other, so for example \$tvy * suxz = +stuvxyz\$ because it takes a total of six crossings to put \$tvysuxz\$ into alphabetical order (on each line I have highlighted the most recently swapped pair):
$$tvy * suxz = +\, tvy\;suxz\\
\phantom{tvy * suxz } {}= -tv\mathbf{\large sy}uxz\\
\phantom{tvy * suxz } {}= +t\mathbf{\large sv}yuxz\\
\phantom{tvy * suxz } {}= -\mathbf{\large st}vyuxz\\
\phantom{tvy * suxz } {}= +stv\mathbf{\large uy}xz\\
\phantom{tvy * suxz } {}= -st\mathbf{\large uv}yxz\\
\phantom{tvy * suxz } {}= +stuv\mathbf{\large xy}z\\
$$
Your task will be to compute this sign.
This is a special case of the Koszul Sign Rule which determines the sign of the terms in many sums in math.
If you are familiar with determinants, the sign in the determinant formula is an example.
Task
You will take as input two 32 bit integers \$a\$ and \$b\$, which we will interpret as bitflags. You may assume that \$a\$ and \$b\$ have no common bits set, in other words that \$a\mathrel{\&}b = 0\$. Say a pair of integers \$(i, j)\$ where \$0\leq i,j < 32\$ is an "out of order pair in \$(a,b)\$" when:

\$i < j\$,
bit \$i\$ is set in \$b\$, and
bit \$j\$ is set in \$a\$.

Your goal is to determine whether the number of out of order pairs in \$(a,b)\$ is even or odd. You should output true if the number of out of order pairs is odd, false if it is even.
Input
A pair of 32 bit integers. If you would like your input instead to be a list of 0's and 1's or the list of bits set in each integer, that's fine.
Output
true or any truthy value if the number of out of order pairs is odd, false or any falsey value if it is even.
Alternatively, it is fine to output any pair of distinct values for the two cases.
It is also fine to output any falsey value when the number of out of order pairs is odd and any truthy value when the number of out of order pairs is even.
Metric
This is code golf so shortest code in bytes wins.
Test cases
    a = 0b000000
    b = 0b101101
    output = false // If one number is 0, the output is always false.

    a = 0b11
    b = 0b10
    output = UNDEFINED // a & b != 0 so the behavior is unspecified.

    a = 0b01
    b = 0b10
    output = true // 1 out of order pair (1,2). 1 is odd.

    a = 0b011
    b = 0b100
    output = false // 2 out of order pairs (1,2) and (1,3). 2 is even.

    a = 0b0101
    b = 0b1010
    output = true // 3 out of order pairs (1,2), (1,4), (3,4). 3 is odd.

    a = 0b0101010 // The example from the introduction
    b = 0b1010101
    output = false // 6 out of order pairs (1,2), (1,4), (1,6), (3,4), (3,6), (5,6).

    a = 33957418
    b = 135299136
    output = false

    a = 2149811776
    b = 1293180930
    output = false

    a = 101843025
    b = 2147562240
    output = false

    a = 1174713364
    b = 2154431232
    output = true

    a = 2289372170
    b = 637559376
    output = false

    a = 2927666276
    b = 17825795
    output = true

    a = 1962983666
    b = 2147814409
    output = true

// Some asymmetric cases:
    a = 2214669314
    b = 1804730945
    output = true

    a = 1804730945
    b = 2214669314
    output = false

    a = 285343744
    b = 68786674
    output = false

    a = 68786674
    b = 285343744
    output = true

    a = 847773792
    b = 139415
    output = false

@ovs I think it's right as is, I'm looking for pairs that are in the "wrong" order.

Except for the trivial 1, 2 test case, all of the other test cases seem to give the same result with the inputs swapped. Can you make more test cases which give different results when you swap the inputs?

@Neil Sure, will do.

@Neil Seems that if I choose "randomly" by randomly selecting a u32 and then randomly partitioning the bits into two integers, there is a 25 % chance that you will get an asymmetric case. So if I' d been lucky, I might have gotten 1-- 2 asymmetric cases in my 7 random test cases, but I got unlucky and turned up 0.

I think you want an equals sign in each line of your multi-line formula. I was confused at first because it looks like the expressions was being expanded into the sum of those seven terms.

@xnor Oops, I want it so much that I was just imagining equals signs that aren't there until you pointed it out. Fixed.

Is the idea of an antisymmetric tensor at all relevant?

@golf69, yes, it is very relevant. This is exactly the rule you use when doing calculations with differential forms, which are totally antisymmetric tensor fields. (Also I have ever heard people refer to this property by the word antisymmetry, never by anything like "Koszul sign rule".) (And it works for determinants because, well, they're totally antisymmetric in all rows & columns.)

@Ramillies Calling this the "Koszul sign rule" seems to be a pretty strong cultural marker. As a sign of its rarity, this is now the 3rd google hit and second duckduckgo hit for that term. Usually I would use "Koszul sign rule" more generally for rules like d(xy) = d(x)y + (-1)^{|x|}xd(y) and (a otimes b)(c otimes d) = (-1)^{|b||c|} (ac otimes bd). This is really just multiplication in an exterior algebra.

COW, 363 285 bytes
moOoommoOmoOmoOoomMOOmoOmOoMOOMOomOoMoOmoOMMMMOOMMMMOomOoMOomoOmoOMoOmOoMMMOOOmooMMMmoomoOMMMOOOmOoMMMmOoMOOmOoMMMmoOmoOmoOMMMMOOMOomoOMMMMOOMMMMOoMOoMMMOOOmooMMMMoOmOomoomOomOoOOOmoomOomOoMOOMOomoOMoOmOoMMMMOOMMMMOomoOMOomOomOoMoOmoOMMMOOOmooMMMmoomOoMMMOOOmoOMMMmoOmoOmoOmoomoOmoOOOM

Try it online!
A major change! (It's faster but still test cases exceed the 60 seconds timeout on TIO)
Now I like it better, it's cleaner, symmetric and I've brute forced the memory cells disposition for least number of movements.
The idea is to directly operate in terms of parity. Information in both LSB will be used in each iteration and then a and b will be halved, until b=0.

Every a%2 is calculated (during repeated subtraction) alternating +1 and -1 in one memory cell, so that their partial sum p is available.
When a '1' is found in b, the parity (the answer) is toggled p many times.

Detailed Explanation:
moo ]    mOo <    MOo -    OOO *    OOM i
MOO [    moO >    MoO +    MMM =    oom o

[0]: a/2     [1]: a     [2]: Sum(a%2)     [3]: b%2     [4]: b     [5]: b/2     [6]: parity

>i>>>i                        ;  Read a in [1] and b in [5]
[                             ;  Loop while [5] is non-zero
    ><                        ;     Just 2 instructions for free cause COW doesn't handle consecutive parethesis :D
    [                         ;     Loop while [5] is non-zero
        -<+>=[=-<->>+<=*]=    ;         SECTION B
    ]                         ;     [5] is 0, [3] is b%2, [5] is b/2
    >=*<=                     ;     Copy [5] in [4], delete [5]
    <                         ;     Point to [3]
    [                         ;     Loop if [3] is non-zero. '1' it's been found in b, parity gets updated
        <=>>>=                ;         Copy [2] in [5]
        [                     ;         Loop while [5] is non zero
            -                 ;             Decrement [5]
            >=[=--=*]=+<      ;             TOGGLE [6]
        ]                     ;
        <<*                   ;         Delete [3] (to exit the loop)
    ]                         ;
    <<                        ;     Point to [1]
    [                         ;     Loop while [1] is non-zero
        ->+<=[=->-<<+>=*]=    ;         SECTION A
    ]                         ;     [1] is 0, a%2 is added in [2], [0] is a/2
    <=*>=                     ;     Copy [0] in [1], delete [0]
    >>>                       ;     Point to [5]
]                             ;     a's and b's LSB have been treated. Now a=a/2 and b=b/2
>>o                           ;  Print [6]

SECTION A ≈ SECTION B is repeated subtraction that divide \$n\$ (a or b, resp.) by \$2\$.
This can't be done in one single step (i.e. --), because \$0\$ can't be surpassed in order to stop (so it'd be -[- =*]=). These sections contextually produce \$n\bmod 2\$ (LSB).
TOGGLE is a toggling method:
When target is 0 it fails the condition and simply +1 is done.
When target is 1 it passes the condition and it's set to -1 so that +1 on exit makes it 0.
Copy, delete, and paste in the same memory cell is a tecnique to treat a while loop like an if loop, also the seemgly useless copy-paste at the beginning of these (=[=) serves to balance the ending one (=*]=) in case if condition fails.

05AB1E, 11 9 bytes
Port of my Python answer. Takes a and b in reverse order, output is 1 for a odd number of out-of-order pairs, 0 for an even number.
-2 bytes thanks to @CommandMaster !
тÝo÷&bSOÉ

Try it online!
Explanation
Code        Comment                       (Example) Stack

            # implicit input              a, b
т           # push 100                    a, b, 100
 Ý          # inclusive range             a, b, [0,1,...,100]
  o         # 2**x                        a, b, [1,2,...,2**100]
   ÷        # integer divide              a, [b//1,b//2,...,b//2**100]
    &       # bitwise and                 [a&b//1, a&b//2, ..., a&b//2**100]
     b      # convert to binary           [000100, ... , 00101001001, ..., 0]
      S     # convert to a list of chars  ["0", "0", "0", "1", ..., "0"]
       O    # sum (as integers)           4 (number of "out of order pairs")
        É   # is this odd?                0
            # implicit output

10 bytes: žwÝo÷&bSOÉ

9 bytes: тÝo÷&bSOÉ (replaces the 32 with the one char 100 constant)

@CommandMaster thanks a lot

J, 13 bytes
2|[:+/@,>/&I.

Try it online!
Take our input as lists of ones and zeros.

&I. Convert both a and b to a lists of the indexes of the ones.
>/ Create a function table of all pairs of those indexes, where a cell will be 1 when the a index is greater than the b index.
[:+/@, Flatten the table and sum all the ones.
2| Remainder when you divide 2 into that sum.  Will be 1 (true) exactly when the sum is odd.

Python 2, 49 46 bytes
-3 bytes thanks to Arnauld (and Noodle9)!
f=lambda a,b:b and~int(bin(a&b),13)&1^f(a,b/2)

Try it online!

46 bytes by borrowing this trick.

Jelly, 8 bytes
:Ƭ2&BSSḂ

A dyadic Link accepting an integer, \$b\$, on the left and an integer, \$a\$, on the right which yields 0 (even) or 1 (odd).
Try it online! Or see the test-suite.
How?
:Ƭ2&BSSḂ - Link: integer b, integer a
  2      - literal two
 Ƭ       - starting with b, collect up while results are distinct, applying:
:        -   integer division
   &     - bitwise AND (vectorises) with a
    B    - convert to binary (vectorises)
     S   - sum
      S  - sum
       Ḃ - least significant bit (i.e. mod 2)

JavaScript (ES6),  42  39 bytes
Takes input as (a)(b).
Almost identical to ovs' answer.
a=>g=(b,n=a&b)=>n?!g(b,n&n-1):b&&g(b/2)

Try it online!

Charcoal, 19 bytes
ＮθＮη﹪Σ⭆φ⍘＆×θＸ²ιη²¦²

Try it online! Link is to verbose version of code. Outputs - for true, nothing for false. Port of @ovs's Python answer. Works for somewhat more than 32 bits. Explanation:
Ｎθ                  Input `a` as a number
  Ｎη                Input `b` as a number
      ⭆φ            Loop from 0 to 999 and join
          ×θＸ²ι     Left shift `a` that many times
         ＆     η    Bitwise And with `b`
        ⍘       ²   Convert to base 2 as a string
     Σ              Count total number of bits
    ﹪             ² Reduce modulo 2
                    Implicitly print

Retina 0.8.2, 52 bytes
+`.(.*)¶.(.*)$
$&¶¶$1¶$2
(.+¶0|¶1).*¶¶

M`1
[13579]$

Try it online! Takes input in padded binary. Explanation:
+`.(.*)¶.(.*)$
$&¶¶$1¶$2

Generate all of the pairs of suffixes of the inputs.
(.+¶0|¶1).*¶¶

Delete the pairs of suffixes if the suffix of b starts with 0, otherwise just delete the suffixes of b.
M`1

Count the total number of bits of suffixes of a remaining.
[13579]$

Check whether the total is odd.

Io, 88 bytes
Port of the 05AB1E answer.
method(a,b,Range 0 to(100)map(x,((a/2**x)floor&b)asBinary)join removeSeq("0")size isOdd)

Try it online!


text:
Squeezy sequence, sideways sedimentation
Challenge
Premise
I've got multiple pretty numbers all in a row. Each is a decimal digit.
0s are weakly attracted to 0s, 1s are attracted to 1s a little more strongly and so on until 9. I don't know why — it must be something I ate. As a result, a sort of two-way sideways sedimentation occurs until the higher values are closer to the middle and the lower values closer to the sides.
Specifically, this happens:
1) Find all instances of digits having the highest value. If there's an even number \$2p\$ of them, go to step 2a. If there's an odd number \$2q+1\$ of them, go to step 2b.
2a) Consider the \$p\$ instances on the left and the \$p\$ instances on the right. Continue to step 3.
2b) Consider the \$q\$ instances on the left of the middle instance, and the \$q\$ instances on its right. Continue to step 3.
3) Each member of the former subset will move right by swapping places with the digit directly on its right as long as this other digit is smaller, and members of the latter subset will move left in a similar fashion. All such swaps happen simultaneously. If exactly one lower-value digit is enclosed by two high-value digits (one on each side), always move this lower-value digit to the right instead.
4) Repeat step 3 until all digits of this value are directly side-by-side.
5) Repeat steps 1 to 4 for smaller and smaller values until the values are exhausted.
Here's a detailed example.
2101210121012 | begin
1201120211021 | four 2s; the two on the left move right, the two on the right move left
1021122011201 | conflict, resulting in change from 202 to 220 (see step 3); meanwhile,
                 the two other 2s move inwards
1012122012101 | no remarks
1011222021101 | no remarks
1011222201101 | 2s are done
0111222210110 | six 1s, but exactly one on the left of the chain of 2s moves right, and
                 exactly two on the right move left. observe 1s can never pass through 2s
                 because 2 is not smaller than 1 (see step 3)
0111222211010 | no remarks
0111222211100 | end; 1s and 0s are done at the same time

Let's find the end state with the power of automation!
Task
Input: an integer sequence where each element is between 0 and 9 inclusive. The sequence is of length \$3\leq n\leq10000\$.
Output: in any format, the end state that would be reached by following the instructions in the section 'Premise'. Shortcut algorithms that give you the correct answer are allowed.
Examples
Input -> output
0 -> 0
40304 -> 04430
3141592654 -> 1134596542
2101210121012 -> 0111222211100
23811463271786968331343738852531058695870911824015 -> 01111122233333333445556666777888888999887554211100

Remarks

This is code-golf, so fewest bytes wins.
Standard rules, I/O rules and loophole rules apply.
If possible, link an online demo of your code.
Please explain your code.

I'm having trouble following what's going on in the third test case (3141592654 ). From my understanding, the 9,6,4,3, and 2 shouldn't move since there is only one of each. The 5s and 1s shouldn't move because they are blocked by a higher number. Yet the 1s and 2 end up on the edges, can you explain?

Is this equivalent to: move maximum digits together, then sort remaining digits on the left and reverse sort remaining digits on the right, or is that just what has happened to have happened with the chosen test cases?

In the 40304 case the second set of swaps of 4s cant happen simultaneously, it appears you have chosen right-first - is that what we should do or is 03440 also an acceptable output?

@Jonathan Allan, your equivalent interpretation is the same as mine and the output should be identical to following the algorithm above. As for your second question, it should be answered by "If exactly one lower-value digit is enclosed by two high-value digits (one on each side), always move this lower-value digit to the right instead.", in other words 03440 is not allowed

@Jarmex - ah that's when that rule applies - thanks

Just making sure, does 213 becomes 213? If so, I'd suggest that as a test case, since  the result is not "sorted on the left and reverse sorted on the right".

Suggested test case:  8 9 9 7 8 ->  8 9 9 8 7

@SurculoseSputum Based on how the algorithm is presented it would seem that 213 becomes 213. If that were the case, am I right to say that most if not all of the answers fail? And that the test case 3141592654 -> 1134596542 is incorrect also?

JavaScript (ES8), 186 bytes
A direct transformation of the input.
s=>(g=s=>s.join``)([...b=g((a=s.split(n=Math.max(...s)))[S='slice'](0,(k=a[L='length'])/2))+(m=a[k>>1])[S](0,k&1&&m[L]/2)].sort())+''.padEnd(k-1,n)+g([...g(a)[S](b[L])].sort((a,b)=>b-a))

Try it online!

J, 44 42 bytes
(/:~@{.,\:~@}.)~[:(#{2#]<.@-:@+|.)@I.>./=]

Try it online!
The meat of the problem is finding the right point to split the input.
After that, you just sort the left side up and the right side down, and cat them together (/:~@{.,\:~@}.).
We'd like to avoid treating "odd number of max elements" and "even number of max elements" as two special cases.
To do this, notice that given the indices of the max elements (I.>./=]), you can add that list elementwise with its reverse and average each element (]<.@-:@+|.).
Next, duplicate each element of that list in place (2#), and pull from the result the element at index "length of original list" (#{).
All together, this gives us the "midpoint" of the original list, where "midpoint" is defined as "the actual midpoint" in the odd case, and "the average of the two middle-ish" elements in the even case.
This is exactly where the algorithm tells us to split the input.

Jelly, 15 bytes
MÆṁ$ĊœṖ⁸Ṣ€U2¦;/

A monadic link accepting a list (of any orderable items) which yields a list.
Try it online!

Retina 0.8.2, 135 bytes
$
¶¶$`¶
O`\G.
+`((.)¶.*)¶(.*?\2)(.*)(\2.*)¶
$1$3¶$4¶$5
((.)¶.*)¶(.*)\2(.*)¶
$1$3¶$2¶$4
1A`
+`¶(.)(.*)(.)¶
$1¶$2¶$3
2=`¶

%O^`.
O`\G.
¶

Try it online! Link includes test cases. Explanation:
$
¶¶$`¶

Make a working area with a copy of the input surrounded by blank lines.
O`\G.

Sort the digits of the original input.
+`((.)¶.*)¶(.*?\2)(.*)(\2.*)¶
$1$3¶$4¶$5

Move minimal suffixes and prefixes of the copy of the input to the blank lines. Each moved minimal suffix must end with the largest digit and each moved minimal prefix must start with the largest digit.
((.)¶.*)¶(.*)\2(.*)¶
$1$3¶$2¶$4

If there is an odd number of the largest digit, move its exclusive prefix and suffix too.
1A`

Delete the sorted copy of the digits.
+`¶(.)(.*)(.)¶
$1¶$2¶$3

If there was an even number of the largest digit, move individual digits from the remainder of the copy of the input to the prefix and suffix areas.
2=`¶

Move the last digit (if any) or the odd largest digit to the suffix.
%O^`.

Sort both the prefix and the suffix descending.
O`\G.

Reverse the prefix.
¶

Join the prefix and suffix together.

Charcoal, 49 bytes
≔⌕Ａθ⌈θη≔…θ÷ΣＥ²§η÷⁻Ｌηι²¦²η⭆χ×Ｉι№ηＩι⮌⭆χ×Ｉι⁻№θＩι№ηＩι

Try it online! Link is to verbose version of code. Explanation:
≔⌕Ａθ⌈θη

Find all the positions of the maximum digit.
≔…θ÷ΣＥ²§η÷⁻Ｌηι²¦²η

Take the average of the middle two (or the middle position duplicated if there are an odd number of positions) and chop the input to this length.
⭆χ×Ｉι№ηＩι

Sort the chopped input. (Because we know the range of characters, we just repeat each character by the number of times it appears in the desired string.)
⮌⭆χ×Ｉι⁻№θＩι№ηＩι

Calculate the number of each digit remaining to give the sorted remainder, and then print that reversed so that the sort is descending.


text:
Infinite Snake game
Infinite Snake is just like the video game Snake, except for that the snake is infinitely long, there are no items to eat, and the Snake needs to move in a repeating n-step move pattern (e.g. right, up, right, up, right, down). The only constraint is that you can't crash back into yourself.
Challenge
Your goal is to write code that counts the number of valid move patterns of length n, where two patterns are considered the same if you can get from one to the other through a series of rotations, reflections, and reversals.
This is a code-golf challenge, so the shortest code in bytes wins.

Origin
This sequence is based on the On-Line Encyclopedia of Integer Sequence's lastest "nice" sequence, A334322.

Number of endless self-avoiding walks of length n for the square lattice.

An "endless self-avoiding walk" (i.e., valid move pattern) is defined in the paper Endless self-avoiding walks by Nathan Clisby on the arXiv. Roughly speaking, an \$n\$-step self-avoiding walk (in the usual sense) is called endless if you can concatenate it with itself head-to-tail an infinite number of times and remain self-avoiding.
Example
For example, Figure 2.1 in the paper gives an example of an endless self-avoiding walk (of length six) on the left and a non-example on the right.

Small test cases
f(1) = 1:
---->

f(2) = 2:
---->----> and ---->
                   |
                   v

f(3) = 3:
---->---->---->, ---->---->, and ---->
                          |          |
                          v          v---->

f(4) = 7:
---->---->---->---->, ---->---->---->, ---->---->     ,
                                    |           |
                                    v           v---->

---->---->, ---->    ^, ---->     , and ---->     .
         |      |    |      |               |
         v      v---->      v---->          v
         |                       |          |
         v                       v          v---->

More small values:
 f(5) =   16
 f(6) =   39
 f(7) =   96
 f(8) =  245
 f(9) =  631
f(10) = 1642

Is our code expected to (theoretically) work for any n? Or is there a maximum n that we are expected to support?

It should work for any n given arbitrary RAM and time.

If so, can we assume infinite data types?

Hmm... A self-avoiding walk takes social distancing to the next level!

You’re welcome to return the values as an infinite data type such as a stream. You can also write a function that takes n and returns the first n values. You can also write a function that takes n and returns the n-th term. If there’s some other reasonable structure you have in mind, that should work too.

Mathy titles are scary. You'd probably get more views if it was talking about a drunk man trying to find pubs he has not already visited by repeating the same walk over and over. :-p (I'm saying that tongue-in-cheek, but there's some truth in there...)

Rebranded just for you, @Arnauld!

This is on OEIS as https://oeis.org/A334398.

@PeterKagey In my opinion the OEIS link should be in the challenge not in the comment section. You can even say that this entry was made because of this challenge (if this is the case).

JavaScript (ES6), 240 bytes
Returns the \$n\$-th term of the sequence.
f=(n,p=[],s=[])=>n?[-1,0,1,2].map(d=>f(n-1,[...p,[d%2,~-d%2]],s))|N:N=[...p,...p].every(o=([h,v])=>o[[n+=h,y+=v]]^=1,y=0)&&s.every(P=>(g=j=>!j||P.reverse().some(([h,v],i)=>(j&4?h:-h)-p[i][j&1]|(j&2?v:-v)-p[i][~j&1])&g(j-.5))(8))?s.push(p):N

Try it online!
A334322 (133 bytes)
This is a version where the tests on symmetries of the square and reversals of the path have been removed. So, it generates A334322 instead.
This is just meant as a verification of the main algorithm.
f=(n,p=[],s=[])=>n?[-1,0,1,2].map(d=>f(n-1,[...p,[d%2,~-d%2]],s))|N:N=[...p,...p].every(o=([h,v])=>o[[n+=h,y+=v]]^=1,y=0)?s.push(p):N

Try it online!
Commented
Main algorithm
This is the main algorithm, which generates A334322.
f = (               // f is a recursive function taking:
  n,                //   n = input
  p = [],           //   p[] = current path as a list of (dx, dy)
  s = []            //   s[] = array of solutions
) =>                //
  n ?               // if n is not equal to 0:
    [-1, 0, 1, 2]   //   list of directions
    .map(d =>       //   for each direction d:
      f(            //     do a recursive call:
        n - 1,      //       decrement n
        [           //       new path:
          ...p,     //         copy all previous entries
          [         //         add a new pair (dx, dy):
            d % 2,  //           with dx = d mod 2
            ~-d % 2 //           and dy = (d - 1) mod 2
          ]         //           (NB: sign of mod = sign of dividend)
        ],          //       end of new path
        s           //       pass s[] unchanged
      )             //     end of recursive call
    ) | N           //   end of map(); yield N
  :                 // else:
    N =             //   update N:
      [...p, ...p]  //     append the path to itself
      .every(o =    //     o is an object used to store the positions
        ([h, v]) => //     for each (h, v) = (dx, dy):
        o[[         //       update o for the new position:
          n += h,   //         add dx to n
          y += v    //         add dy to y
        ]] ^= 1,    //       if a position was already visited, this XOR gives 0
        y = 0       //       start with y = 0 (we already have n = 0)
      ) ?           //     end of every(); if the path is self-avoiding:
        s.push(p)   //       push it into s[]
      :             //     else:
        N           //       leave N unchanged (see the note below)

Note: The first iteration always leads to a valid straight path. Because of that, \$N\$ is guaranteed to be defined when we encounter an invalid path for the first time. (Otherwise, this N = N could be a problem, as \$N\$ is not explicitly defined anywhere else.)
Additional tests
Below are the additional tests that are performed to detect symmetries of the square and reversals of the path.
There are \$16\$ different tests whose parameters depend on the bits of a counter \$j\$ going from \$8\$ to \$0\$. We subtract \$1/2\$ from \$j\$ between each iteration so that each set of parameters is tested twice: once with the path \$P[\:]\$ reversed and once with \$P[\:]\$ put back in the original order.
s.every(P =>             // for each previous path P[] in s[]:
  ( g = j =>             //   g is a recursive function taking a counter j:
    !j ||                //     success if j = 0
    P.reverse()          //     otherwise, reverse P[]
    .some(([h, v], i) => //     for each (h, v) at position i in P[]:
      (j & 4 ? h : -h)   //       compare either h or -h with
      - p[i][j & 1] |    //       either p[i][0] or p[i][1]
      (j & 2 ? v : -v)   //       compare either v or -v with
      - p[i][~j & 1]     //       the other component of p[i]
    ) &                  //     end of some()
    g(j - .5)            //     do a recursive call with j - 1/2
  )(8)                   //   initial call to g with j = 8
)                        // end of every()

The same day you answered this question, this entry was made https://oeis.org/A334398. I think you should be credited for these numbers and any other entries in OEIS by Mr. Kagey


text:
How annoying is my Euler diagram?
Challenge
Premise
Euler diagrams consist of simple closed shapes in a 2-D plane that each depict a set or category. How or whether these shapes overlap demonstrates the relationships between the sets.
I'm a spoilt brat who thinks Euler diagrams are hard to draw. For any Euler diagram, I want to know the minimum number of points where the perimeters of two shapes intersect. Here's an example:

The Euler diagram drawn above represents a relationship where:

foo and bar are disjoint.
All baz are foo but not vice versa.
Some qux are baz; some qux are foo but not baz; and some qux are bar.
Not all baz are qux; not all non-baz foo are qux; and not all bar are qux.

In this particular example you can't do better than a whopping six crossings, but that's life.
Task
Input: a sequence of multiple integers as follows.

An integer, say \$A\$, which designates a set.
An integer, say \$m\$. This means 'the set designated by \$A\$ is a proper subset of the following \$m\$ sets'.*
\$m\$ integers (except if \$m=0\$), each designating a set.
An integer, say \$n\$. This means 'the set designated by \$A\$ is equivalent to the following \$n\$ sets'.*
\$n\$ integers (except if \$n=0\$), each designating a set.
An integer, say \$p\$. This means 'the set designated by \$A\$ is a proper superset of the following \$p\$ sets'.*
\$p\$ integers (except if \$p=0\$), each designating a set.*
An integer, say \$q\$. This means 'the set designated by \$A\$ contains part but not all of each of the following \$q\$ sets'.*
\$q\$ integers (except if \$q=0\$), each designating a set.
Repeat the above until the whole system is defined.

The input format isn't fixed. The Python dict or JS object, for example, would be just as good - in such cases, the starred (*) lines wouldn't be so necessary.
Please note that the input is guaranteed not to produce 'exclaves' (as in this image, namely 'Centaurs').
Output: the minimum number of crossings, of the perimeters of two shapes, in the Euler diagram.
Example 1
Input, with bracketed remarks for your benefit:
1 (Consider the set designated by 1.)
0   (It's not a proper subset of anything.)
0   (It's equivalent to no other set.)
1   (It's a proper superset of:)
3     (the set designated by 3.)
1   (It; the set designated by 1; contains part but not all of:)
4     (the set designated by 4.)
2 (Consider the set designated by 2.)
0   (It's not a proper subset of anything.)
0   (It's equivalent to no other set.)
0   (It's not a proper superset of anything.)
1   (It contains part but not all of:)
4     (the set designated by 4.)
3 (Consider the set designated by 3.)
1   (It's a proper subset of:)
1     (the set designated by 1.)
0   (It; the set designated by 3; is equivalent to no other set.)
0   (It's not a proper superset of anything.)
1   (It contains part but not all of:)
4     (the set designated by 4.)
4 (Consider the set designated by 4.)
0   (It's not a proper subset of anything.)
0   (It's equivalent to no other set.)
0   (It's not a proper superset of anything.)
3   (It contains part but not all of:)
1     (the set designated by 1,)
2     (the set designated by 2 and)
3     (the set designated by 3.)

Output: 6
This example exactly matches the one in the section 'Premise' (set 1 would be foo, 2 bar, 3 baz, 4 qux).
Suppose we want to have the input be like a JS object instead. A possibility is:
{
 1:[[],[],[3],[4]],
 2:[[],[],[],[4]],
 3:[[1],[],[],[4]],
 4:[[],[],[],[1,2,3]]
}

Example 2
Input: 1 0 0 1 2 1 3 2 1 1 0 0 1 3 3 0 0 0 2 1 2
Output: 4
Please see here.
Suppose we want to have the input be like a JS object instead. A possibility is:
{
 1:[[],[],[2],[3]],
 2:[[1],[],[],[3]],
 3:[[],[],[],[1,2]]
}

Remarks

This is code-golf, so fewest bytes wins.
Standard rules, I/O rules and loophole rules apply.
If possible, link an online demo of your code.
Please explain your code.

Q: You didn't say how to find the answer. How do I do it? A: Carefully.

Q: You didn't say how to find the answer. How do I do it? A: By yourself.

Interesting problem! 1) Please consider relaxing the input format (e.g I might want to use a dictionary, where each set number is mapped with 4 lists of numbers). 2) More test cases would be greatly appreciated, especially in this problem where the algorithm is not obvious.

@SurculoseSputum Hope the latest edit (2020-04-26T09:34Z) helps.

I thought these were Venn diagrams..?

@RGS The main difference between Venn and Euler diagrams is that a Venn diagram shows all possible logical relationships between sets, whilst an Euler diagram only shows existing relationships. http://denis1251.blogspot.com/2016/06/the-difference-between-venn-diagram-and.html

MATLAB - 109 Bytes
Try it online
function n=E(s)
i=2;k=1;n=0;while i<numel(s)
k=mod(k,4)+1;n=n+s(i)*((k==1)-(k==3)/2);i=i+s(i)+1+(k<2);end

ungolfed:
function n=E(s)             % function def, input 2 and output n
i=2;                        % sequence index
k=1;                        % 1=sub,2=equivalent,3=super,4=part
n=0;                        % initialized output
while i<numel(s)            % Loop through sequence
k=mod(k,4)+1;               % if k==4, then a new set has started, so back to 1.
n=n+s(i)*((k==1)-(k==3)/2); % s(i) represents n,m,p,q
                            % If k==1, then s(i)=q, so add s(i) to n.
                            % If k==3, s(i)=m, so subtract s(i)/2 from n.
i=i+s(i)+1+(k<2);           % Advance index by (n,m,p,q) and 1 if k==1 (aka k<2) to skip set number definition.
end                         % end

Explanation:
This may be a naive approach, but from what I see, the only way to have a perimter intersection is when you have a set as a part of another.
For super/subsets, there will be no perimeter intersections, since they will be concentric.
For sets that match exactly, there will only be one shape that represents two sets, so there are no perimeter crossings between them.
Therefore, the only time you can have an overlap is for parts. From there it is simple: every crossing includes two points, since by the nature of overlapping rectangles, there will be two and only two intersections of the perimeters. And since the sets that contain parts of another must reference each other (i.e. if set 1 and 2 overlap, set 1 will have 2 in its part input, and 2 will have 1), there will be 2*(number of sets that are part of another). However, sets that are exactly equal only produce one shape, so any crossings between this shape and another must be reduced according to the number of sets that are equivalent. Thus, the sum of the number of elements that fall into the "parts" category across all sets equals the number intersections.
Mathematically,
For \$k\$  sets
\$ n_{crossings} = \displaystyle \sum_{i=1}^k(q_i - m_i/2) \$


text:
Hamming distance traveling salesman problem
The Hamming distance between two strings is the number of positions they differ at.
You are given a set of binary strings. The task is to find the length of the shortest route that visits all of them at least once and ends where it started, in a metric space where the distance between two strings is the Hamming distance between them.
Let \$N\$ be the number of input strings and the string length. There are 3 test cases for every \$N\$. The strings are created from random bits  obtained from an acceptable random number generator. A RNG is acceptable if I can replace it with a RNG I like more without significantly affecting the program's performance.
A program's score is the largest \$N\$ it can correctly solve all 3 tests for within 60 seconds. The higher the score, the better. Answers with equal scores are compared by posting time (older answer wins).
Submissions will be timed on a PC with an (12-thread) AMD Ryzen 2600 CPU and a (cheap but relatively modern) AMD Radeon RX 550 GPU.
Programs must solve tests in order - that is, they must output the answer for the current test before generating the next one. This is unobservable, but it could be made observable at the cost of simple IO requirements (imagine me supplying an external RNG that asks you for the outputs).
This problem is proven NP-complete.
Short explanation of the proof: take rectilinear (\$|\Delta x| + |\Delta y|\$) integer TSP and replace \$x\$ by a string with \$x\$ ones and \$[\text{something}] - x\$ zeroes, same for \$y\$; repeat strings until their count is equal to their length.

Deleted sandbox post

You should ask for programs that take input and provide a specific RNG with a fixed seed, rather than just asking us to imagine that you did so. Like most NP-complete problems, TSP has easy cases and hard cases, and you don’t want programs to win just because they are lucky.

I am interested in programs that perform the best in the average case, so I use 3 random test cases and mention that you must use a proper RNG.

You will not get what you're interested in with a vague criterion like that. If answers can choose between a wide variety of RNGs and seeds, then submitters will be encouraged to re-run their program zillions of times until they find a favorable one. Or they will submit a non-deterministic program whose results can't be reproduced. You might decide that some of these break the rules, but it's really unclear where to draw the line. On the other hand, if you just specify a generator with a fixed seed, everything is clear and you'll get a better approximation of average behavior.

I can't see how that is vague.