text:
Perfect scores in Martian rules football
Story
Martians have been observing Aussie rules football matches from space with great curiosity. Having totally fallen in love with the game, they have been inspired to start their very own football league. However, being dim-witted creatures, they are unable to comprehend the scoring system.*
We know that in Aussie rules, a goal is worth 6 points (\$G=6\$) and a behind is worth 1 point (\$B=1\$). The Martians are cluey enough to work out that there are two types of scores, but not smart enough to realise that they can deduce the point values of these scores by analysing match outcomes. Undeterred, the International Olympus Mons Committee decrees that in all Martian rules football matches, the point values for goals and behinds (i.e. \$G\$ and \$B\$) will be chosen at random.
'Perfect' scores
When \$G = 6\$ and \$B = 1\$ (as in Aussie rules), there are exactly four integer pairs \$[g,b]\$ such that a team with \$g\$ goals and \$b\$ behinds has a score of \$gb\$ points. We will refer to \$[g,b]\$ pairs that satisfy $$gG+bB=gb$$ as perfect scores. The four perfect scores in Aussie rules are
\$[g,b]=[2,12]\$, \$[3,9]\$, \$[4,8]\$, and \$[7,7]\$.
Challenge
Given two strictly positive integers \$G\$ and \$B\$ representing the point values of goals and behinds in a Martian rules football match, write a program or function that determines all possible perfect scores for that match. Rules:

Input may be taken in any convenient format (pair of integers, list, string, etc.). You may not assume that \$G>B\$.
Output may also be in any format, provided that the \$[g,b]\$ pairs are unambiguously identifiable (e.g. successive elements in a list or string). The order of pairs does not matter. You may output pairs in \$[b,g]\$ order instead provided that you state this in your answer. You may not output the total scores (the products \$gb\$) instead, because in general there are multiple non-perfect ways to achieve the same total score.
Your program/function must terminate/return in finite time.

This is code-golf: the shortest submission (in bytes) in each language wins.
Test cases
Input -> Output
[6, 1] -> [[2, 12], [3, 9], [4, 8], [7, 7]]
[6, 2] -> [[3, 18], [4, 12], [5, 10], [6, 9], [8, 8], [14, 7]]
[1, 1] -> [[2, 2]]
[1, 6] -> [[7, 7], [8, 4], [9, 3], [12, 2]]
[7, 1] -> [[2, 14], [8, 8]]
[7, 5]  -> [[6, 42], [10, 14], [12, 12], [40, 8]]
[13, 8] -> [[9, 117], [10, 65], [12, 39], [16, 26], [21, 21], [34, 17], [60, 15], [112, 14]]

* This problem never, ever, occurs on Earth.

@Λ̸̸ No - inspired by missing my footy fix. Both challenges do have a common link to Aussie rules but they're not really similar otherwise.

This problem never, ever, occurs on Earth. That's bold of you to assert that statement... I'm Australian and I sometimes struggle to comprehend our own scoring methods.

@Lyxal If you're Australian, do you know why they invented these incomprehensible scoring methods in the first place?

Absolutely not. No one really knows.

However, being dim-witted creatures, they are unable to comprehend the scoring system. How are they dim-witted, given they've invented such a powerful telescope!?

@Lyxal , I can guess the complex rules were invented for the same reasons as the 'Offside' rule in soccer - so men can discuss about sports and their wifes don't understand it (men are not bothered as much by the fact that they don't really understand it - each one is sure he got it right).

05AB1E, 10 bytes
>PLãʒ*OyPQ

Try it online or verify all test cases.
Explanation:
>           # Increase both values in the (implicit) input-pair by 1
 P          # And take the product of those
  L         # Pop and push a list in the range [1, (G+1)*(B+1)]
   ã        # Create all possible pairs by taking the cartesian product with itself
    ʒ       # Filter those pairs [g,b] by:
     *      #  Multiply it with the (implicit) input-pair at the same positions:
            #   [G,B] * [g,b] will result in [Gg,Bb]
      O     #  Sum those: Gg+Bb
       yP   #  Take the product of the current pair: gb
         Q  #  And check that both values are the same: Gg+Bb == gb
            # (after which the result is output implicitly)

The last test case no longer times out by using an upper bound of \$(G+1)\times(B+1)\$ instead of my initial \$(2^G+2^B)\$ (byte count remains the same). Make sure to upvote @SurculoseSputum's Python answer for providing this mathematical upper bound.

Python 2, 85 81 78 bytes
G,B=input()
R=range(~G*~B)
print[(g,b)for g in R for b in R if g*G+b*B==g*b>0]

Try it online! or Check all test cases!
A program that reads 2 integers G, B from STDIN, and prints to STDOUT all pairs of g,b.
The upper bounds of \$g\$ and \$b\$ are:
$$g \leq B(G+1)$$
$$b \leq G(B+1)$$
or as used in the program: \$ g, b < (G+1)(B+1) \$
This is derived as follow:
$$ gG + bB = gb $$
$$ g(b-G) = bB $$
$$ \frac{g}{B} = \frac{b}{b-G} $$
$$ \frac{g}{B} = 1 + \frac{G}{b-G} \leq 1 + G $$
$$ g \leq B(1 + G) $$

Python 2, 58 bytes
lambda G,B:[(i+B,G*B/i+G)for i in range(1,G<<B)if G*B%i<1]

Try it online!
We can write \$gG+bB=gb\$ as $$(g-B)(b-G)=GB,$$
that is, \$ij=GB\$ with $$g=i+B$$ $$b=j+G$$ So, the outputs \$(g,b)\$ are just the divisor pairs \$(i,j)\$ multiplying to \$GB\$, but shifted up by the input values:
$$(g,b)\in\{(i+B,j+G) \mid ij=GB; \thinspace i,j\in \mathbb{Z}^{+}\} $$
Note that negative \$(i,j)\$ are not included because they produce a negative \$g\$ or \$b\$.
The code is mostly straightforward, iterating over all potential factors \$i\$ of \$GB\$, taking those that are exact divisor, to produce the \$(g,b)\$ given by the formula. We could have looped over both \$i\$ and \$j\$ and take those with \$ij=GB\$, but the length of writing a second loop makes this unviable in Python, though other languages may prefer this option.
We need to test all potential divisors \$i\$ in the closed interval \$[1,GB]\$, excluding zero to avoid a modulo-by-zero error. For the half-open upper bound for range, we write G<<B to make some value strictly bigger than \$GB\$, noting that \$G \cdot 2^B \geq G(B+1) > GB \$. Despite this clunky range call, it seems longer to replace the iteration by a recursive function.
As a program:
Python 2, 60 bytes
G,B=input()
P=i=G*B
while i:
 if P%i<1:print i+B,P/i+G
 i-=1

Try it online!

Python 3.8 (pre-release), 59 bytes
A recursive port of the below.
def f(G,B,i=1):m=G*B;m%i or print(i+B,G+m/i);i<m<f(G,B,i+1)

Try it online!
Python 2, 64 60 bytes
Takes the two integers \$ G \$ and \$ B \$ as input, and outputs the integer solutions in \$ [g, b] \$ order, each on a new line.
G,B=input()
n=m=G*B
exec'if m%n<1:print n+B,G+m/n\nn-=1\n'*n

Try it online!
We first isolate \$ b \$, giving us:
$$ gG + bB = gb $$
$$ gG = gb - bB $$
$$ gG = b(g - B) $$
$$ \frac{gG}{g - B} = b $$
All we need to do now is find values of \$ g \$ that produce a positive integer solution when plugged into the formula. We also get that \$ g \leq B + GB \$ from
Surculose Sputum's answer, and that \$ B < g \$, otherwise it would produce a negative solution because of the denominator.
One thing which I did in my program is subtract \$ B \$ from \$ g \$. The formula then becomes
$$ \frac{(g + B)G}{g} $$
and the inequality becomes \$ 0 < g \leq GB \$. This change turned out to slightly improve the byte count.

Charcoal, 32 30 27 bytes
ＩＥΦΠθ¬﹪Πθ⊕ι⟦⁺⊕ι§θ¹⁺÷Πθ⊕ι§θ⁰

Try it online! Link is to verbose version of code. Takes input as a list. I converted my 30 byte version (below) to take input as a list, which ends up making it behave like @xnor's answer. Explanation:
   Πθ                       G*B
  Φ                         Filter over implicit range
         ⊕ι                 g-B
     ¬﹪                     Divides
       Πθ                   G*B=G*g-G*(g-B)
 Ｅ                          Map over filtered values
           ⟦                Tuple of
            ⁺⊕ι§θ¹          (g-B)+B=g
                  ⁺÷Πθ⊕ι§θ⁰ G*B/(g-B)+G=G*g/(g-B)=b
Ｉ                           Cast to string
                            Implicitly print

Previous 30-byte version:
ＮθＮηＩＥΦ…·¹×ηθ¬﹪×ηθι⟦⁺ιη÷×⁺ιηθι

Try it online! Link is to verbose version of code. The lower bound for g is B+1 and the upper bound (as independently calculated by @SurculoseSputum) is B(G+1) so it simply remains to calculate those values where b is an integer. Explanation:
ＮθＮη

Input G and B.
ＩＥΦ…·¹×ηθ

Loop i from 1 to BG. This is equivalent to looping g from B+1 to B(G+1), where g=i+B.
¬﹪×ηθι

Filter on b being an integer. Edit: Saved 2 bytes by checking whether i divides GB rather than whether b=gB/i=(G+i)B/i is an integer.
⟦⁺ιη÷×⁺ιηθι

Output g and b.

C (gcc), 84 bytes
b;g;f(B,G){for(b=0;++b<~B*~G;)for(g=0;++g<~B*~G;b*B+g*G-b*g||printf("%d %d ",b,g));}

Try it online!
Prints out the values of \$b\$ and \$g\$ separated by spaces.
Uses the upper bounds for \$b\$ and \$g\$ as calculated by Surculose Sputum in his Python answer.

Pyth, 17 bytes
fq*FTs*VTQ^Sy*FQ2

Try it online!
Port of @KevinCruijssen's 05AB1E Answer, with a few modifications to make it more suitable for Pyth.
In particular, the upper bounds of
$$g \leq B(G+1)$$
$$b \leq G(B+1)$$
from @SurculoseSputum's answer have been used to derive that:
$$g,b \leq 2GB$$
fq*FTs*VTQ^Sy*FQ2
            y*FQ    Multiply G and B, then multiply by 2
           S        Range( 1, 2*GB )
          ^     2   Cartesian product of that range with itself
f                   Filter for elements (g,b) satisfying:
  *FT                g*b
 q                    equals
     s*VTQ            G*g + B*b

Bonus: Port of @xnor's Python answer (21 bytes)
AQVSJ*GHI!%JN+NH+G/JN

Try it online!
Outputs each pair g,b on two separate lines. I find this solution amusing because it contains only uppercase letters and operators.

Erlang (escript), 61 bytes
Boring port of the Python answer. (To get me started.)
f(G,B)->[[I+B,G*B/I+G]||I<-lists:seq(1,G bsl B),G*B rem I<1].

Try it online!


text:
Rubik's Snakes! (Part 1)
The Rubik's Snake (or Rubik's Twist) is a toy consisting of several triangular prisms strung together in a line in such a way that the pieces can be rotated about one another in 90 degree turns.

Any snake can be described by an ordered sequence of rotations (format described below). Some sequences do not describe physically possible, "valid", snakes because they would cause the pieces to self-intersect. Some sequences describe "cyclic" snakes, which happens when the open square faces of the first and last piece of the snake meet.
Given a sequence of rotations, your task is to output whether the snake is "valid" and output whether the snake is "cyclic".
Input
A sequence of length n-1 describes a snake with n pieces. The index of the sequence describes the state of the interface between two pieces at that index, i.e., how those two pieces are rotated. Any alphabet with 4 letters can be used to describe the possible rotations.
Here we will use:

0 - No rotation
1 - 90 degree rotation
2 - 180 degree rotation
3 - 270 degree rotation

Note that this implies some chirality. For the demos below I use a left-hand rule but the choice is arbitrary as long as you are consistent.
Here are some basic examples:
00000000000 - A straight, unfolded Rubik's Mini Snake (12 pieces)

0220 - A simple 5 piece snake

11111111111111111111111 - A Rubik's Snake (24 pieces) consisting only of 90 degree clockwise turns

13131 - A "cyclic" snake that mixes clockwise and counterclockwise turns

20220200022020020220002 - A classic Rubik's Snake dog design without symmetry

222 - The shortest "cyclic" snake

13133311131333111313331 - A more elaborate "cyclic" design on the Rubik's Snake

0022200 - Not a "valid" snake because it self-intersects

00031310000 - A more elaborate invalid snake

0003131000313 - Snakes which are not "valid" may still be "cyclic"

2222222 - Another invalid snake which is still  "cyclic" (deceptively similar to 222, which is valid)

The first image is the "Twin Peaks" pattern as found on Wikipedia (the pattern was found there, the images here are my original work). It is described by 10012321211233232123003 and is both "valid" and "cyclic".
Finally, a bonus 240 piece Rubik's Snake (yes, they actually sell these) 01113133131131331311313330020013000000310000003100000013000000130022031000013211001302020031002203100001300001300003121102022011001300130031001300310031001121300003323100000013211000031000031000220000130000003100000031002022022031233213002

Caveats

By default, the input is a string consisting of 0s, 1s, 2s, and 3s
Must be able to handle all sequences of length 3 or greater (n >= 4)
If it is more practical or golf-able to handle a list of characters or a list of integers 0 thru 3, you may do so as long as it is consistent. Just be sure to specify in your answer.

Output
Given a sequence as described above, your program should ouput whether the sequence describes a snake that is:

"valid" and "cyclic" ([true, true])
"valid" but not "cyclic" ([true, false])
not "valid" but "cylcic" ([false, true])
not "valid" and not "cyclic" ([false, false])

Caveats
The format of your output need not be exactly [bool, bool], as long as:

There are exactly 4 possible outputs
Each possible output uniquely corresponds exactly 1-to-1 with [true, true], [true, false], [false, true], [false, false] for [valid, cyclic]
Your chosen format is consistent for each input
Standard loopholes. Ask for clarification in comments

For example, if you want your outputs to be "alice", bob, 37, [], you may do so as long as you specify what that means in your answer.
Examples
INPUT=====================+=OUTPUT==========
Sequence                  | Valid  | Cyclic
==========================+========+========
00000000000               | true   | false
0220                      | true   | false
11111111111111111111111   | true   | false
13131                     | true   | true
20220200022020020220002   | true   | false
222                       | true   | true
13133311131333111313331   | true   | true
0022200                   | false  | false
00031310000               | false  | false
0003131000313             | false  | true
2222222                   | false  | true
10012321211233232123003   | true   | true
                          |        |
0111313313113133131131333 |        |
  00200130000003100000031 |        |
  00000013000000130022031 |        |
  00001321100130202003100 |        |
  22031000013000013000031 | true   | true
  21102022011001300130031 |        |
  00130031003100112130000 |        |
  33231000000132110000310 |        |
  00031000220000130000003 |        |
  10000003100202202203123 |        |
  3213002                 |        |
==========================+========+========

This is code-golf, so shortest answer wins!

I think this is my favorite question I've ever seen on Code Golf Stack Exchange! Did this problem come up in some application you were working on? And how'd you generate the rotating models?

The backstory is that my co-worker had a Rubik's Mini Snake on his desk, which got me wondering how many cyclic solutions there are. So out of curiosity, I did the work to figure it out and animate all of the solutions for a video. If I did it correctly, there are exactly 70 cyclic solutions to the mini (12 piece) snake once you remove all symmetries. Rotating models made using OpenSCAD and Image Magick. You can see a deeper explanation, code sample, and video links here: https://github.com/scholtes/snek

You say that there's a unique cycle for snakes of length $4$, but I imagine your program can also handle snakes of $n=6, 8, 10$, etc? This would make a lovely OEIS sequence if it's not already on there.

Python 2, 217 212 198 194 bytes
from numpy import*
A=any
d,t,_=eye(3)
p=b=t
v=0
S=[]
for m in input():S+=(p,d,t),;exec"t=cross(t,d);"*m;p,d,t=p+d,t,d;v|=A([all(p==P)*A([d+D,t+T])*A([d-T,t-D])for P,D,T in S])
print v,A([p,d-b])

Try it online! or Verify all test cases!
-6 bytes thanks to @dingledooper!
Input: A list of integers from STDIN
Output: A number and a boolean, printed to STDOUT.
The number is 0 if the snake is valid, 1 otherwise.
The boolean is False if the snake is cyclic, True otherwise.
Big idea:
Each snake piece fits exactly into half of a unit cube in a 3D grid. There are 12 possible orientations of a piece, corresponding to 6 ways of slicing a cube in half diagonally.
Thus, each snake piece can be characterized by the x, y, z coordinates of the cube containing it, and the orientation of the piece within the cube.
Now that we have a way to store each piece's info, we can build the snake, then detect self-intersection and cycle.
If 2 pieces occupy the same cube, they intersect unless the 2 pieces are exactly opposite of each other in the cube:

Example orientations that can coexists within the same cube. Image taken from here
Details
Snake building
A simple way to characterize the orientation of a piece is with 2 directions: the  "in" direction \$t\$, and "out" direction \$d\$. \$d\$ and \$t\$ are always axis-aligned (since they are always perpendicular to a face of a cube).

For each piece, we store the cube position \$p\$ and the 2 directions \$d, t\$. This makes it easy to figure out the position and orientation of the next piece. Consider the piece \$(A)\$ in the figure above. If the move is \$0\$ (no turn), then the next piece will be \$(B)\$. If the move is \$(1)\$ (90 degree turn), then the next piece will be \$(C)\$. We can see that if the current piece is \$(p_1, d_1, t_1)\$ and the number of turns is \$m\$, then the next piece is:
$$ p_2 = p_1 + d_1 $$
$$ t_2 = d_1 $$
$$ d_2 = t_1 \text{ rotated } m \text{ times around } d_1 $$
Cycle detection
If the snake is cyclic, then the last and first piece must be connected. This means that the "out" direction of the last piece must be the same as the "in" direction of the first piece, and their coordinates must be adjacent in that direction.
If the first piece has the default value: \$p=(0,0,0), t=(0,1,0)\$, then the last piece must have the value: \$p=(0,-1,0), d=(0,1,0)\$.
Self-intersection detection
If 2 pieces intersect each other, then the following must be true:

They are in the same cube: \$p_1 = p_2\$
Their orientations are not opposite of each other.

The orientations of 2 pieces are opposite of each other when one of the following happens:

\$d_1 = -d_2\$ and \$t_1 = -t_2\$
or \$d_1 = t_2\$ and \$t_1 = d_2\$

+1 awesome work. I saw this answer before the explanation was added and was very curious. It looks like your model for determining the vectors of rotation is much more straightforward than mine, this is a glimpse of my original model: https://i.imgur.com/WkNyWTb.png

source: Stack Exchange

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

sort: votes


text:
Generate Gmail Dot-Aliases
Background
You may be aware that periods in between letters in gmail addresses are ignored. Email sent to example@gmail.com, exam.ple@gmail.com, and e.x.a.m.p.l.e@gmail.com all end up in the same place!
This is a great way to have multiple different emails addresses for things like signing up for free trails, or filtering mail from different website. We will refer to gmail address aliases created in this way as dot-aliases.
The Task
Write a program to generate all possible dot-aliases of a given Gmail address.
Input
A Gmail address as a string. You may choose whether or not the "@gmail.com" part is included in the input. The maximum length of a Gmail ID (the part before the '@') is 30 characters (not including dots). The minimum is 6 characters. You may assume the input will not already include any dots.
For more details on gmail ID requirements: https://support.google.com/mail/answer/9211434?hl=en
Output
All of the dot-aliases, in any order, with no duplicates. This can mean printing them to stdout, writing to a file, returning them in a container, returning a iterator, etc. The output must contain the "@gmail.com" suffix. You may choose whether or not to include the original input address in the output.
Scoring
Code Golf here, solution with fewest bytes wins. In the event of a tie, the code who's least common character has the highest number of occurrences wins. In the event of a double tie, earliest timestamp wins.
Example:
Input:
abcabc@gmail.com
or
abcabc
(you pick)

Output:
a.bc.a.bc@gmail.com
a.b.cab.c@gmail.com
abc.ab.c@gmail.com
ab.cabc@gmail.com
a.b.cabc@gmail.com
ab.c.abc@gmail.com
a.b.c.abc@gmail.com
abc.a.bc@gmail.com
a.b.ca.b.c@gmail.com
abc.a.b.c@gmail.com
a.bc.a.b.c@gmail.com
a.bcabc@gmail.com
ab.c.a.b.c@gmail.com
a.b.c.a.b.c@gmail.com
a.b.c.ab.c@gmail.com
ab.c.a.bc@gmail.com
a.b.c.a.bc@gmail.com
abcab.c@gmail.com
a.bcab.c@gmail.com
ab.cab.c@gmail.com
a.bc.ab.c@gmail.com
ab.c.ab.c@gmail.com
abca.b.c@gmail.com
a.bca.b.c@gmail.com
ab.ca.b.c@gmail.com
abca.bc@gmail.com
a.bca.bc@gmail.com
ab.ca.bc@gmail.com
a.b.ca.bc@gmail.com
abc.abc@gmail.com
a.bc.abc@gmail.com
abcabc@gmail.com (optional)

-8% Byte Bonus: Even though the longest Gmail ID is 30 characters, the maximum length for any valid email address prefix is 64 characters. Make your program work for input up to 64 characters before the '@', but ensure output is also limited to 64 characters before the '@'.

Gmail is weird.

Is it possible for a dot-alias to have a dot as its first or last character? (The example assumes not, and I presume it's not possible in reality either.)

No, it must be surrounded by other characters not including the @. Also, you cannot have two dots in a row.

Among things to avoid when writing challenges, are bonuses in code golf.

Can we assume the input doesn't contain spaces?

Please avoid adding unnecessary fluff, like having to append "@gmail.com".

I think your last (optional) output line is missing abc

example+whatever at gmail dot com would also be an alias... if i remember correctly.

@tsh Indeed, but not a "dot alias" as defined by OP here.

@tsh You may assume the input will not already include any dots.

@Adam I tried to the bonus small enough that it would likely not be competitive. I don't consider the requirement of outputting the full email address to be fluff considering. I thought making that part optional for the input would open up more creative ways to solve the problem, but if it wasn't required in the output I feel like nobody would choose to take advantage of it in the input.

I hate this. My mom always gets it wrong and then the customer service tells us we can't log into our account.

Python 3, 72 69 bytes
-3 bytes thanks to Jitse!
Input includes @gmail.com.
f=lambda s:s[11:]and[s[0]+w+x for x in f(s[1:])for w in('.','')]or[s]

Try it online!

this one fails to add @gmail.com and does not work if it is missing from the input

@hugovdberg OP clearly said, abcabc@gmail.com or abcabc **(you pick)** (emphasis mine)

69 bytes

@Jitse thanks a lot.

Python 3, 207 145 140 138 bytes
Removed the flexibility to accept both with and without @gmail.com, now requires the domain to be omitted.
g=lambda e:(f"{''.join(p+t for p,t in zip(((['','.'][s>>i&1]for i in range(len(e)-1,-1,-1))),e))}@gmail.com"for s in range(2**(len(e)-1)))

Try it online!

(len(e)-1) can be ~-len(e) for -2

Haskell, 52 bytes
Input includes @gmail.com.
c s@(a:'@':x)=[s]
c(a:b)=[a:s++x|x<-c b,s<-["","."]]

Try it online!

APL (Dyalog Extended), 51 45 34 29 bytes
Anonymous tacit prefix function. Requires ⎕IO←0 and trailing @gmail.com. Returns a list of strings.
⊂{∊,∘'.'¨@⍵⊢⍺}∘⍸∘⊤¨∘⍳2*∘≢11∘↓

Try it online!
11∘↓ drop the first eleven characters from the argument
≢ count the number of remaining characters
2*∘ raise two to that power
⍳ ɩntegers 0…that
¨∘ on each index:
 ⊤ convert To binary
 ⍸∘ ɩndices where 1-bits are
⊂{…}∘ call the following function with that as right argument (⍵) and the entire original argument as left argument (⍺)
  ⊢⍺ on the original text
  @⍵ at the given indices
   ¨ for each of the indexed characters
    ,∘'.' append a period
  ∊ ϵnlist (flatten)

In your explanation, you say ",∘' ' append a space", but the code has ,∘'.'. Typo?

@cairdcoinheringaahing Fixed.

05AB1E, 11 bytes
-4 bytes thanks to Kevin Cruijssen.
.œʒθgT›}'.ý

Try it online!
Explanation
.œ          All partitions
  ʒ         Filter:
   θ            The last part
    g           Has a length
     T›}        Larger than 10
        '.ý Join by periods

05AB1E, 16 15 bytes
Saved a lot by porting Adám's APL answer.
g11-oÝ¨bεRÅÏ'.«

Try it online!
Explanation
g                Find the input's length
 11-             Minus 11
    o            2 ** x
     Ý           0-range
      ¨          Pop the last item
       b         Convert to binary
        ε        For every binary item:
         R       Reverse this item
          ÅÏ     Apply to all truthy indices of this binary item:
            '.«  Append a period

"abcab@gmail.com"?

@Adám Probably fixed.

11 bytes

Ruby -n, 70 56 bytes
Input includes "@gmail.com". Generates all possible ways to distribute valid combinations of dots and empty strings within the id by finding the location of the second character before the @ (this works because the input is guaranteed to have 6 characters), and zips them into the original input.
r=p,?.
r.product(*[r]*~/..@/){|e|puts$_.chars.zip(e)*''}

Try it online!

Perl 6, 48 bytes
*.comb.reduce({@$^a X~$,'.'X~$^b})X~'@gmail.com'

Try it online!

I know nothing about Perl but from the "Try it online!" this seems to have trouble with strings greater than 11 characters.

@ConorHenry The code warnings were a bit too much for TIO to handle. I've added some error suppression in the footer to fix this.

Bash + sed, 39
Takes input of just the local part of the email address and not the @gmail.com.  Takes input from STDIN.
eval echo `sed 's/\B/{,.}/g'`@gmail.com

Try it online!

Any reason why you didn't use only sed?

@Wezl Generating all the combinations is super easy with bash expansions.  Possible with purely sed too but possibly a good deal more work.

Oh, I forgot you had to find all combinations. Just wasn't thinking.

C (gcc), 90 bytes
char s[],*i=s+91;main(j){for(gets(i);*i;j+=i[10]&&fork(s[j]=46))s[j++]=*i++;write(1,s,j);}

Try it online!
According to my test write is atomic, while standard IO aren't
C (gcc), 93-8%=85.56 bytes
char s[],*i=s+91;main(j){for(gets(i);*i;j+=i[10]&&fork(s[j]=46))s[j++]=*i++;write(j<76,s,j);}

Try it online!
First one to do bonus

Does the 97.52 byte version actually work?  When I click on the 'Try it online!' link, the output doesn't seem complete...

@DominicvanEssen That's the requirement of bonus but ensure output is also limited to 64(I used 7 instead) characters before the '@'.

Ah!  Got it!  (it was difficult for me to spot that you'd used a smaller value for the demo)

Lots of undefined behavior.  It may work.... or kill you.   2) What's with the separator?   Apparently you've used a NUL (undefined behavior) at the start as your separator.  This may be accidental, as it comes from j being initialized to 1, or more  if you give extra parameters.  With 64 parameters, there is no output at all.  3) I tried the bonus version with 58 characters before the @.  Tries to make 2^58 processes.  Drove the machine into the ground, and fork() can fail.

@DavidG. 1)Yeah undefined behavior is common in code golf. 2) Same. 3) I'd treat it as not enough resource

Perl 5 + -F/(?=.+@)/n 21 bytes
Much less offensive flags thanks to @Abigail!
$"="{,.}";say for<@F>

Try it online!
Explanation
-F splits the input based on the regular expression passed in (with no argument it splits the string into chars) and stores in @F. Setting $" specifies the string used to join list entries when interpolating. <...> is short syntax for a glob string which accepts interpolation. In some (most POSIX-compliant?) shells, the glob a{,.} expands to the list a and a.. for an input abcd@gmail.com, <@F> is expanded to <a{,.}b{,.}c{,.}d{,.}@gmail.com> thanks to setting $", which finally expands to the list of all permutations which are iterated with for and printed using say.

Perl 5 with -F, 32 bytes
Excludes @gmail.com from the input.
$"="{,.}";say for<@F\@gmail.com>

Try it online!

+1, but I thought it was a custom to add the bytecount of the additional flags to the bytecount of the code itself, wasn't it?

@Ramillies That is classic code golf rules for sure (which is why I added the minimal flags version too) but this link says that flags make it count as a "different language".

Thank you for the link, that's a good solution that I haven't been aware of.

-F/(?=.+@)/n works as well.

@Abigail that's much nicer! I'm sure I looked at that kind of thing but couldn't get something that worked! Thank you!

R, 115 104 103 bytes 95 bytes
d=function(s,p=2,`[`=substring)"if"(s[p,p]=="@",s,c(d(s,p+1),d(paste0(s[1,p-1],".",s[p]),p+2)))

Try it online!
Input includes "@gmail.com" (or any other domain, but that's not relevant to the challenge...)
Edit: -8 bytes thanks to Giuseppe

a couple of tricks: you can put the f=substring into the function arguments to get rid of the {}; also since you're not using [, you can set "["=substring as a 3-argument function like this

oh, and one more, if is a weird one to golf: 95 bytes

Wow!  Thanks!  That's just what I was looking for!  I was messing around with ifelse without anything working (because of c(... as vector argument), and never realized the trick of using if as a normal, non-inline function.  Brilliant!

This has a comparison of different if approaches; all the tips on that page are pretty good too!

Retina 0.8.2, 40 bytes
^.
$&@
+%`@(.)
$1@$'¶$`.$1@
@
@gmail.com

Try it online! Takes input without the domain. Explanation:
^.
$&@

Insert a marker @ after the first character.
+%`@(.)
$1@$'¶$`.$1@

Move the @ right one character each time, duplicating each line, with an extra . in the duplicate.
@
@gmail.com

Add the domain suffix to all lines.

C (gcc), 134 \$\cdots\$ 103 102 bytes
Saved 4 8 9 bytes thanks to ceilingcat!!!
Saved 7 9 10 bytes thanks to l4m2!!!
i;j;k;f(char*g){i=strlen(g)-10;for(j=1<<i;j-=2;k=!puts(g+i))for(;k<i;printf(".%c"+!(j>>k++&1),g[k]));}

Try it online!
Takes an email address with the @gmail.com part included and prints out all of its dot-aliases (not with the original).
How
Loops over \$0\dots2^{n-1}\$ where \$n\$ is the length of email address up to @.  Uses the binary bits of that loop variable to decide whether or not to insert a dot in between letters.

https://tio.run/##Hc3dCoIwGMbxc69iDYr3bSoY0cnrpPuIDmzp2pYf6IJAvPa1hOfs94dHZVqpEAxZctSCetXTUeNipOmfzRd0ejljpqkdJrCyIFsWZWnIyd348TNoYRA3E/JELso4md63wPO94gJsVTkhDgWm@ubuiLSGrjY9IFsSxrYz5pvZM8l4/VBxVx2Dd66GjlNMWvgzUrKGHw

@l4m2 Nice one - thanks! :-)

i;j;k;f(char*g){i=index(g,64)-g;for(j=1<<i;j-=2;k=!puts(g+i))for(;k<i;printf(".%c"+!(j>>k++&1),g[k]));}

@l4m2 Wow! Nice golf - thanks! :D

102

@l4m2 Sweet - thanks! :-)

On my GCC 9.2.1 x86_64 machine, it works.  On my GCC 9.3.0 armv7l machine, it loses the first character.

Pyth, 14 12 bytes
/#>11QjL\../

Try it online!
Input includes @gmail.com.
./ Partitions of input into disjoint substrings
jL\. Join the chunks of each partition using .
/#>11Q Keep only elements where the last 11 characters of the input string appear in that element (this checks that the "@gmail.com" suffix and preceding character are still intact)

Wolfram Language (Mathematica), 52 bytes
Thread@StringInsert[#,".",Subsets@Range[2,StringLength@#-10]]&

Try it online! Pure function. Takes a string as input and returns a list of strings as output. Ignore any StringInsert::psl messages generated.

Jelly, 12 bytes
ŒṖẈṪ>ɗƇ⁵j€”.

Try it online!
How it works
ŒṖẈṪ>ɗƇ⁵j€”. - Main link. Takes an email E on the left
ŒṖ           - All partitions
     ɗƇ⁵     - Keep those partitions f(P, 10) for which the following is true:
  Ẉ          -   The lengths of each part of P
   Ṫ         -   The last one
    >        -   is greater than 10
        j€”. - Join each of those remaining by ”.

T-SQL, 261 bytes
Input is taken from column U of table T (according to the Code Golf rules for SQL).
WITH V(N)AS(SELECT 1UNION ALL SELECT N+1FROM V WHERE N<(SELECT LEN(U)FROM T)),C AS(SELECT U FROM T UNION ALL SELECT CONVERT(VARCHAR(64),STUFF(U,N+1,0,'.'))FROM C,V WHERE N<LEN(U)AND SUBSTRING(U,N,2)NOT LIKE'%.%'AND LEN(U)<64)SELECT DISTINCT U+'@gmail.com'FROM C

DB Fiddle
Duration of execution grows exponentially and it takes minutes on my machine for strings longer than 10 characters, but theoretically (if given unlimited time) it should work for input strings up to 64 characters, limiting the output to 64 characters. Therefore, it should also get the -8% bonus, getting to 240 bytes.

JavaScript (Node.js), 86 bytes
(m,e,i)=>{while(m[i])w=m.substr(0,i)+'.'+m.substr(i),console.log(w+e),f(w,e,i+2),i++}

Try it online!
JavaScript (Node.js), 80 bytes
(m,e,i,c)=>{while(m[i])w=m.substr(0,i)+'.'+m.substr(i),c(w+e),f(w,e,i+2,c),i++}

Try it online!

05AB1E, 29 bytes
g©<'.и.ιæʒ'.мJg®Q}J’@g‚ç.ŒŒ’«

Try it online!

PHP, 110 bytes
function f($a,$b,$c){while($a[$c]){$w=substr($a,0,$c).'.'.substr($a,$c);echo $w.$b,"\n";f($w,$b,$c+2);$c++;}};

Try it online!
Human readable version
<?php
function f($address, $suffix, $i)
{
    while ($address[$i]) {
        $str = substr($address, 0, $i) . '.' . substr($address, $i);
        echo $str . $suffix, "\n";
        f($str, $suffix, $i + 2);
        $i++;
    }
};

f('abcabc', '@gmail.com', 1);

You do not need to count bytes used for testing. Furthermore, I think your input format does not comply with the challenge rules.

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


text:
Win 270 electoral college votes
You are the electoral strategist for a sudden late entrant in the 2020 US presidental election.
Your task: print out the names of states* your candidate will win, totalling at least 270 electoral college votes.
Background
Each state (and Washington DC) in the US system has an arbitrary number of "electoral college votes". A candidate has to win a majority of the 538 votes available, so at least 270 votes.
The number of votes for each state is:
[['Alabama', 9], ['Alaska', 3], ['Arizona', 11], ['Arkansas', 6], ['California', 55], ['Colorado', 9], ['Connecticut', 7], ['Delaware', 3], ['Florida', 29], ['Georgia', 16], ['Hawaii', 4], ['Idaho', 4], ['Illinois', 20], ['Indiana', 11], ['Iowa', 6], ['Kansas', 6], ['Kentucky', 8], ['Louisiana', 8], ['Maine', 4], ['Maryland', 10], ['Massachusetts', 11], ['Michigan', 16], ['Minnesota', 10], ['Mississippi', 6], ['Missouri', 10], ['Montana', 3], ['Nebraska', 5], ['Nevada', 6], ['New Hampshire', 4], ['New Jersey', 14], ['New Mexico', 5], ['New York', 29], ['North Carolina', 15], ['North Dakota', 3], ['Ohio', 18], ['Oklahoma', 7], ['Oregon', 7], ['Pennsylvania', 20], ['Rhode Island', 4], ['South Carolina', 9], ['South Dakota', 3], ['Tennessee', 11], ['Texas', 38], ['Utah', 6], ['Vermont', 3], ['Virginia', 13], ['Washington', 12], ['Washington DC', 3], ['West Virginia', 5], ['Wisconsin', 10], ['Wyoming', 3]]
Input
None
Output
A list (or similar) containing just the names of the states in your winning strategy. If a string, there must be separators between state names. States must be capitalised as in the list provided above.
You must not output anything other than valid state names and separators. The number of states in your strategy is up to you.
Rules
You may not use any external (or built-in) list of US state names. Standard loopholes are forbidden.
This is code golf. Shortest code in bytes wins, with the electoral college score as a tie-breaker.
Since there is no input, your code can be a program/script/statement rather than a function.
If you are using space as a separator, then you can't include any states with spaces in the name. Or you would have to do something like enclosing each state name in double quotes. (A separator has to be something that could be used to automatically split the string up into the correct elements.)
* For the purpose of this challenge, Washington DC is considered a state.

Related (Put together a Senate majority)

Probably too late now, but I reckon it would've been interesting to have a scoring system that incentivised a high vote tally as well as a low byte count (something like bytes/votes, perhaps).

Yeah, that might have been interesting. Also, printing the abbreviations might have opened up other interesting challenges.

I just tightened the rules slightly to clarify that you mustn't produce any extraneous output. (Just in case anyone was thinking of infinite monkeys...)

That would be already a standard loophole, as far as I remember.

You may not use any external (or built-in) list of US state names ~> I think this is a borderline non-observable requirement. I suspect that Brotli has most (if not all) the states hard-coded in some internal dictionary. But I'm not supposed to know that, and I'm not even supposed to know that Charcoal uses Brotli under the hood.

If there are no states containing spaces in our output can we use a space as the delimiter?

Does case matter here? Can output be entirely uppercase or lowercase?

@Shaggy "States must be capitalised as in the list provided above." is pretty clear.

@JonathanAllan Sure. Curious how that helps you?

@Arnauld What does "I'm not supposed to know" mean in this context? There's no problem using a language that has a built in list of state names. Directly making use of that list would be against the rules of this challenge.

...saves one byte from my Jelly submission.

What I mean is that some of the existing answers (including mine) are using a language whose string compression method is based on a compression library that includes at least some of the US states in its internal dictionary. So they are indirectly using a list of US state names, even if the language doesn't explicitly include such a list. The problem is that it's rather tricky to detect that. (The only reason why I decided to dig into Brotli's source code to find out for sure is that I was puzzled by how well Charcoal is compressing some state names. I was not aware of that when I answered.)

Oh, how interesting. More of a grey area than I had realised.

Related (Output the number of Electoral Votes one state has)

"arbitrary number" ?

Thanks, just did some reading. Less arbitrary than I realised: each state gets a proportional number of voters, plus 2.

Charcoal,  52 ... 45  42 bytes (270 votes)
A list of states that optimizes the compression with Brotli.
”}∧J⟧´⪫3⎚>↘≡ＶＮb7>¹l↙⁵Þ7/…ξ⌕↑τc<y\MΦＧＣ＆⸿Dρ~

Try it online!
Output
Texas
Pennsylvania
Georgia
Illinois
Washington
Indiana
California
Arizona
Michigan
Virginia
Florida
New York

Node.js script
The initial list was found with the following Node.js script that shuffles the 30 most efficient states, extracts the shortest leading sub-list with a score greater than or equal to 270, joins it with \r and invokes the Brotli compressor on the resulting string.
It was optimized some more by shuffling the most promising sub-list to find an order offering the best compression.
let states = [ ['Alabama', 9], ['Alaska', 3], ['Arizona', 11], ... ];

states =
  states.map(a => [a[0], a[1], a[1] / a[0].length])
  .sort((a, b) => b[2] - a[2])
  .slice(0, 30);

const zlib = require('zlib');

let bestLen = 1 / 0, bestScore = 1 / 0,
    list, score, str, pack;

while(1) {
  for(let i = states.length - 1; i > 0; i--) {
    let j = Math.floor(Math.random() * (i + 1));
    [ states[i], states[j] ] = [ states[j], states[i] ];
  }

  for(
    let n = 1;
    (score = (list = states.slice(0, n)).reduce((p, c) => p + c[1], 0)) < 270;
    n++
  ) {}

  str = list.map(s => s[0]).join('\r');
  pack = zlib.brotliCompressSync(Buffer(str));

  if(pack.length < bestLen || (pack.length == bestLen && score <= bestScore)) {
    bestLen = pack.length;
    bestScore = score;
    console.log(bestLen, bestScore, str.split('\r').join('\\r'));
  }
}

I found the console.log(bestLen = pack.length, bestScore = score, str.split('\r').join('\\r')) syntax extremely worrying at first glance...

@mypronounismonicareinstate Doing important assignments within a console.log?... What's wrong with that?!?... :-p

I'm not sure whether that makes the results worse here, but Math.random() - 0.5 is not a transitive nor an anticommutative comparer and is unlikely to produce all permutations with similar probabilities, and according to a statistical analysis on a random blog, it's especially terrible on Chrome, and I assume that extends to V8 and to Node. (random information: I had C++ programs segfault with maximal optimization with a comparer that turned out not to be commutative in a rare edge case)

@mypronounismonicareinstate That shouldn't matter much in that case. This method is especially bad for a single pass. But here, each iteration is shuffling the result of the previous one. (Also, we can't try all 30! ~= 2.65*10^32 permutations anyway.)

@mypronounismonicareinstate Anyway, I've switched to Fisher-Yates as it can only be better, and is also much faster. Thanks!

Ugh, you're outgolfing me in Charcoal now? Whatever next... (Sadly I didn't notice your answer, otherwise I wouldn't have bothered writing my hand-crafted answer.)

Looks like my downfall was using Ohio and Utah; the other states seem much more compressible. Just replacing those two with longer states reduces my byte count from 59 to 46...

Just printing those two states uncompressed saves me 8 bytes! Ridiculous...

@Neil I think the reason is that neither Ohio nor Utah are in the internal dictionary of Brotli.

@Neil After a closer review of Brotli's dictionary, I can confirm that it contains all the states I'm using (as I was suspecting), either as-is or in lower case.

Bah, I found a big flaw in my search technique - I was searching on comma separated strings and then switching to newlines for output. But that change makes a whole world of difference - for example it costs 8 bytes on your list.

Besides, is Pennsylvania really on brotli's dictionary? (I can't seem to find it, and it's long)

@mypronounismonicareinstate Yes, it's stored at offset 75412.

It turns out that Massachusetts and Tennessee compress better than Arizona and Indiana. See my updated answer.

05AB1E, 68 66 bytes, 271 votes
.•2Y±e1¸Zí¼³sçj†Êè”šʒÕʒ½‘ε-нUeC·ûÝì£…
õ%î!¯aàáè˜3ÒƵLweh³•#`„€¢…Œ»™

Outputs the following 12 states newline-separated, totaling 271 votes:
California,Florida,Georgia,Illinois,Indiana,Michigan,Ohio,Pennsylvania,Texas,Utah,Virginia,New York

Try it online.
If builtins were allowed, we could have used the dictionary for 27 bytes, 270 votes
”‡Â†éŠ§›ÕïÁ–Û—Ñ—ïŽŽ‡¹¢ÇŸÏžÏ

Outputs the following 13 states space-delimited, totaling exactly 270 votes:
California Texas Florida Pennsylvania Illinois Ohio Michigan Georgia Virginia Washington Tennessee Massachusetts Indiana

Try it online.
Explanation:
.•2Y±e1¸Zí¼³sçj†Êè”šʒÕʒ½‘ε-нUeC·ûÝì£…
õ%î!¯aàáè˜3ÒƵLweh³• # Push compressed string "california florida georgia illinois indiana michigan ohio pennsylvania texas utah virginia"
  #                 # Split it on spaces
   `                # Push them all separated to the stack
    „€¢…Œ           # Push dictionary string "new york" (which are both English words)
         »          # Join all strings on the stack by newlines
          ™         # And title-case each word
                    # (after which it is output implicitly as result)

”‡Â†éŠ§›ÕïÁ–Û—Ñ—ïŽŽ‡¹¢ÇŸÏžÏ
                    # Push the dictionary string "California Texas Florida Pennsylvania Illinois Ohio Michigan Georgia Virginia Washington Tennessee Massachusetts Indiana"
                    # (after which it is output implicitly as result)

See this 05AB1E tips of mine (sections How to use the dictionary? and How to compress strings not part of the dictionary?) to understand why:

.•2Y±e1¸Zí¼³sçj†Êè”šʒÕʒ½‘ε-нUeC·ûÝì£…\nõ%î!¯aàáè˜3ÒƵLweh³• is "california florida georgia illinois indiana michigan ohio pennsylvania texas utah virginia";
„€¢…Œ is "new york";
and ”‡Â†éŠ§›ÕïÁ–Û—Ñ—ïŽŽ‡¹¢ÇŸÏžÏ is "California Texas Florida Pennsylvania Illinois Ohio Michigan Georgia Virginia Washington Tennessee Massachusetts Indiana".

Charcoal, 59 51 50 41 bytes
”}∧I⊗⪫σ³»α“"⸿u↙¦Ｃ^±Ｗ)ＲLκ&⁰Ｙ2Ｅ¬«]f“ＷN+'|⁺≕

Try it online! Link is to verbose version of code. Simply the compressed string for Texas\nVirginia\nIllinois\nMichigan\nGeorgia\nPennsylvania\nFlorida\nWashington\nNew York\nCalifornia\nMassachusetts\nTennessee; total 270 votes.
This solution was found with the help of a Python 3 program that randomly selected voting states and took the length of the resulting string. It then tracked the number of times each state appeared in the strings that were less than a certain cutoff length, initially 60, but gradually reduced to 45 as I optimised the input.
Optimisation consisted both of creating a list of frequently used states and removing infrequently used states from the list thus allowing more shuffles to be performed.
Eventually I got to the point where each shuffle always had the states California, Florida, Georgia, Illinois, Michigan, New York, Pennsylvania and Texas, and four of the six states Arizona, Indiana, Massachusetts, Tennessee, Virginia and Washington. At this point I could generate all 15 combinations of 12 states and just had to shuffle the states around in the hope of getting a short answer. Shuffling script:
import brotli
import itertools
import random
import sys

bigstates = ['California', 'Florida', 'Georgia', 'Illinois', 'Michigan', 'New York', 'Pennsylvania', 'Texas']
smallstates = ['Arizona', 'Indiana', 'Massachusetts', 'Tennessee', 'Virginia', 'Washington']

while True:
 for states in itertools.combinations(smallstates, 4):
  states = bigstates + list(states)
  for j in range(100):
   random.shuffle(states)
   if len(brotli.compress('\n'.join(states).encode("ascii"))) < 39:
    print(states)
    sys.exit()

Try it online! The script also found the following shuffles with the same byte count:
Print("Texas\nTennessee\nVirginia\nPennsylvania\nWashington\nCalifornia\nMichigan\nMassachusetts\nNew York\nGeorgia\nFlorida\nIllinois");
Print("Texas\nVirginia\nMichigan\nIllinois\nGeorgia\nPennsylvania\nFlorida\nWashington\nTennessee\nMassachusetts\nNew York\nCalifornia");
Print("Texas\nGeorgia\nTennessee\nVirginia\nIllinois\nPennsylvania\nMichigan\nWashington\nCalifornia\nNew York\nMassachusetts\nFlorida");
Print("Texas\nNew York\nVirginia\nPennsylvania\nWashington\nFlorida\nMassachusetts\nGeorgia\nCalifornia\nTennessee\nMichigan\nIllinois");

Previous 50-byte solution:
”}∧UV↔ΦＪU№ＥIＧ➙eêPn¡Ｆ{⦃←στ⸿Ｍ⊕!⪫¹Ｐ？Ｍξ⁹#<″⊘bh%0ＲＺ⌈⧴↑·

Try it online! Link is to verbose version of code. Simply the compressed string for Pennsylvania\nWisconsin\nTexas\nCalifornia\nIllinois\nNew York\nFlorida\nGeorgia\nMichigan\nVirginia\nArizona\nNew Jersey; total 271 votes.
I started off with the best value states, Texas, California, Florida, Ohio, New York, Illinois, Georgia, Michigan, Pennsylvania, Virginia and Arizona, plus Iowa to make up the numbers. I then tried various permutations of states to find out which ones Charcoal compressed best; moving Ohio, Illinois and New York to the end worked best. (There are 12! possibilities so I'm not trying them all.) I then tried switching Arizona and Iowa with Indiana and Utah, taken from @SurculoseSputum's answer; Arizona made no difference but Utah saved a further byte.
Edit: Saved 8 bytes by printing Utah and Ohio literally instead of trying to compress them. Saved a further byte by using New Jersey and Wisconsin instead of Utah and Ohio. (This did mean reordering the states again for optimal compression. Colorado,
Indiana, Maryland, Massachusetts, Minnesota, Mississippi and Missouri and also work instead of Wisconsin.)

Python 2, 106 bytes, 271 votes
print"California,Florida,Georgia,Illinois,Indiana,Michigan,New York,Ohio,Pennsylvania,Texas,Utah,Virginia"

Try it online!
Picks the states with the best votes/name length ratio.
Turns out this is the shortest possible combination of states to achieve at least 270, as shown in this DP program.

There's actually a shorter combination with just 11 states:     California (55; 55)
Texas (38; 93)
Florida (29; 122)
New York (29; 151)
Illinois (20; 171)
Pennsylvania (20; 191)
Ohio (18; 209)
Georgia (16; 225)
Michigan (16; 241)
North Carolina (15; 256)
New Jersey (14; 270)

@outflak while your list has less states, the total length is 4 bytes longer than my current answer.

Turing Machine Code, 1059 bytes (270 votes)
0 * C r 1
1 * a r 2
2 * l r 3
3 * i r 4
4 * f r 5
5 * o r 6
6 * r r 7
7 * n r 8
8 * i r 9
9 * a r π
π * , r a
a * T r b
b * e r c
c * x r d
d * a r e
e * s r f
f * , r g
g * F r h
h * l r i
i * o r j
j * r r k
k * i r l
l * d r m
m * a r n
n * , r o
o * N r p
p * e r q
q * w r r
r * _ r s
s * Y r t
t * o r u
u * r r v
v * k r w
w * , r x
x * I r y
y * l r z
z * l r A
A * i r B
B * n r C
C * o r D
D * i r E
E * s r F
F * , r G
G * P r H
H * e r I
I * n r J
J * n r K
K * s r L
L * y r M
M * l r N
N * v r O
O * a r P
P * n r Q
Q * i r R
R * a r S
S * , r T
T * O r U
U * h r V
V * i r W
W * o r X
X * , r Y
Y * G r Z
Z * e r `
` * o r ¬
¬ * r r "
" * g r £
£ * i r $
$ * a r %
% * , r ^
^ * M r &
& * i r (
( * c r )
) * h r +
+ * i r {
{ * g r }
} * a r [
[ * n r ]
] * , r -
- * N r =
= * o r :
: * r r '
' * t r @
@ * h r #
# * _ r ~
~ * C r
> * o r .
. * l r ?
? * i r /
/ * n r |
| * a r \
\ * , r ©
© * N r À
À * e r Á
Á * w r Â
Â * _ r Ã
Ã * J r Ä
Ä * e r Å
Å * r r Æ
Æ * s r Ç
Ç * e r È
È * y r halt

This will print:
California (55; 55)
Texas (38; 93)
Florida (29; 122)
New York (29; 151)
Illinois (20; 171)
Pennsylvania (20; 191)
Ohio (18; 209)
Georgia (16; 225)
Michigan (16; 241)
North Carolina (15; 256)
New Jersey (14; 270)

Or to be more precise:
California,Texas,Florida,New York,Illinois,Pennsylvania,Ohio,Georgia,Michigan,North Carolina,New Jersey
Updated to reflect a later rule change - thanks @Laikoni. No byte size change.
Try it online!

The challenge states "If you are using space as a separator, then you can't include any states with spaces in the name."

@Laikoni, Thanks for the update. Wouldn't have known otherwise. Wonder if there couldn't be some feature for this site where an OP could 'ping' the answerers if there are significant changes that might affect their answers?

I was not aware that this rule was added to the challenge after you posted your answer. It would have been nice if OP informed the existing answers of this change - the 'ping' you mention is easily achieved by commenting on the answers, especially as there weren't that many.

Sorry, my bad. (From my point of view, it wasn't "adding a rule", but explicitly stating something that I thought was implicit in the use of the word "separator", but point taken.)

Stax, 75 bytes, 271 votes
ê╢G.₧¢ƒdXb╜L7äF9₧⌐Ä╚ç⌂oPrçer┬♦s4⌠╧!S∟☻ƒÆà²ÿ☼{4?àç÷Uó("Φå9dgYútY°lènÜÉ↔TI╙í↨

Run and debug it

Jelly, 37 bytes
“£+ʠṅṖḳ!⁺PUB.BJçŒṖ{ScḤ?[¢¤c}€£Y,qbẆ|»

A niladic Link which yields a list of characters using a space as the separator. The states have a total value of 270 (and contain no spaces themselves):
California    55
Texas         38
Florida       29
Pennsylvania  20
Illinois      20
Ohio          18
Georgia       16
Virginia      13
Massachusetts 11
Indiana       11
Arizona       11
Maryland      10
Colorado       9
Alabama        9
           = 270

Try it online!
How?
A compressed string. After taking big hitters containing no spaces I chose states which are earlier alphabetically to keep the result shorter.

Ruby, 115 bytes
puts"California
Texas
Florida
Nor#{s="th Carolina
New "}York
Sou#{s}Jersey
Illinois
Ohio
Georgia
Michigan
Virginia"

Try it online!
Makes use of the string "th Carolina\nNew "

@mathjunkie. Thanks, I noticed that after posting. I also noticed that a port of  Surculose Sputum's simpler but better researched answer would be shorter than this/ But I'll leave it up as I wanted to share the Carolina/New concept.

I'm glad there are languages that manage to make use of the New/North/South duplications. I tried with JavaScript but didn't save any bytes.

Bash, 102 108 bytes (270 electoral votes)
echo \"{{Californ,Georg,Virgin}ia,Florida,Arizona,Indiana,Texas,Ohio,New\ {York,Jersey},Illinois,Michigan}\"

Try it online!
Added 6 bytes to accommodate the modification to the challenge on using a space as a separator.  The original answer was:
echo {Californ,Georg,Virgin}ia Florida Arizona Indiana Texas Ohio New\ {York,Jersey} Illinois Michigan

This uses space as a separator, but also includes states with spaces in their names, which isn't valid. (I've updated the rules to clarify this). Sorry if that feels like moving the goalposts - but it doesn't seem right to call something a "separator" if you can't split on it.

I've accommodated the new rule on spaces at the cost of 6 bytes.

Whitespace, 777 bytes; 274 EV's

Outputs the states as a j-separated list. You read that part right.
Try it online!
States
"Arizona", "California", "Florida", "Georgia", "Illinois", "Indiana", "Iowa", "Michigan", "Ohio", "Pennsylvania", "Tennessee", "Texas", "Utah", "Virginia"
List chosen using @Surculose Sputum's Python script, but modified to ignore states with spaces in their names. This was because spaces have an ascii value of 32, and 32 - 105= -73, so pushing it would raise the byte count by a lot (I think). I have yet to test this theory though (because when removing NY I had to add something like 4 more states), so the code may yet get smaller.
Code
A pretty standard Whitespace answer. Pushes the names of the states minus 105 to the stack, separated by a j, and then runs through the stack adding back the 105 and printing the result as a character. The printing part looks something like:
label 0:
  push 105
  add
  printc
  jmp 0

105 because the character with the most occurences is i, which has an ascii value of 105. Outputting as a j separated list because j has a value of 106. I used this script to generate the WSA (WhiteSpace Assembly) to quickly test the offset number, and used this IDE to compile it to regular Whitespace.

JavaScript, 114 characters, 270 votes
_=>`California,Texas,Florida,Nor${s='th Carolina,New '}York,Sou${s}Jersey,Illinois,Ohio,Georgia,Michigan,Virginia`

Just a straight port of Level River St's Ruby answer.


text:
Number of solutions to a binary weight equation
We define \$a(n)\$ as the 1-indexed position of \$n\$ in the sequence of positive integers with the same binary weight, i.e. the same number of 1's in their binary representation. This is A263017.
Given a positive integer \$n\$, your task is to determine how many positive integers \$k\$ satisfy:
$$k-a(k)=n$$
For instance, \$n=6\$ can be expressed as:

\$n=7-a(7)=7-1\$ (\$7\$ being the 1st integer with 3 bits set)
\$n=12-a(12)=12-6\$ (\$12\$ being the 6th integer with 2 bits set)

There's no other \$k\$ such that \$k-a(k)=6\$. So the expected answer is \$2\$.
This is code-golf.
Test cases
Input Output
1     1
6     2
7     0
25    4
43    0
62    1
103   5
1000  0
1012  6
2000  1
3705  7
4377  8

Or as lists:
Input : [1, 6, 7, 25, 43, 62, 103, 1000, 1012, 2000, 3705, 4377]
Output: [1, 2, 0, 4, 0, 1, 5, 0, 6, 1, 7, 8]

MATL, 15 bytes
t4*:tB!s&=Rs-=s

Try it online! Or verify all test cases.
This makes use of the following result:
Claim
\$a(n) \le 3n/4\$ for \$n \geq 3\$.
Here is a graphical illustration. The bound is quite loose, but it is sufficient to establish that only a finite number of values of \$k\$ need to be tested for a given \$n\$ (more on that in “How the code works”).
Proof
The sequence \$a(n)\$ (A263017) is the amount of numbers in the set \$\{1,2,\ldots,n\}\$ that have the same binary weight as \$n\$. The binary expansion of \$n\$ has \$b \leq \log_2 n + 1\$ digits, with a leading 1. Let \$w\$ be the binary weight of \$n\$. Clearly \$w \in \{0,\ldots,b\}\$.
The number of unique permutations of the binary expansion of \$n\$, not necessarily with a leading 1, is \${b\choose w}\$. \$a(n)\$ will be at most equal to this value. It can be less, because some of the permutations may produce a number exceeding \$n\$. Thus,
$$
a(n) \leq {b\choose w}.
$$
For \$b\$ even, the bound
$$
{2m \choose m} \leq \frac{4^m}{\sqrt{3m+1}} \text{ for all } m \geq 1
$$
and the fact that \${b\choose w} \leq {b\choose b/2}\$ imply that
$$
{b \choose w} \leq \frac{2^b}{\sqrt{\frac{3b+2}{2}}}.
$$
For \$b\$ not necessarily even, the bound holds with \$b\$ replaced by \$b+1\$:
$$
{b \choose w} \leq \frac{2^{b+1}}{\sqrt{\frac{3b+5}{2}}}.
$$
Since \$b \leq \log_2 n + 1\$,
$$
a(n) \leq {b\choose w} \leq \frac{2^{b+1}}{\sqrt{\frac{3b+5}{2}}} \leq \frac{4n}{\sqrt{ 3/2 \cdot \log_2 n + 4}}.
$$
This is less than \$3n/4\$ for \$n \geq 80478\$, because
$$
\sqrt{3/2 \cdot \log_2 80478 + 4}\ = 5.3333348 > 16/3.
$$
For \$n = 3, \ldots, 80477 \$, direct computation of \$a(n)\$ shows that \$a(n) \leq 3n/4\$. Therefore \$a(n) \leq 3n/4\$ for \$n \geq 3\$.
How the code works
The above result implies that
$$
k-a(k) \geq k / 4.
$$
for all \$k \geq 3\$. Thus, given \$n\$, to compute the number of positive integers \$k\$ that satisfy
$$
k-a(k)\ = n
$$
it suffices to test the latter equality for \$k = 1, \ldots, 4n\$.
Consider input 1 as an example.
t4*  % Implicit input: n. Duplicate. Multiply by 4
     % STACK: 1, 4
:    % Range. Gives [1 2 ... 4*n]. This is the vector of k values
     % STACK: 1, [1 2 3 4]
tB   % Duplicate. Binary expansion. Gives a binary matrix, where each row
     % corresponds to a value of k
     % STACK: 1, [1 2 3 4], [0 0 1;
                             0 1 0;
                             0 1 1;
                             1 0 0]
!s   % Tranpose. Sum of each column. This gives the binary weights
     % STACK: 1, [1 2 3 4], [1 1 2 1]
&=   % Matrix of pair-wise equality comparisons
     % STACK: 1, [1 2 3 4], [1 1 0 1;
                             1 1 0 1;
                             0 0 1 0;
                             1 1 0 1]
R    % Upper triangular part. This sets elements below the diagonal to 0
     % STACK: 1, [1 2 3 4], [1 1 0 1;
                             0 1 0 1;
                             0 0 1 0;
                             0 0 0 1]
s    % Sum of each column. For each column k, this gives the amount of
     % number up to k with the same weight as k; that is, a(k). Note that
     % the condition "up to k" corresponds to having taken the upper
     % triangular part of the matrix
     % STACK: 1, [1 2 3 4], [1 2 1 3]
-    % Subtract, element-wise. This gives k-a(k)
     % STACK: 1, [0 0 2 1]
=    % Equality comparison, element-wise. This compares n with each
     % value k-a(k)
     % STACK: [0 0 0 1]
s    % Sum. Implicit display
     % STACK: 1

Python 3, 98 96 bytes
Saved 2 bytes thanks to Surculose Sputum!!!
lambda n:sum(n==sum(bin(i).count('1')!=bin(k).count('1')for i in range(1,k))for k in range(5*n))

Try it online!
Brute force and very slow.

Could you explain why $k$ is bounded by $5n$? It's not immediately obvious to me

@mathjunkie Because it works for $1$ and it seems to drop as $n$ increases going down to $3n$ for larger numbers. More ad hoc experimentation than maths. :-(

96 bytes, using the fact that there must be exactly $n$ numbers smaller than $k$ that has different weight.

@SurculoseSputum Nice one - thanks! :-)

C (gcc), 106 \$\cdots\$ 100 96 bytes
Saved 5 bytes thanks to the man himself Arnauld!!!
Saved 1 5 bytes thanks to l4m2!!!
Saved 4 bytes thanks to ceilingcat!!!
b(n){n=n?1+b(n&n-1):0;}k;i;s;p;f(n){for(p=0,k=5*n;i=k--;p+=n==s)for(s=0;--i;)s+=b(i)!=b(k);s=p;}

Try it online!
Port of my Python answer, much a bit faster.

b(n){n=n?1+b(n&n-1):0;} would be 5 bytes shorter ... but ~10 times slower.

@Arnauld Who's watching timers anyway? Nice one - thanks! :D

Why do you still leave the newline?

also k++ can be merged into condition

@l4m2 Oops, thanks for pointing that out! :-)

Like how my C solution do

96 bytes

@l4m2 Ah, going backwards - nice one thanks! :-)

@ceilingcat That's the ticket - thanks! :-)

APL (Dyalog Unicode), 41 bytesSBCS
{1⊥⍵=i-+⌿(⊢×∘.≤⍨∘⍳∘≢)∘.=⍨+⌿2∘⊥⍣¯1⊢i←⍳4×⍵}

Try it online! (Assumes ⎕IO ← 1)
This is a direct translation of Luis Mendo's really good answer so go give that one an upvote if you haven't.
How it works (reading the submission from right to left):

i←⍳4×⍵ multiply the input ⍵ by 4, create a range from 1 to 4⍵ and save it in the variable i for later;
2∘⊥⍣¯1 create a matrix of binary conversions (one col per number);
+⌿ column-wise sum;
∘.=⍨ matrix of pair-wise equality comparisons;
(⊢×∘.≤⍨∘⍳∘≢) from which we extract the upper triangular part;
+⌿ column-wise sum again;
i- the original range 1 ... 4⍵ minus the new vector;
⍵= compared to the input number;
1⊥ and summed up.

JavaScript (Node.js), 70 bytes
n=>f=(i=g=i=>+i&&1+g(i&i-1))=>i>5*n?0:(i-(g[j=g(i)]=-~g[j])==n)+f(-~i)

Try it online!
JavaScript (Node.js), 81 bytes
n=>[...Array(n*5)].reduce(s=>s+=++i-(g[j=g(i)]=-~g[j])==n,i=0,g=i=>i&&1+g(i&i-1))

Try it online!
Thank Arnauld for -3 bytes

C (gcc), 71 bytes
i,k;f(n){int C[99]={};for(i=k=0;i++/n/5<=k;)k+=i-++C[*C+=2-ffs(i)]==n;}

Try it online!
WTF is happening?
C (gcc), 72 bytes mainly by dingledooper
i,k;f(n){int C[99]={};for(i=k=0;i++<5*n;)k+=i-++C[*C+=2-ffs(i)]==n;i=k;}

Try it online!
C (gcc), 79 bytes
k;f(n){int C[99]={};for(k=0;k++<5*n;)*C+=k-++C[__builtin_popcount(k)]==n;k=*C;}

Try it online!
Port of my Javascript answer


text:
Parse a variable star designation
The variable star designation is an identifier for a variable star (a star that fluctuates in brightness). It consists of either a 1-2 letter code or (when the letter code is no longer sufficient) a 'V' followed by a number. This code is followed by the genitive of the star constellation the star is found in (eg. "RR Coronae Borealis", in short "RR CrB"), and each constellation has their own independent numbering.
The series of variable star designations inside one constellation is as follows:

start with the letter R and continue alphabetically through Z.
Continue with RR...RZ, then use SS...SZ, TT...TZ and so on until ZZ.
Use AA...AZ, BB...BZ, CC...CZ and so on until reaching QZ, always omitting J in both the first and second positions.
After QZ (the 334th designation) abandon the Latin script and start naming stars with V335, V336, and so on (V followed by the full numeric index).

Note: The second letter is never alphabetically before the first, ie. BA for example is an invalid designation. Single letters before R are unused. J never appears in the designation.
Your Task
Parse a variable star designation and return its index in the series of variable star designations!
The input is a string of just the variable star designation (omitting the constellation reference that is usually included in a full variable star designation). It can be assumed to be a valid variable star designation; validation is not part of this challenge.
Output is a number representing at what index in the series the designation is. The index is 1-based.
Test cases:

QV => 330
U => 4
V5000 => 5000
AB => 56

This is code-golf, so the shortest code wins. Standard rules and loopholes apply.

Jelly,  23 22  20 bytes
ØAḟ”JŒċṙ280Ḋ€ḣ9;ƲiȯḊ

A full program which prints the index.
Try it online!
How?
ØAḟ”JŒċṙ280Ḋ€ḣ9;ƲiȯḊ - Main Link: list of characters, V
ØA                   - upper-case alphabet characters
   ”J                - character 'J'
  ḟ                  - filter discard
     Œċ              - combinations with repetition = ["AA","AB",...,"AZ","BB",...]
       ṙ280          - rotate left by 280 = ["RR","RS",...,"RZ","SS",..."]
                Ʋ    - last four links as a monad:
           Ḋ€        -   dequeue each = ["R","S",...,"Z","S",...]
             ḣ9      -   head to index 9 = ["R","S",...,"Z"]
               ;     -   concatenate these together = ["R","S",...,"Z","RR","RS",...]
                 i   - first index of V in that (or 0 if not found)
                   Ḋ - dequeue V (i.e. "V5000" -> "5000")
                  ȯ  - logical OR
                     - implicit print

Python 3, 121 bytes
lambda z,a='ABCDEFGHIKLMNOPQ',r='RSTUVWXYZ':int(z[1:])if z[2:]else[t+u for t in['',*r+a]for u in a+r if t<=u].index(z)-15

Try it online!
Explanation
The list comprehension [t+u for t in['',*r+a]for u in a+r if t<=u] evaluates to these strings:
t='':   A  B  C  D  E  F  G  H  I  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
t='R':                                                 RR RS RT RU RV RW RX RY RZ
t='S':                                                    SS ST SU SV SW SX SY SZ
t='T':                                                       TT TU TV TW TX TY SZ
t='U':                                                          UU UV UW UX UY SZ
t='V':                                                             VV VW VX VY VZ
t='W':                                                                WW WX WY WZ
t='X':                                                                   XX XY XZ
t='Y':                                                                      YY YZ
t='Z':                                                                         ZZ
t='A': AA AB AC AD AE AF AG AH AI AK AL AM AN AO AP AQ AR AS AT AU AV AW AX AY AZ
t='B':    BB BC BD BE BF BG BH BI BK BL BM BN BO BP BQ BR BS BT BU BV BW BX BY BZ
...
...
...
t='Q':                                              QQ QR QS QT QU QV QW QX QY QZ

If there are any characters past the first two (z[2:]) then the result is int(z[1:]). Otherwise (i.e. if there are only one or two characters) we look the string up in the list we created and subtract 15 from the index.

If we may assume an upper bound on the input, it looks like you can convert this to an object method for 123: Try it online!

Do you think I can get away with omitting int() and returning a string for the Vnnn case? It feels weird…

It feels weird to me too. Though I remember I had a golf where someone suggested changing a string zero to a number zero in the output to handle a special case and nobody objected.

JavaScript (ES6),  104 100 98  92 bytes
s=>+s.slice(1)||(n=parseInt(s,36))-((v=n/36|0)?250-v*~v/2+(n%36>18)+(v>18?v>26?360:35:v):26)

Try it online!
How?
We first test whether removing the first character of the input string leads to a numeric value. If it does, we just return that. For instance, V5000 gives \$5000\$.
Otherwise, we convert the whole string from base-36 to decimal and store the result in \$n\$.
The index \$i_n\$ of the star is always less than \$n\$. What we want to do is find out the difference \$d_n\$ such that:
$$i_n=n-d_n$$
Let \$v_n\$ be the higher base-36 digit:
$$v_n=\left\lfloor\frac{n}{36}\right\rfloor$$
If \$v_n=0\$, it means that this is a single letter designation and we just need to subtract \$d_n=26\$ from \$n\$ to get the correct index (R=1, S=2, etc.).
Otherwise, we compute:
$$d_n=250+t_n+k_n+o_n$$
\$t_n\$ is the term reflecting the fact the designation is triangular (ZZ, YY YZ, XX XY XZ, etc.):
$$t_n={v_n+1 \choose 2}=\frac{v_n\cdot(v_n+1)}{2}$$
\$k_n\$ is the correction term for the missing J for the second letter:
$$k_n=\cases{0,&\text{$n\bmod36\le18$}\\
1,&\text{$n\bmod36>18$}
}$$
Finally, \$o_n\$ acts both as a correction term for the missing J for the first letter and as an offset for the 'wrapping' nature of the designation which goes first from RR to ZZ and then from AA to QZ:
$$o_n=\cases{v_n,&\text{$v_n\le18$}\\
35,&\text{$18<v_n\le26$}\\
360,&\text{$v_n>26$}
}$$

Charcoal, 41 bytes
≔…R¦[η≔Φα⁻κ⁹ζＦ﹪⁻Ｅζκ⁹ＬζＦ✂ζι⊞η⁺§ζικＩ∨⊕⌕ηθΣθ

Try it online! Link is to verbose version of code. Explanation:
≔…R¦[η

Start building up a list of designations with the single letters R to Z.
≔Φα⁻κ⁹ζ

Get the alphabet without the letter J.
Ｆ﹪⁻Ｅζκ⁹Ｌζ

Loop over each possible first letter, but offset the value so it starts at the index of R, wraps around, and stops at the index of Q.
Ｆ✂ζι

Loop over each possible second letter.
⊞η⁺§ζικ

Push the letter pair to the list of designations.
Ｉ∨⊕⌕ηθΣθ

Output the index in the list, or if not found, the embedded number.

Pyth, 35 34 bytes
|hx-I#\J+Kr\R\[smr+dd+d\[+Kr\A\RQt

Try it online!
Uses string ranges to build a list of star designations, then finds the index of the input in that list.
Explanation

r\R\[ is the range from R to [ (half-open range, so the range ends at Z) and r\A\R is the range from A to R
mr+dd+d\[ maps each character \$d\$ of a given list to the range from \$dd\$ to \$d\$[

(eg. "S" would map to  the range "SS" to "S[")

Hence, +Kr\R\[smr+dd+d\[+Kr\A\R builds the following list:

['R',...'Z', 'RR',...'RZ', 'SS',...'SZ', 'TT',...'TZ',... 'ZZ', 'AA',... 'AZ', 'BB',... 'BZ',...'QZ']

-I#\J filters out items that contain a J
x ... Q gives the index of the input in that list. If the input is not in the list, -1 is returned.

h increments that result (so if the input was not in the list, we now have 0)

| ... t(Q) catches the Vxx case. If the previous expression evaluated to 0 (meaning the input was not in the constructed list), this returns the "tail" of the input (ie. the number after the V)

C (gcc),  92 89  87 bytes
Saved 2 bytes thanks to @ceilingcat
Very similar to my JS answer, but without the constraint of working in base 36.
v;f(char*s){v=*s++-81;s=*s?s[1]?atoi(s):v*10+254+*s+v*~v/2-*s/74-(v>-8?v>0?334:9:v):v;}

Try it online!


text:
Shuffle string of digits
Challenge
You have been given a string of digits 0-9.1 Your task is to shuffle this string, but every index must have a different value than it did before the string was shuffled.
For example:
In : 287492
Out: 892247

If this is not possible, return false or something similar. (null, undefined, etc.)
In : 131
Out: false

There is no upper bound on the length of the string, but you can assume you have unlimited computation time.
Your function must pass the following tests:
shuffle('2')                   => false
shuffle('88')                  => false
shuffle('794588888')           => false
shuffle('344999')              => for example, '999434'
shuffle('172830560542976539')  => for example, '271038650425697395'

Shortest code wins, and good luck!

1 More specifically, the string would match /^[0-9]+$/.

so, you are asking for derangements...

Yes, I looked it up and that's what it would be... I'll add it to the description, but I had a question first regarding the details: Would the fact that numbers can appear multiple times in the string affect the derangements? E.g., what I am describing means '111222' can't become '121212', whereas with derangements, could you say, "well, it was a different 2"? (If that makes any sense)

Does the output have to be randomized? The challenge is tagged random but it doesn't say

@xnor, no it does not. I just thought to tag it that because it has to do with shuffling. There is no constraint on randomness, and neither do all the options have to be equally likely. It just has to create the outcome described. I'll remove the tag, thanks for the tip.

Would it be okay to throw an error when the shuffling is not possible (and output nothing to STDOUT)?

Or alternatively, would we be permitted to output all possible strings that meet the criteria?

@mathjunkie, both of those things you proposed would be allowed. Sorry for the late response.

Closely related

@LuisMendo Only difference is that the other challenge asks for a list and this one a string, right? But since strings are allowed to be input as character-lists/arrays by default, isn't it just a dupe? The 7-byte MATL answer in that linked challenge can for example directly be used as is here; most of the other answers will need to have the input in list format to work though.

@Kevin I’m not sure, because this challenge doesn’t seem to require random output, i.e. it can be deterministic (it’s not clear to me from the challenge specification)

@LuisMendo Ah, I missed the random part in that other challenge. Yeah, then they are indeed different, but as you already mentioned, very closely related. We could tag Stewie to mention he can post his 7-byter MATL answer here as well. ;)

@KevinCruijssen Yes :-) ... pity that he doesn't seem to be active anymore, due to the recent SE issues

@KevinCruijssen Come to think about, the criterion for dupe is that most answers in the other challenge are competitive here. Probably the best way to generate the derangement is to do it randomly, so it would be a dupe after all

@KevinCruijssen Ah, the Pyth answer here doesn't use randomness... Sorry for all the comment noise!

@LuisMendo also this question asks a falsey output when not possible, in the other question it assumes the input is possible, as for exemple the PHP answer (that I noticed only after having posted mine, but has same approach) will be stuck in an infinite loop. And it's a non negligeable part of the answer's length in mine

@Kaddath Good point too

Jelly, 6 bytes
Œ!nẠ¥Ƈ

Try it online!

K (ngn/k), 37 32 bytes
{$[|/x=r:x[,/|2 0N#<x]@<<x;0;r]}

Try it online!
{ } function with argument x
$[ ; ; ] if-then-else
<x "grade" - the sorting permutation for x
<<x "rankings" - the inverse of the sorting permutation
2 0N# split in two halves (or when length is odd - only approximately)
| swap the halves
,/ concatenate
x[ ] use as indices in x
..@<<x use <<x as indices in the previous result (a@b is alternative syntax for a[b])
r: assign to r - the potential result
x=r boolean list of which elements of x are equal to their counterparts in r
|/ or-reduction, i.e. "any?"

How does it work? Just curious :)

@applemonkey496 i'll explain a bit later. i'm still looking for ways to shorten it. generally: sort, rotate by the size of the largest group, and unsort.

i changed the algorithm slightly - now rotation is by half the length of x

Neat approach.  So is it looping or doing any recursion, or just checking 2 possibilties.  I'm still a little fuzzy even with the explanation.

@Jonah no, there's no looping or recursion. i'm not good at explanations, is there anything in particular that should be rephrased?

I think Im just looking for a concise high level explanation of the algorithm itself, without reference to the specifics of the K implementation

@Jonah to someone familiar with J, i would describe it as "half-tally rotate under sort" :)

So sort, rotate half the length, then apply inverse of the original sort?  If that’s right that’s quite the trick... how did you arrive at that insight?

Let us continue this discussion in chat.

05AB1E, 7 bytes
Like the Pyth answer, outputs all possible shuffled strings or digits.
œʒø€Ëà_

Try it online!
Explanation
œ       Permutations of the input
 ʒ      Filter such that:
  ø        Zipping with the original input
   €Ë      And comparing at corresponding indices
     à_    are all unequal.

I think œ is permutations, not powerset

Pyth, 9 bytes
f.AnVQT.p

Try it online!
Outputs all possible strings that meet the criteria given in the question. This results in an empty list for the false cases.

Pyth, 7 bytes
-VI#Q.p

Try it online!
Takes input as a list of digit-characters. For example:
['1', '2', '3']

Output: all possible derangements, with multiplicity for related characters.

.p: Generate all permutations.
#: Filter on
I: Invariant under
-V ... Q: Removing all characters that are at the same position in the input.

JavaScript (Node.js), 125 bytes
e=>[...Array(i=2+e|0)].every(_=>(s=[...q=(--i+'').slice(1)]).some((_,j)=>_==e[j])|s.sort()+''!=[...e].sort()||console.log(q))

Try it online!

Python 2, 83 80 bytes
lambda l:[p for p in permutations(l)if all(map(cmp,l,p))]
from itertools import*

Try it online!
Goes through all permutation of the string, and keeps the ones that are different to the original string at every index.

You should be able to drop the [0] since outputting all possible strings is now allowed

Fun fact: my pyth solution translates almost directly to your solution

@mathjunkie The generation output of the Pyth solution generates exactly this solution, byte-for-byte?

@Λ̸̸ Not quite (eg. cmp vs. n which would be != in Python). But I imagine the generated code would be quite similar

PHP, 152 141 bytes
$a=count_chars($s=$argn,1);rsort($a);$a[0]*2<=strlen($s)?:die;for($s=$t=str_split($s);$s!=array_diff_assoc($s,$t);)shuffle($t);echo join($t);

Try it online!
A bit lengthy but it's my first approach, will think more about it later

displays empty string (exits) if impossible (if the most frequent number occurence is more than half of length of the string)
uses an array approach and shuffles until it finds a proper result

EDIT: fixed an error in string length var attribution (missing brackets) + improved while condition for +1 byte
EDIT2: saved 1 byte, since brackets were mandatory for ternary condition, an if is now shorter
EDIT3: saved 11 bytes with the help of this answer by Titus to a closely related question

JavaScript (Node.js), 187 bytes
e=>{for(b=a=e.slice().sort(),a=+a.join(""),b=+b.reverse().join("");a<=b;){if(k=(a+"").split("").map(a=>+a),b==k.slice().sort((a,e)=>e-a).join("")&&e.every((a,e)=>a!=+k[e]))return a;a++}}

Try it online!
-8 bytes thanks VFDan
JavaScript (Node.js), 179 bytes
e=>{for(b=a=e.slice().sort(),a=+a.join``,b=+b.reverse().join``;a<=b;){if(k=(a+"").split``.map(a=>+a),b==k.slice().sort((a,e)=>e-a).join``&&e.every((a,e)=>a!=+k[e]))return a;a++}}

Try it online!

You can save 8 bytes by turning all ("") to \`: e=>{for(b=a=e.slice().sort(),a=+a.join``,b=+b.reverse().join``;a<=b;){if(k=(a+"").split``.map(a=>+a),b==k.slice().sort((a,e)=>e-a).join``&&e.every((a,e)=>a!=+k[e]))return a;a++}}`

Nice, Thank you for trick!!!


text:
Look for n-plicates
If you are given an array of numbers between 1 and 100 and an integer n, you must remove any instances of an item that appear greater than n times.
For example:
In : [92, 41, 81, 47, 28, 92, 84, 92, 81], n = 1
Out: [92, 41, 81, 47, 28, 84]

The most aesthetic/simple algorithm wins. And since this is a popularity-contest, you get to decide!

You should know that [tag:popularity-contest] is effectively deprecated at this point, at least in the form of "nicest answer wins". Moreover, I think this task is straightforward enough that in most languages the normal idiomatic way to do this is probably the simplest, and anything else would just be adornment for the sake of it.

In the future, consider using the Sandbox to propose challenges before posting them

J, 21 16 15 bytes
(>:+/@(={:)\)#]

Try it online!
Overall, we make a boolean mask and apply it to the original list: (...)#]
To construct the mask, for each prefix \ we sum +/@ the number of times an element equals the last element of that prefix (={:), which gives us a list the same size as the original, where each element holds the number of times the element has appeared so far.  This is:
1 1 1 1 1 2 1 3 2

for the example list.
Then we check which elements are less than or equal >: to the left arg:
1 1 1 1 1 0 1 0 0

producing the mask we want.