text:
Exponential-ish number sequence
Your program must print out this exact sequence:
1
2
4
10
24
54
116
242
496
1006
2028
4074
8168
16358
32740
65506
131040
262110
NOPE!

As usual, shortest program wins. Standard code golf rules apply.

How did you come up with this sequence and why does it end where it does?

@dylnan It's your task to find the rule :)

@Mr.Xcoder that's silly. As soon as anyone finds the rule it will be obvious in their code.

Why are you printing NOPE!? Once you have the sequence you can continue it.

IMO the NOPE! just makes each submission longer by about 10 bytes, and doesn’t serve any purpose when it comes to making the challenge more interesting.

@dylnan: it's the number of backslashes in the python string '' before each call to repr on the previous value. I was messing around with successive repr calls and the nope was just there so I didn't hang the computer.

May we output an array instead of a newline separated string?

@Beefster so can we disregard the "NOPE!"?

By the way - welcome to PPCG! Next time you post a challenge, you can post a draft to the sandbox first, and the community will help you format it and iron out any bugs :)

@Shaggy I guess that's technically in the spirit of the challenge. I only say 'sequence'.

@Riker NOPE! I kinda want to see if anyone comes up with a clever way to represent it in fewer bytes, though that probably isn't possible.

Future me sees the error in past me's ways. The nope is not very interesting.

SOGL V0.12, 16 bytes
1O'²∫ūF-«O"NOPE!

Try it Here!
Explanation:
1O                output 1
  '²∫             17 times do, pushing 1-indexed counter
     ū              calculate 2^pop
      F-            subtract from that the counter
        «           multiply by 2
         O          output
          "NOPE!    push "NOPE!", which gets printed at the end as implicit output hasn't been disabled. This gets pushed every iteration of the loop, to save a byte

Python 2, 51 bytes
i=0;exec"print 2**i-i<<(i>0);i+=1;"*18;print"NOPE!"

Try it online!
Notices that the formula is 2(2n-n), for all n except 0.
Saved two bytes thanks to Wheat Wizard (i<<1-(i<1) changed to i<<(i>0), duh!).

Python 2, 53 bytes
i=0;exec"print[2**i-i<<(i>0),'NOPE!'][i>17];i+=1;"*19

Try it online!

I wrote exactly the same for i in range(18):print(2**i-i)*2-(i<1) print"NOPE!" solution, but was too late, it seems :)

51

@WheatWizard Thanks! That was the cleverish trick I was looking for!

Don't know if it helps but, f(n)=2(f(n-1)+n)* for all n except 0

@WheatWizard Since this is kolmo-complexity, recursion should (theoretically) not be shorter

54 using the OP's method, but probably can't be golfed to be shorter than yours

Fortran 95, 82 74 bytes
Compiled with gfortran, with the -cpp flag to enable preprocessing, or saving the file with .F95 extension.
#define p print*,
program w
p 1
do i=1,17
p 2*(2**i-i)
enddo
p'NOPE!'
end

Longest answer! Not anymore! YAY!

Emojicode, 96 bytes
1 2i⏩1 18✖2➖2.0i i 10NOPE!

Try it online!

+1 for the  icon, will look forward to this language

Jelly, 20 bytes
17Rµ2*_×2“NOPE!”ṭ1;Y

Try it online!
Explanation
17Rµ2*_×2“NOPE!”ṭ1;Y
17R                   range(17):[1,2,...17]
   µ                  new monadic link
    2*                exponentiate: [2*1, 2*2,...2*17]
      _               subtract: [2*1-1, 2*2-1,...2*17-17]
       ×2             times 2. Ḥ would need an additional syntax character but ×2 doesn't.
         “NOPE!”ṭ     append "NOPE!" to the above list
                 1;   prepend 1 to the above list
                   Y  join by newlines and implicitly print

A recursive Jelly solution, 26 bytes
’ß+_3$ḤµṖṖ$¡
18RÇ€Y⁷“NOPE!

Took the Y⁷“NOPE! trick from Jonathan Allan.
Try it online!

@JonathanAllan In this case it can't. Since Ḥ is a monad Jelly applies it to the right argument of _.

Yeah I noticed :) -- you can use ⁸ but no save there either

Matlab (R2016b), 71 69 bytes
Saved 2 bytes thanks to @Giuseppe (replace 2*(i-2) by 2*i-4)
This version prints exactly as required:
a=1;for i=1:18,fprintf('%d\n',a),a=2*a+max(2*i-4,0);end,disp('NOPE!')

Matlab (R2016b), 53 51 bytes
This version prints the same numbers and the NOPE!, but with a different formatting:
a=1,for i=1:17,a=2*a+max(2*i-4,0),end,disp('NOPE!')

I think max(2*(i-2),0) is equivalent to max(2*i-4,0) which will save a byte or two

05AB1E, 18 17 bytes
X17LDoα·»"NOPE!"»

Try it online!
Explanation
X                  # push 1
 17L               # push range [1 ... 17]
    D              # duplicate
     o             # raise 2 to the power of each
      α            # absolute difference
       ·           # times 2
        »          # join list on newlines
         "NOPE!"   # push this string
                »  # join stack on newlines

Javascript (ES2016), 58 55 54 bytes
Saved 1 byte thanks to @l4m2
Saved 1 byte thanks to @user71546

for(i=0;i<18;l(2**i-i<<!!i++))l=console.log;l("NOPE!")

Uses the formula 2(2n-n) for all n ≠ 0 and 2n-n for n = 0, based on @MrXcoders Python 2 answer
If returning an array of lines is allowed, 54 52 bytes
_=>[...""+1e19].map((_,i)=>i>18?"NOPE!":2**i-i<<!!i)

l(i=1);while(i<18) => for(l(i=1);i<18;)

Change (2<<i)-i-i++ to 2**i-i++<<1 for 1 byte less ;)

MATL, 19 bytes
l17:tWw-E"@]'NOPE!'

Try it online!

Japt, 23 bytes
18Çn2pZ¹*2Ãh1 ·+"
NOPE!

Try it online!

24 bytes
17õ!²i½ í- m*2 ·+"
NOPE!

Try it online!

R, 56 51  39 bytes
cat(1,2*(2^(x=1:17)-x),"NOPE!",sep="
")

Try it online!

Jelly, 19 bytes
1⁷17µ2*_µ€ḤY⁷“NOPE!

A full program printing the result to STDOUT.
Try it online!
How?
1⁷17µ2*_µ€ḤY⁷“NOPE! - Main link: no arguments
1                   - literal 1 (printed as next byte starts a new leading constant chain)
 ⁷                  - literal newline (also printed for the same reason)
  17                - literal seventeen
    µ   µ€          - for €ach n in range -> [1,2,3,...,17]
     2              -   literal two
      *             -   raise to power n  -> [2,4,8,...,131072]
       _            -   subtract n        -> [1,2,5,...,131055]
          Ḥ         - double (vectorises) -> [2,4,10,...,262110]
           Y        - join with newlines (again this is printed, as above)
            ⁷       - literal newline (this is also printed for the same reason)
             “NOPE! - literal list of characters "NOPE!" (no trailing close quote required
                    -  at the end of a Jelly program)
                    - implicit print

Some alternatives exist for 19 bytes, like
‘Ṅ+⁴2*$_$€ḤY⁷“NOPE!

Batch, 89 bytes
@echo 1
@set/ap=2
@for /l %%i in (0,2,32)do @call echo %%p%%&set/ap+=p+%%i
@echo NOPE!

Perl 5, 42 bytes
say for 1,(map 2*(2**$_-$_),1..17),"NOPE!"

Try it online

Bubblegum, 57 bytes
00000000: 04c1 4101 4331 0042 b1fb 5303 94f2 3bff  ..A.C1.B..S...;.
00000010: c696 9850 2c52 6eb1 471a fa1b 9646 9447  ...P,Rn.G....F.G
00000020: f595 e73d bc73 1f27 5fc5 eed5 f0b1 2ab2  ...=.s.'_.....*.
00000030: d8e2 3f3f ff00 5745 00                   ..??..WE.

Try it online!

Java 10, 94 80 bytes
a->{var r="";for(int i=0;i<18;)r+=(i<1?1:2)*((1<<i)-i++)+"\n";return r+"NOPE!";}

Using the formula from Herman Lauenstein's answer.
Thanks to Kevin Cruijssen for golfing 14 bytes.
Try it online here.
Ungolfed version:
a -> { // lambda taking an unused null parameter
    var r = ""; // we build the output as a String
    for(int i = 0; i < 18; ) // generate the sequence
        r += (i < 1 ? 1 : 2) * ((1 << i) - i++) + "\n"; // append 2*(2^i-i) for n > 0, 2^i-i for n = 0
    return r + "NOPE!"; // return the constructed sequence, with NOPE! appended
}

Oh var o=System.out;. I need to remember that one! In this case it's shorter to return a String though: Try it online 80 bytes.

@KevinCruijssen Right. I wasn't sure if this was allowed since the question states "print" and almost all answers print explicitly.

Well, it also states program, in which case interface M{static void main(String[]a){...}} is missing. ;p Since program/function, print/return, and flexible I/O are default when undefined explicitly I usually use that. If the challenge would have stated something alone the lines of "Create a program (no function) that prints the following exactly to STDOUT." I would follow that, but since it's only loosely mentions "program" and "print" without any explicit rules I'll just use the default, in which case a lambda function returning a String (or char-array for all I care) is fine. :)

In almost all languages (especially golfing languages), full programs or functions are similar / same byte-count, and printing is done implicitly (or with Python print is shorter than return), etc. Which is why most languages indeed print. (PS: With older challenges before these defaults were properly defined you will see a lot of full programs, even for Java, and challenges almost always mention program in the description. I usually answer both a program and function in that case, like this answer I recently posted.)

@KevinCruijssen Thanks for your detailed explanation. I will keep this in mind for my answers in the future.

Python 2, 61 bytes
i=0
x=1
print 1
exec"x*=2;print x;x+=i;i+=1;"*17
print"NOPE!"

Try it online
Just search OEIS

That OEIS search reveals a duplicate entry in OEIS.

@JeppeStigNielsen They are not the same. One of the entries starts 1 2 4, while the other starts 1 2 2 4.

You are absolutely right! I even tried editing A132824 to make it a duplicate of A132732, but of course and fortunately that edit was not approved in there. Now I try to just mention in A132824 that a(n) = A132732(n-1) except for initial terms.

C,  71   70  68 bytes
Thanks to @Mr. Xcoder for saving three bytes!
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)<<!!n);puts("NOPE!");}

Try it online!

70 bytes using the latest edit of my Python answer

<<!!n saves two bytes instead of <<(n>0)

Haskell, 50 bytes
(unlines$show<$>1:[2*(2^n-n)|n<-[1..17]])++"NOPE!"

Try it online!

unlines( instead of (unlines$ saves a byte.

Wolfram Language , 82 bytes
DifferenceRoot[Function[{y,n},{4-2 n-2 y[n]+y[1+n]==0,y[1]==1,y[2]==2}]]/@Range@18

This is actually a holonomic sequence whose solution was obtained from
f = FindSequenceFunction[{1, 2, 4, 10, 24, 54, 116, 242, 496, 1006}]

DifferenceRoot[Function[{y,n},{4 - 2 n - 2 y[n] + y[1 + n] == 0, y[1] == 1, y[2] == 2}]]

I don't know why the NOPE! is needed as the sequence does continue
f[19]

524252

"NOPE" is sill required though.

Clean, 92 65 bytes
import StdEnv
Start=("1\n",[(2*(2^n-n),'
')\\n<-[1..17]],"NOPE!")

Trivia: The type that is actually being printed is (String, [(Int, Char)], String)
Try it online!

PHP 5.6+, 65 bytes
<?=1,"\n";for($i=0;$i++<17;){echo 2*(2**$i-$i),"\n";}echo"NOPE!";

Try it online!

SNOBOL4 (CSNOBOL4), 97 83 bytes
	OUTPUT =1
I	X =X + 1
	OUTPUT =LT(X,18) 2 * (2 ^ X - X) 	:S(I)
	OUTPUT ='NOPE!'
END

Try it online!
I'm still not really sure why I had two counters going; I only needed one.

Charcoal, 18 bytes
Ｅ¹⁸Ｉ⎇ι⊗⁻Ｘ²ιι¹NOPE!

Try it online! Link is to verbose version of code. Explanation:
 ¹⁸                 Literal 18
Ｅ                   Map over implicit range
         ²          Literal 2
          ι         Current value
        Ｘ           Exponentiate
           ι        Current value
       ⁻            Subtract
      ⊗             Double
            ¹       Literal 1
     ι              Current value
    ⎇               Ternary
   Ｉ                Cast to string
                    Implicitly print on separate lines
             NOPE!  Literal string
                    Implictly print

Haskell, 47 bytes
unlines[show$2*(2^x-x)-0^x|x<-[0..17]]++"NOPE!"

Try it online!

Bash, 67 characters
echo 1
for((i=0;i++<17;));do
echo $((2*(2**i-i)))
done
echo "NOPE!"

Try it online!

-11 bytes

AWK, 48 bytes
END{for(;i++<17;){print 2*(2**i-i)}print"NOPE!"}

Try it online!

Recursiva, 23 bytes
E++A1mB17"D~^2a"A"NOPE!

Try it online!
E++A1mB17"D~^2a"A"NOPE!  - Implicitly print the evaluated value
E                        - Join with newline
 +                       - Concatenate
  +A1mB17"D~^2a"         - [1, 2, 6, 14... 262142]
  +                      - Concatenate
   A1                    - Listify 1 [1]
     mB17"D~^2a"         - [2,6,14... 262142]
     m                   - map with
      B17                - [1,2...17]
         "D~^2a"         - Function 2(2^n - 1)
                A"NOPE!  - Listify ["NOPE!"]

Perl 6, 35 bytes
{1,{2*(2**++$-++$)}.../21/,'NOPE!'}

Try it
{  # bare block lambda

  1,     # start the sequence with `1`

  {  # bare block used to generate values

    2*(
      2 ** ++$ # 2 to the power of an incrementing state variable
      -
      ++$      # incrementing anonymous state variable
    )
  }

  ...          # keep generating values until

  /21/,        # it generates a value that contains '21'

  'NOPE!'      # continue sequence with string 'NOPE!'
}

Ruby, 43 bytes
->{[1]+(1..17).map{|i|2*(2**i-i)}<<"NOPE!"}

Try it online!
A lambda returning an array of integers (and one string). Breaking out 1 into a special case was pretty cheap, and didn't hurt my brain at all!

Deadfish~, 530 bytes
{iiiii}dc{dddd}ic{iiii}c{dddd}c{iiii}iic{dddd}ddc{iiii}dcdc{dddd}iic{iiii}ciic{dddd}ddc{iiii}iiicdc{dddd}ddc{iiii}dcciiiiic{dddd}ddddc{iiii}ciicddc{dddd}c{iiii}iiciiiiicdddc{dddd}ddddc{iiii}dcdcciiiiiic{dddd}ddddc{iiii}cddciiciiiiiic{dddd}ddddddc{iiii}iicddddc{i}dddcdddc{dddd}ddc{iiii}iiiiiic{d}iiiciiiiiciic{dddd}ddddddc{iiii}dciiiiicdddciiciiic{dddd}ddddddc{iiii}icdciiiiicdddcddddc{dddd}iic{iiii}iiiicdccdddddciiiiiic{dddd}ddddc{iiii}dciicddcdciiiicddddc{dddd}iic{iiii}ciiiicddddcdccdc{dddd}iic{{i}ddd}ddcicic{d}dc{ddd}ddddddc

Try it online!


text:
Is this a valid game of Five Up (Dominoes)?
A set of dominoes consists of tiles with two numbers on them such that every combination of integers from 0 to N are represented. Examples below refer to N=6 out of convenience, but N=9 and N=12 are also common. The orientation of the tiles does not matter (they are usually printed with dots rather than digits), so [1-6] and [6-1] refer to the same tile, of which there is only one in a set.
Most games played with dominoes involve players taking turns adding dominoes to a line of those already played onto the table, such that one of the numbers on the new domino is placed adjacent to the same number at one end of the line on the table. Thus, you might add a [2-5] to either end of an existing line of [2-3][3-3][3-5], producing [5-2][2-3][3-3][3-5] or [2-3][3-3][3-5][5-2].
Many such games require "doubles", dominoes with two of the same number on them, to be placed perpendicular to the other dominoes connected to them. Aside from scoring which we are unconcerned with here, this has no effect except when...
Many of those games then allow the "line" to fork at some or all doubles. Five Up is such a game where the line can fork into 3 new lines at each double, so all four sides of a double might have a matching domino attached.
Here is an example layout of dominoes from a "double 6" set in a game of Five Up (where A|B or A-B is a single domino):
     4
     -
     0

3|0 0|0 0|2

     0
     -
     1

4|1 1|1 1|6
                3
     1          -
     -          6
     5
                6
6|5 5|5 5|0 0|6 - 6|2 2|1
                6
     5
     -          6
     4          -
                4

Your task is to take an list of dominoes in the order in which they were added to the table, and determine whether or not this order represents a legal game of Five Up.
You can write a whole program that takes input from stdin, or a function that takes input as one or more parameters.
Canonical input would be a list or array of two-tuples of integers. A list of lists, array of arrays, vector of tuples, etc are all valid forms in which to take input, as would be a string representing any of the above, or multiple strings. The input will only contain pairs of non-negative integers, valid dominoes.
Output should be a truthy or falsey value, for valid and invalid games respectively.
Your code should accept arbitrarily large domino numbers, within the capabilities of the maximum integer values of your language.
Examples:

0-6 is valid, as is any other single domino
0-6 6-0 is not valid, there is only one 0-6 domino in a set
6-6 6-5 5-3 3-0 is valid, a simple linear arrangement
6-6 6-5 3-0 5-3 is not valid, there is no 3 or 0 in play for the third domino to connect to prior to the 5-3 being played
1-1 1-2 1-3 1-4 1-5 1-6 is not valid, all four open 1 ends are used up leaving nowhere to connect the 1-6
1-1 1-2 1-3 1-4 1-5 3-6 1-6 is valid, the 3-6 connects to the 1-3, then the 1-6 can connect to the 3-6
5-5 5-4 5-0 0-6 6-6 6-4 6-2 2-1 6-3 5-1 1-1 1-6 4-1 1-0 0-0 2-0 3-0 0-4 is valid, the above illustrated example
12-12 12-1 3-12 3-1 1-2 3-3 is valid, uses larger dominoes, and has an ambiguous placement

NOTE: The function required here is not a perfect check for valid Five Up games. We are ignoring here the rules about which domino gets played first, which would require more information about the variant of the game and number of players, and would disqualify a significant minority of inputs.

Do we need to account for geometric constraints on placement, i.e. the domino chain crashing into itself?

@xnor you do not. I forgot to mention the common convention that the "line" can bend arbitrarily for convenience in any game of dominoes. also good for avoiding table edges :)

I think it might be possible to produce a pathological order of play with a double 12 set of dominoes that cannot avoid self intersection. It's definitely possible with larger sets. Let's just ignore those cases. Worst case, they can be solved by bending the line in 3D :)

Do we actually need to be able to handle dominoes that have values >6? If so, could you make that clearer in the spec and maybe add a test case. Otherwise, though, nice challenge - +1 from me.

@Shaggy added a test case for a larger domino

Haskell, 188 174 168 bytes
f(p:r)=[p]!r$p?p
(s!(p:r))o|b<-[p,reverse p]=or[(q:s)!r$q%o|q<-b,elem(q!!0)o,all(`notElem`s)b]
(s!_)o=1<3
p@[x,y]?r=[c|x==y,c<-p]++r
p@[x,y]%(a:r)|a/=x=a:p%r|z<-y:r=p?z

Try it online! Usage example: f [[6,6],[6,5],[5,3],[3,0]] yields True.
Ungolfed:
f :: [[Int]] -> Bool
f (p:r) = check [p] (double p p) r

check :: [[Int]] -> [Int] -> [[Int]] -> Bool
check seen open [] = True
check seen open ([x,y]:r) =
	  notElem [x,y] seen
   && notElem [y,x] seen
   && (elem x open && check ([x,y]:seen) (update [x,y] open) r
   ||  elem y open && check ([y,x]:seen) (update [y,x] open) r)

double :: [Int] -> [Int] -> [Int]
double [x,y] rest =
    if x==y
    then [x,y] ++ rest
    else rest

update :: [Int] -> [Int] -> [Int]
update [x,y] (a:rest) =
    if x==a
    then double [x,y] (y:rest)
    else a : update [x,y] rest

Try it online!

R, 224 bytes
function(L,x=c(),y=c()){o=T
z=length
if(z(L)){p=sort(L[1:2])
w=rep(p,2-(p[2]>p[1]))
x=rbind(p,x)
if(z(y)){m=match(p,y,0)
v=which.max(m)
if(m[v]>0){y=y[-m[v]]
w=w[-v]}}
y=c(y,w)
L=L[-1:-2]
o=o&f(L,x,y)&!sum(duplicated(x))}
o}

Try it online!
The code receives the pieces as an ordered list and returns TRUE or FALSE according to the specs. The function recursively scans every piece, adds the piece to an index to verify the absence of duplicates, and keeps track of the available insertion points to check that the piece can effectively be added to the stack. The handling of piece connections (e.g. attaching a 1-2 by the 1 or by the 2) is done in a greedy fashion, so it is not entirely impossible that some weird configurations may blow up.

unfortunately greediness isn't good enough. consider 6-6 6-3 6-2 2-3 you need to be able to handle this with 2-_ or 3-_ next because the 2-3 could have been placed at either end.

I'll have a look.

source: Stack Exchange

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

sort: votes


text:
XOR sort an array
Given a key, and an array of strings, shuffle the array so that it is sorted when each element is XOR'd with the key.
XOR'ing two strings
To XOR a string by a key, XOR each of the character values of the string by its pair in the key, assuming that the key repeats forever. For example, abcde^123 looks like:
       a        b        c        d        e
       1        2        3        1        2
--------------------------------------------
01100001 01100010 01100011 01100100 01100101
00110001 00110010 00110011 00110001 00110010
--------------------------------------------
01010000 01010000 01010000 01010101 01010111
--------------------------------------------
       P        P        P        U        W

Sorting
Sorting should always be done Lexicographically of the XOR'd strings. That is, 1 < A < a < ~ (Assuming ASCII encoding)
Example
"912", ["abcde", "hello", "test", "honk"]

-- XOR'd
["XSQ]T", "QT^U^", "MTAM", "Q^\R"]
-- Sorted
["MTAM", "QT^U^", "Q^\R", "XSQ]T"]
-- Converted back
["test", "hello", "honk", "abcde"]

Notes

Key will always be at least 1 character
Key and Input will only consist of printable ASCII.
XOR'd strings may contain non-printable characters.
Input and Output may be done through the Reasonable Methods
Standard Loopholes are forbidden.
You may take Key and Input in any order.

Test Cases
key, input -> output
--------------------
"912", ["abcde", "hello", "test", "honk"] -> ["test", "hello", "honk", "abcde"]
"taco", ["this", "is", "a", "taco", "test"] -> ["taco", "test", "this", "a", "is"]
"thisisalongkey", ["who", "what", "when"] -> ["who", "what", "when"]
"3", ["who", "what", "when"] -> ["what", "when", "who"]

This is code-golf, so least bytes wins!

Related nowhere near a dupe though

Are the strings guaranteed to be different?

@Neil Although I can't imagine a situation where them being identical would cause problems, you can assume that all strings will be unique.

@ATaco It can certainly matter if you're not using built-in string comparison.

Should have been called "XORt an array" :p

Jelly, 9 7 bytes
⁹ṁO^OµÞ

Thanks to @EriktheOutgolfer for a suggestion that helped saving 2 bytes!
Try it online!
How it works
⁹ṁO^OµÞ  Dyadic link.
         Left argument: A (string array). Right argument: k (key string).

     µ   Combine the code to the left into a chain.
         Begin a new, monadic chain with argument A.
      Þ  Sort A, using the chain to the left as key.
         Since this chain is monadic, the key chain will be called monadically,
         once for each string s in A.
⁹            Set the return value to the right argument of the link (k).
 ṁ           Mold k like s, i.e., repeat its characters as many times as necessary
             to match the length of s.
  O          Ordinal; cast characters in the resulting string to their code points.
    O        Do the same for the chain's argument (s).
   ^         Perform bitwise XOR.

Python 3, 75 73 bytes
lambda k,x:x.sort(key=lambda s:[ord(x)^ord(y)for x,y in zip(s,k*len(s))])

This sorts the list x in-place.
Thanks to @mercator for golfing off 2 bytes!
Try it online!
Alternate version, 62 bytes
This takes input as byte strings, which may not be allowed.
lambda k,x:x.sort(key=lambda s:[*map(int.__xor__,s,k*len(s))])

Try it online!

In-place sorting saves 2 bytes: x.sort(key=...).

Ruby, 61 bytes
->k,w{w.sort_by{|x|x.bytes.zip(k.bytes.cycle).map{|x,y|x^y}}}

Try it online!

Haskell, 77 bytes
import Data.Bits
import Data.List
t=fromEnum
sortOn.zipWith((.t).xor.t).cycle

Too many imports.
Try it online!

x86 opcode, 57 Bytes
0100  60 89 CD 4D 8B 74 8A FC-8B 3C AA 53 F6 03 FF 75
0110  02 5B 53 8A 23 AC 08 C0-74 0A 30 E0 32 27 47 43
0120  38 E0 74 E8 77 0A 8B 04-AA 87 44 8A FC 89 04 AA
0130  85 ED 5B 75 CE E2 CA 61-C3

    ;input ecx(length), edx(array), ebx(xor-d)
F:  pushad
L1: mov ebp, ecx
L2: dec ebp
    mov esi, [edx+ecx*4-4]
    mov edi, [edx+ebp*4]
    push ebx
L6: test [ebx], byte -1 ; t1b
    jnz L4
    pop ebx
    push ebx
L4: mov ah, [ebx]
    lodsb
    or  al, al
    jz  L7
    xor al, ah
    xor ah, [edi]
    inc edi
    inc ebx
    cmp al, ah
    jz  L6
L7: ja  L8
    mov eax, dword[edx+ebp*4]
    xchg eax, dword[edx+ecx*4-4]
    mov dword[edx+ebp*4], eax
L8: ;call debug
    test ebp, ebp
    pop ebx
    jnz L2
    loop L1
    popad
    ret

Test code:
if 1
    use32
else
    org $0100
    mov ecx, (Qn-Q0)/4
    mov edx, Q0
    mov ebx, S
    call F
    call debug
    ret

debug:pushad
    mov ecx, (Qn-Q0)/4
    mov edx, Q0
    mov ebx, S
E3:   mov esi, [edx]
    push dx
    mov ah, 2
E4:   lodsb
    cmp al, 0
    jz E5
    mov dl, al
    int $21
    jmp E4
E5:   mov dl, $0A
    int $21
    mov dl, $0D
    int $21
    pop dx
    add edx, 4
    loop E3
    ;mov ah, 1
    ;int $21
    int1
    popad
    ret
    align 128
Q0:
    dd str1, str2, str3, str4
Qn:
S     db '912', 0
str1  db 'abcde', 0
str2  db 'hello', 0
str3  db 'test', 0
str4  db 'honk', 0
    align 128
end if
    ;input ecx(length), edx(array), ebx(xor-d)
F:  pushad
L1: mov ebp, ecx
L2: dec ebp
    mov esi, [edx+ecx*4-4]
    mov edi, [edx+ebp*4]
    push ebx
L6: test [ebx], byte -1 ; t1b
    jnz L4
    pop ebx
    push ebx
L4: mov ah, [ebx]
    lodsb
    or  al, al
    jz  L7
    xor al, ah
    xor ah, [edi]
    inc edi
    inc ebx
    cmp al, ah
    jz  L6
L7: ja  L8
    mov eax, dword[edx+ebp*4]
    xchg eax, dword[edx+ecx*4-4]
    mov dword[edx+ebp*4], eax
L8: ;call debug
    test ebp, ebp
    pop ebx
    jnz L2
    loop L1
    popad
    ret

JavaScript ES 6, 113 97 95 Bytes
k=>p=>p.sort((a,b,F=x=>[...x].map((y,i)=>1e9|y.charCodeAt()^(p=k+p).charCodeAt(i)))=>F(a)>F(b))

JavaScript is long at charcoding...
For [0,65536) +1e4 all be 5 digits so can be compared like string

Q=
k=>p=>p.sort((a,b,F=x=>[...x].map((y,i)=>1e9|y.charCodeAt()^(p=k+p).charCodeAt(i)))=>F(a)>F(b))
;
console.log(Q("912")(["abcde", "hello", "test", "honk"]));
console.log(Q("taco")(["this", "is", "a", "taco", "test"]));
console.log(Q("thisisalongkey")(["who", "what", "when"]));
console.log(Q("3")(["who", "what", "when"]));

Threoiy I can use k+=k instead of p=k+p but too many memory using with the small test case

Clean, 101 100 94 bytes
-6 bytes thanks to Ourous!
import StdEnv
? =toInt
s k=let%s=[b bitxor?a\\a<-s&b<-[?c\\_<-s,c<-k]];@a b= %b> %a in sortBy@

Try it online! Example usage: s ['3'] [['who'], ['what'], ['when']].
Ungolfed:
import StdEnv
sort key list =
   let
      f string = [(toInt a) bitxor (toInt b) \\ a<-string & b<-flatten(repeat key)]
      comp a b = f a <= f b
   in sortBy comp list

? =toInt and using ? instead saves 2 bytes, and using a flipped greater-than instead of less-or-equals saves another one.

Even better, saves 6 bytes: TIO

Actually, 24 bytes
O╗⌠;O;l;╜@αH♀^♂cΣ@k⌡MS♂N

Try it online!
Explanation:
O╗⌠;O;l;╜@αH♀^♂cΣ@k⌡MS♂N
O╗                        store ordinals of key in register 0
  ⌠;O;l;╜@αH♀^♂cΣ@k⌡M     for each string in array:
   ;O                       make a copy, ordinals
     ;l;                    make a copy of ordinals, length, copy length
        ╜@αH                list from register 0, cycled to length of string
            ♀^              pairwise XOR
              ♂cΣ           convert from ordinals and concatenate
                 @k         swap and nest (output: [[a XOR key, a] for a in array])
                     S♂N  sort, take last element (original string)

@ATaco No it doesn't. Try it with ["who", "what", "when"] and "thisisalongkey"

@cairdcoinheringaahing That was posted before a patch to Actually on TIO.

Python 2,  204 140 134  126 bytes
Thanks to @Mr. Xcoder for saving 64 bytes, thanks to @ovs for saving six bytes, and thanks to @Dennis for saving eight bytes!
lambda k,l:[x(k,s)for s in sorted(x(k,s)for s in l)]
x=lambda k,s:''.join(chr(ord(v)^ord(k[i%len(k)]))for i,v in enumerate(s))

Try it online!

Perl 6, 37 bytes
{@^b.sort(*.comb Z~^(|$^a.comb xx*))}

Try it online!
$^a and @^b are the key and array arguments to the function, respectively.  @^b.sort(...) simply sorts the input array according to the predicate function it is given.  That function takes a single argument, so sort will pass it each element in turn and treat the return value as a key for that element, sorting the list by the keys of the elements.
The sorting function is *.comb Z~^ (|$^a.comb xx *).  * is the single string argument to the function.  *.comb is a list of the individual characters of the string.  |$^a.comb xx * is a list of the characters in the xor sorting key, replicated infinitely.  Those two lists are zipped together (Z) using the stringwise xor operator (~^).  Since the sorting predicate returns a sort key which is a list, sort orders two elements by comparing the first elements of the returned lists, then the second elements if the first elements are the same, et cetera.

{sort *.comb »~^»$^a.comb,@^b}

C (gcc), 132 128 126 bytes
char*k;g(a,b,i,r)char**a,**b;{r=k[i%strlen(k)];(r^(i[*a]?:-1))-(r^(i[*b]?:-2))?:g(a,b,i+1);}f(c,v)int*v;{k=*v;qsort(v,c,8,g);}

Takes an argument count and a pointer to a string array (the key, followed by the strings to be sorted) and modifies the string array in-place.
The code is highly non-portable and requires 64-bit pointers, gcc, and glibc.
Thanks to @ceilingcat for golfing off 2 bytes!
Try it online!

Perl 5, 80 + 3 (anl) = 83, 67 bytes
sub{$,=shift;sub X{$_^substr$,x y///c,0,y///c};map X,sort map X,@_}

try it online

This repeats the key 9 times, which isn’t enough in general. For example, the output will be wrong for 9; abcdeabcde abcdeabcdz (should give abcdeabcdz abcdeabcde)

@Lynn, fixed adding 3 bytes

could save 16 bytes using subs

Perl 5, 88 bytes
sub{[map@$_[0],sort{@$a[1]cmp@$b[1]}map[$_,substr$_^($_[0]x length),0,length],@{$_[1]}]}

Try it online.

Clojure, 80 bytes
#(sort-by(fn[s](apply str(apply map bit-xor(for[i[(cycle %)s]](map int i)))))%2)

AWK, 285 284 bytes
{for(;z++<128;){o[sprintf("%c",z)]=z}split(substr($0,0,index($0,FS)),k,"");$1="";split($0,w);for(q in w){split(w[q],l,"");d="";for(;i++<length(l);){d=d sprintf("%c",xor(o[k[(i-1)%(length(k)-1)+1]],o[l[i]]))}a[q]=d;i=0}asort(a,b);for(j in b){for(i in a){printf(a[i]==b[j])?w[i]FS:""}}}

Try it online!
Accepts input in the form of key word word ... eg 912 abcde hello test honk
Outputs sorted words space separated
Slightly more readable
{
  for (; z++ < 128;) {
    o[sprintf("%c", z)] = z
  }
  split(substr($0, 0, index($0, FS)), k, "");
  $1 = "";
  split($0, w);
  for (q in w) {
    split(w[q], l, "");
    d = "";
    for (; i++ < length(l);) {
      d = d sprintf("%c", xor(o[k[(i - 1) % (length(k) - 1) + 1]], o[l[i]]))
    }
    a[q] = d;
    i = 0;
  }
  asort(a, b);
  for (j in b) {
    for (i in a) {
      printf(a[i] == b[j]) ? w[i] FS : ""
    }
  }
}

Factor, 85
[ [ dup length rot <array> concat [ bitxor ] 2map ] with
[ dup bi* <=> ] curry sort ]

First try, I'll see if I can golf it further tomorrow.
I accept suggestions ;)

Dyalog APL, 34 bytes
Dfn, uses ⎕ml 3
{⍵[⍋⊃82⎕dr¨⊃≠/11⎕dr¨¨⍵((⍴¨⍵)⍴⊂⍺)]}

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

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


text:
Alternating bit smearing
Introduction
This challenge requires you to set the trailing zeros of an integers binary representation to 010101…, this is best explained with an example:
Given the integer 400, the first step is to convert it to binary:
110010000

As we can see the fifth bit is the least significant 1 bit, so starting from there we replace the lower zeros by 0101:
110010101

Finally we convert that back to decimal: 405
Challenge
Given a positive integer return/output the corresponding resulting value of the above defined process.
Rules

This sequence is only defined for integers with at least one 1 bit, so the input will always be ≥ 1
You may take input as a string, list of digits (decimal) instead
You don't have to handle invalid inputs

Testcases
Here are some more testcases with the intermediary steps (you don't have to print/return these):
In -> … -> … -> Out
1 -> 1 -> 1 -> 1
2 -> 10 -> 10 -> 2
3 -> 11 -> 11 -> 3
4 -> 100 -> 101 -> 5
24 -> 11000 -> 11010 -> 26
29 -> 11101 -> 11101 -> 29
32 -> 100000 -> 101010 -> 42
192 -> 11000000 -> 11010101 -> 213
400 -> 110010000 -> 110010101 -> 405
298 -> 100101010 -> 100101010 -> 298

Can we assume a 32-bit integer?

@Arnauld: Sure!

Some golfing idea: If n is the maximal power of 2 that divides the input, then the answer is simply (input) + ceil((2^n - 2)/3)

Python 3, 20 bytes
lambda n:(n&-n)//3+n

Try it online!
Explanation
Take 192 as an example. Its binary form is 11000000, and we need to convert it to 11010101.
We note that we need to add 10101 to the number. This is a geometric series (4^0 + 4^1 + 4^2), which has a closed form as (4^3-1)/(4-1). This is the same as 4^3//3 where // denotes integer division.
If it were 101010, then it would still be a geometric series (2×4^0 + 2×4^1 + 2×4^2), which is 2×4^3//3 for the reasons above.
Anyway, 4^3 and 2×4^3 would just be the least significant bit, which we obtain by n&-n:
We notice that the complement of n is 00111111. If we add one, it becomes 01000000, and it only overlaps with n=11000000 at the least significant digit. Note that "complement and add one" is just negation.

@Mr.Xcoder nice sportsmanship

Possibly lambda n:(n&-n)//3+n works too? Passes all the sample test cases, but according to my intuition it shouldn't be valid, right?

@Mr.Xcoder it is indeed valid.

Why not use Python 2 to save a byte? TIO

@FlipTack I hate python 2

@LeakyNun haha, who doesn't

Jelly, 5 bytes
&N:3+

Try it online!
This time a port of Leaky Nun's approach (at least I helped him golf it down a bit :P)
Jelly, 7 bytes
^N+4:6ạ

Try it online!
Uses JungHwan Min's fantastic approach, with indirect help from Martin Ender.

Dennis posted, then deleted, a very similar 5-byte solution just after you made that edit. Something like &N:3|. Congratulations; you beat Dennis in Jelly! (But not quite out-golfed.)

@wizzwizz4 I really didn't do much, apart from suggesting a small golf to Leaky's approach and then porting it. But eh :-)

This is the first ASCII-only Jelly answer I've ever seen.

Wolfram Language (Mathematica), 36 28 26 24 bytes
-8 bytes thanks to @MartinEnder and -2 bytes thanks to @Mr.Xcoder
#+⌊(#~BitAnd~-#)/3⌋&

Try it online!
We only need to find the number of the trailing zeroes in the input, and find the number with alternating 0s and 1s with length one less than that, and add it to the input.
So, 400 -> 11001000 -> 110010000 + 0000 -> 110010101 + 101 -> 405
The explicit formula for nth number with alternating 1s and 0s was given in A000975 on OEIS. We can use the nth number since no two different numbers can the same length in binary and have alternating digits.

2^#~IntegerExponent~2 is (BitXor[#,#-1]+1)/2

@MartinEnder wow! And then I can just combine the fractions to reduce more bytes

24 bytes. You can use #+⌊(#~BitAnd~-#)/3⌋& instead.

@Mr.Xcoder edited :)

J, 19 18 bytes
+(2|-.i.@#.-.)&.#:

Try it online!
Quick Explanation
This is an old answer, but it is very similar in nature to the current one, it just counts the trailing zeroes differently. See the comments for a link explaining how it works.
+(2|i.@i.&1@|.)&.#:
                 #:  Convert to binary list
       i.&1@|.       Index of last 1 from right
            |.         Reverse
       i.&1            Index of first 1
    i.               Range [0, index of last 1 from right)
  2|                 That range mod 2
               &.    Convert back to decimal number
+                    Add to the input

Other Answers:
Previous answer (19 bytes).
+(2|i.@i.&1@|.)&.#:

Longer than it should be because \ goes right-to-left.
+(2|#*-.#.-.)\&.(|.@#:)

18 bytes +(2|-.i.@#.-.)&.#:

@miles mind explaining what's going on with the base conversion there? I'm guessing it's got something to do with the zeroes but I'm not sure.

#.~ counts the number of trailing truths, so what we need is #.~ -. #: to count the number of trailing zeroes

@miles Ah! That’s very, very clever.

Julia 0.6, 12 bytes
!n=n|n&-n÷3

Try it online!

This looks like an efficient method, can you explain the operator precedence? For example, I can't tell whether it's evaluated as ((!n=(n|n))&-n)/3, or !n=(((n|n)&(-n))/3), etc.

In Julia, bitwise operators have the same precedences as their arithmetic counterparts, so | is like + and & is like *. Therefore, n|n&-n÷3 is parsed as n | ((n&-n) ÷3).

JavaScript (ES6), 40 39 bytes
Takes input as a 32-bit integer.
n=>n|((n&=-n)&(m=0xAAAAAAAA)?m:m/2)&--n

Test cases

let f =

n=>n|((n&=-n)&(m=0xAAAAAAAA)?m:m/2)&--n

console.log(f(1))   // 1 -> 1 -> 1
console.log(f(2))   // 10 -> 10 -> 2
console.log(f(3))   // 11 -> 11 -> 3
console.log(f(4))   // 100 -> 101 -> 5
console.log(f(24))  // 11000 -> 11010 -> 26
console.log(f(29))  // 11101 -> 11101 -> 29
console.log(f(32))  // 100000 -> 101010 -> 42
console.log(f(192)) // 11000000 -> 11010101 -> 213
console.log(f(400)) // 110010000 -> 110010101 -> 405
console.log(f(298)) // 100101010 -> 100101010 -> 298

R, 71 58 bytes
thanks to NofP for -6 bytes
function(n){n=n%/%(x=2^(0:31))%%2
n[!cumsum(n)]=1:0
n%*%x}

Try it online!
Assumes input is a 32-bit integer. R only has signed 32-bit integers (casting to double when an integer overflows) anyway and no 64-bit or unsigned ints.

You can convert the which.max(n):1-1 to !cumsum(n) to get a 65 bytes solution

@NofP thanks! That's a great idea.

05AB1E, 13 8 5 bytes
Saved 5 bytes thanks to Mr. Xcoder and JungHwan Min's neat formula
Saved another 3 thanks to Mr. Xcoder
(&3÷+

Try it online!
Explanation
(      # negate input
 &     # AND with input
  3÷   # integer divide by 3
    +  # add to input

Maybe worth mentioning that porting the Mathematica answer gives you 8 bytes

@Mr.Xcoder: Ooh, that's a neat formula.

Does 05ab1e have bitwise AND? If so, (<bitwise and here>3÷+ should work for ~5 bytes.

brainfuck, 120 bytes
>+<[[>-]++>[[>]>]<[>+>]<[<]>-]>[-<+>[-<[<]<]>]>[>]<[>+<[->+<]<[->+<]<]>>[<]+>[-[-<[->+<<+>]>[-<+>]]<[->++<]<[->+<]>>>]<<

Try It Online!
Starts with the value in the current cell and ends on the cell with the output value. Obviously won't work on numbers above 255 as that's the cell limit for typical brainfuck, but will work if you assume infinite cell size.

Python 3, 56 bytes
lambda n:eval((bin(n).rstrip("0")+"01"*n)[:len(bin(n))])

Try it online!
Not really happy with this yet, but I really didn't want to use the formula... -2 thanks to Rod. -1 thanks to Jonathan Frech.

eval(...) instead of int(...,2) could save a byte.

PowerShell, 168 bytes
param($n)$a=($c=[convert])::ToString($n,2);if(($x=[regex]::Match($a,'0+$').index)-gt0){$c::ToInt32(-join($a[0..($x-1)]+($a[$x..$a.length]|%{(0,1)[$i++%2]})),2)}else{$n}

Try it online!
Ouch. Conversion to/from binary and array slicing are not really PowerShell's strong suits.
Takes input $n as a number. We immediately convert that to binary base 2 and store that into $a. Next we have an if/else construct. The if clause tests whether a regex Match against 1 or more 0s at the end of the string ('0+$') has its index at a location greater than 0 (i.e., the start of the binary string). If it does, we have something to work with, else we just output the number.
Inside the if, we slice of the xth first digits, and array-concatenate + those with the remaining digits. However, for the remaining digits, we loop through them and select either a 0 or 1 to be output instead, using $i++%2 to choose. This gets us the 010101... pattern instead of 0s at the end. We then -join that back together into a string, and $convert it back into an Int32 from base 2.
In either situation, the number is left on the pipeline and output is implicit.

C, 56 bytes
i,k;f(n){for(k=i=1;n>>i<<i==n;k+=++i&1)k*=2;return n|k;}

Try it online!
C (gcc), 50 bytes
i,k;f(n){for(k=i=1;n>>i<<i==n;k+=++i&1)k*=2;k|=n;}

Try it online!
 51  48 bytes using Arnauld's solution:
Thanks to @l4m2 for saving three bytes!
m;f(n){return n|((n&-n)&(m=-1u/3*2)?m:m/2)&n-1;}

Try it online!
43 with gcc:
m;f(n){m=n|((n&-n)&(m=-1u/3*2)?m:m/2)&n-1;}

Try it online!

0xAAAAAAAA => -1u/3*2

PowerShell, 41 36 bytes
param($n)$n+(($x=$n-band-$n)-$x%3)/3

Try it online! or Verify all test cases
Port of Leaky Nun's Python answer.
Saved 5 bytes thanks to Leaky Nun

APL+WIN, 43 bytes
p←+/^\⌽~n←((⌊1+2⍟n)⍴2)⊤n←⎕⋄2⊥((-p)↓n),p⍴0 1

Prompts for screen input

PHP, 47 bytes
<?php function b($a){echo(int)(($a&-$a)/3)+$a;}

Try it online!
Really just another port of @Leaky Nun's solution

Perl 5, 54 bytes
$_=sprintf'%b',<>;1while s/00(0*)$/01$1/;say oct"0b$_"

Try it online!

Rust, 18 bytes
A port of Leaky Nun's approach
|n:i32|(n&-n)/3+n;

Try it online!

Ruby, 15 bytes
Another port of Leaky Nun's approach.
->k{(k&-k)/3+k}

Try it online!

AWK, 24 bytes
A port of JungHwan Min's Mathmatica  answer
$0=int(and($0,-$0)/3+$0)

Try it online!

JavaScript ES6, 13 bytes
n=>(n&-n)/3|n

f =
n=>(n&-n)/3|n
;
console.log (f(8));
console.log (f(243));
console.log (f(1048576));
console.log (f(33554432));

Pari/GP, 19 bytes
A port of Leaky Nun's approach.
n->n+bitand(n,-n)\3

Try it online!

Vyxal, 39 bitsv2, 4.875 bytes
N⋏3ḭ+

Try it Online!
Bitstring:
011000110010011000101101101111111101001

Jelly, 13 bytes
BŒgṪµ2Ḷṁ×CḄ+³

Try it online!
Explanation
Take 24 as an example input.
BŒgṪµ2Ḷṁ×CḄ+³
B                Binary representation of the input → 11000
 Œg              Group runs of equal length → [[1,1],[0,0,0]]
   Ṫ             Tail → [0,0,0]
    µ            New monadic link
     2Ḷ          [0,1] constant
       ṁ         Mold [0,1] to the shape of [0,0,0] → [0,1,0]
        ×        Multiply [0,1,0] by...
         C       1-[0,0,0]. If last bit(s) of the original input are 1 this will add nothing to the original input
          Ḅ      Convert to decimal from binary → 2
           +³    Add this with the original input → 26


text:
Is it a Satisfying Number?
inspired by this chat conversation
A satisfying number is a number whose decimal representation is of the form abx, with the following properties:

x is the longest trailing repeating suffix, or the last digit if there is no repetition at the end (123333 -> 3333, 545656 -> 5656, 123 -> 3)
b is the single digit prior to x (123333 -> 2, 55545656 -> 4)
a is the remaining prefix (123333 -> 1, 55545656 -> 555)
a == c**b (** denotes exponentation), where c is the number of repetitions of the smallest repeating portion of x (1623333 -> 4 (3 3 3 3, not 33 33))

For example, 8300 is a satisfying number with a = 8, b = 3, c = 2, and x = 00. 24651 is not a satisfying number, because x = 1, b = 5, a = 246, and there is no integer c that satisfies c^5 = 246. 1222 is also not a satisfying number, because with x = 222 and b = 1, there are no remaining digits for a.
Given a positive integer n >= 100, output whether or not n is a satisfying number.
Examples
8300: True (a=8, b=3, c=2, x=00)
24651: False
1222: False
92555: True (a=9, b=2, c=3, x=555)
64633: True (a=64, b=6, c=2, x=33)
512944: True (a=512, b=9, c=2, x=44)
123: True (a=1, b=2, c=1, x=3)
822809: False
376664: False
723799: False
1234: False
34330000000: True (a=343, b=3, c=7, x=0000000)
92313131: True (a=9, b=2, c=3, x=313131)
16424442444: True (a=16, b=4, c=2, x=24442444)

Sandbox

Also somewhat related.

With 8333 is x,c,b,a=33,2,3,8 and therefore satisfying?

@JonathanAllan No, because x is greedy.

OK, thanks, so a is undefined here? (hence not satisfactory?)

@JonathanAllan Exactly. A number having at least two digits before a repeating portion is a necessary condition for being satisfying.

Huh. I’d thought a number like 477223 is satisfying.

Must the number of repetitions be chosen as large as possible? For example, in 1645555, can we choose 55 as the repeated string so that x = 55 55 and  c = 2?

Another test case: 16424442444.

@Zgarb "x is the longest trailing repeating suffix" - as explained in a previous comment, x is greedy.

@Mego But what about c? If x = 5555, c could be 2 (two repetitions of 55) or 4 (four repetitions of 5).

@Dennis I see the confusion now. I'll clarify.

Does longest repeating suffix refer to longest in terms of what is repeated, the number of times it is repeated, the length of all of the repetitions, or does it not matter? So is the longest repeating suffix of 133333 equal to 3 3 3 3 3 or 33 33?

@Dopapp Longest repeating suffix means the longest string at the end of the original string that has repetition. The grouping does not matter for the purpose of determining the longest repeating suffix.

Jelly, 26 bytes
feels too long
DŒṖṖEÐƤḄ$ÐṀLÐṂṪµḢ*@0¦LµṪ⁼Ḍ

A monadic link taking an integer and returning 1 if the input is satisfying and 0 if not.
Try it online! or see a test-suite
How?
DŒṖṖEÐƤḄ$ÐṀLÐṂṪµḢ*@0¦LµṪ⁼Ḍ - Link: integer, n    e.g. 8300
D                          - to decimal list          [8,3,0,0]
 ŒṖ                        - all partitions           [[[8],[3],[0],[0]],[[8],[3],[0,0]],[[8],[3,0],[0]],[[8],[3,0,0]],[[8,3],[0],[0]],[[8,3],[0,0]],[[8,3,0],[0]],[[8,3,0,0]]]
   Ṗ                       - pop (the "no tail" one)  [[[8],[3],[0],[0]],[[8],[3],[0,0]],[[8],[3,0],[0]],[[8],[3,0,0]],[[8,3],[0],[0]],[[8,3],[0,0]],[[8,3,0],[0]]]
         ÐṀ                - keep maximal under the operation: e.g. for [[8,3],[0],[0]]
        $                  -   last two links as a monad:
     ÐƤ                    -     for suffixes:   i.e. [[[8,3],[0],[0]],[[0],[0]],[[0]]]
    E                      -       all equal?         [0              ,1        ,1]
       Ḅ                   -     convert from binary  3
                           -          ...which yields [[[8],[3],[0],[0]],[[8,3],[0],[0]]]
            ÐṂ             - keep minimal under the operation:
           L               -   length
                           -          ...which yields [[[8,3],[0],[0]]]
              Ṫ            - tail (rightmost)         [[8,3],[0],[0]]
               µ           - monadic chain separation
                Ḣ          - yield head and modify    [8,3]   ...leaving [[0],[0]]
                     L     - length (of modified)     2
                    ¦      - sparse application       (to the [8,3])
                   0       -   ...to index: 0         (to the rightmost digit, the 3)
                 *@        -   power (sw@p args)      [8,8]  ([8, 3*@2] = [8, 2*3] = [8,8])
                      µ    - monadic chain separation
                       Ṫ   - yield tail and modify    8   ...leaving [8]
                         Ḍ - from decimal (modified)  8
                        ⁼  - equal?                   1

Don't worry, you're not alone. This piece of unfinished torture should prove my point.

If the Jelly answer is >20 bytes, you know somethings wrong...

Python 3, 141 bytes
a=b=0;k=[]
c=[*input()];l=len(c)
while c[1:]>[]==k:a=a*10+b;b=int(c.pop(0));k=[i for i in range(2,l)if c==i*c[:l//i]];l-=1
a==(k+[1])[0]**b>q

Try it online!
Python 3, 144 bytes
a=b='';k=[]
c=[*input()];l=len(c)
while c[1:]>[]==k:a+=b;b,*c=c;k=[i for i in range(2,l)if c==i*c[:l//i]];l-=1
int(a or-1)==(k+[1])[0]**int(b)>q

Try it online!
output is via exit code

You can alter your while condition to save a byte: TIO

Perl 6, 66 bytes
{/^(\d+?)(\d)((\d+?)$0+||\d)$/&&($2.comb/($2[0]||1).comb)**$1==$0}

Try it online!

JavaScript (ES6), 282 268 bytes

t=(d,n,l,i,r)=>d.slice((m=-l*i)-l,m).join``!=n?r:t(d,n,l,i+1,{p:r.p+n,r:r.r+1});p=(d,l,r)=>l<1?r:p(d,l-1,r.r<(z=t(d,(m=d.slice(-l).join``),l,1,{p:m,r:1})).r&&(z.r>1|l==1)?z:r);u=n=>(d=[...n]).slice(0,(q=(s=d.length)-(m=p(d,s,{p:"",r:0})).p.length-1)).join``==m.r**d[q]

function onChange() {
  var value = document.getElementById("input").value;
  console.log("%s => %s", value, u(value));
}
<input id="input" type="number" onchange="onChange()" />

Python 3, 101 bytes
import re
x,_,b,a=re.findall(r"((.+?)\2+)(.)(.*)",input()[::-1])[0]
if int(a[::-1])!=len(x)**int(b):d

Python 3, 107 bytes
import re
x,_,b,a=re.findall(r"((.+?)\2+)(.)(.*)",input()[::-1])[0]
if int(a[::-1])!=len(x)**int(b):int('')

Output is by exit code.
This code doesn't run properly on Tio due to a range error. Works perfectly in IDLE.

Python 2, 286 bytes
yeesh.
n=`input()`
N=lambda p,l=0:N(n[:-len(p)],p,l+1)if n[-len(p):]==p else l
try:
    s=[(N(n[-i-1:]),n[-i-1:])for i,_ in enumerate(n)if N(n[-i-1:])!=1]
    if len(s)==0:s=[(1,n[-1])]
    q=max(s,key=lambda a:len(a[0]*a[1]))
    i=len(q[0]*q[1])
    print n[:-i-1]==`min(s)[0]**int(n[-i-1])`
except:print 0

N is a recursive function that finds the number of times a suffix substring is repeated in a string. This basically loops through all possible suffixes, finding the number of times each is repeated using N; this excludes all values where N==1 because they refer to no repeats; if the list ends up being empty, the suffix of the last character is appended to the list.
Then, the longest suffix is taken, (q), the number of characters it takes up is found (i), and a==c**b is checked (print ...).
If an error occurs along the way (which it often will), it is caught in the except block.
Any suggestions are more than welcome!


text:
How long will it take Santa to deliver his presents?
I posted this challenge a while ago, which concerns how many elves Santa needs to deliver presents.
Due to population increase, Santa is a little more pressed for time this year. Although in the past we operated very asynchronously, we are beginning to experiment with being more and more synchronized. So, Santa needs to know how long it will take him to deliver presents to each region with a given number of elves.
The weight of coal hasn't changed over the past two years — it's still heavier than presents, so Santa needs three elves per naughty person in the house, and two elves per nice person in the house.
Elves spend all year training for Christmas, so they don't need any rest between deliveries. They can only deliver presents to one house at a time, and must go back Santa's sleigh and collect the next gift before going to the next house. For reasons that I am not at liberty to share, elves do not spend time traveling between Santa's sleigh and houses (but can only travel when Santa's sleigh is on the roof), nor does his sleigh spend time moving from house to house. (Santa's sleigh does needs to move from house to house in order to collect fuel, but I'm already saying too much).
Elves that are delivering presents need to spend four seconds* each delivering the presents, and Elves that are delivering coal need to spend five seconds* each delivering it (as per Santa Aviation Administration regulations, gloves with coal dust on them must be incinerated immediately upon boarding the sleigh, which takes up some time). Additionally, the houses must be visited in the order they are on the map, from left to right, and elves can not begin delivering presents to other houses until all presents have been delivered to the house they are currently at.
If we assumed that Santa had more than enough elves for this region, it would take only as long as it takes to deliver a present to someone on the naughty list, 5 seconds, per house, or 4 seconds per house if everyone is nice.
Yet, as opposed to previous seasons, this coming Christmas Santa may not have more than enough elves for each region, so 4 seconds is the absolute minimum amount of time* that it will take to deliver presents to any given house, unless there are 0 nice people and 0 naughty people in which case it will take 0 seconds.
Additionally, if even one of the houses has someone on the naughty list, Santa will need at least three elves. If at least one of the houses has someone on the nice list and none of them have people on the naughty list, Santa will need at least two elves. If none of the houses are in the Christmas spirit, any number of elves (including 0) will takes 0 seconds.
On Santa's map, a house is represented by a *, and each house is split by a +. Santa still uses the same maps as in the other challenge, but I'll include documentation about them here.
There will be a number on either side of the house - the one on the left representing the number of naughty people in the house, and the one on the right representing the number of nice people in the house. If there is no number on one side it is interpreted as a 0.
I know it may sound crazy, but some people "don't like Christmas", so sometimes, a house may not have a number on either side of it.
One of Santa's maps could look something like this.
1*3+2*+*5+*+4*7

Let's say Santa has nine elves in his sleigh.

(0s) The first house has 1 naughty and 3 nice people. Three of the elves deliver coal, taking five seconds, and six deliver presents, taking four seconds. After five seconds, Santa's sleigh moves to the next house

(5s) The second house has 2 naughty and 0 nice people. Six of the elves deliver coal, taking five seconds. After five seconds, Santa's sleigh moves to the next house

(10s) The third house has 0 naughty and 5 nice people. Eight of the elves go to deliver four presents (the one that is left behind can't deliver a present). After four seconds, all of the elves are back, and two of them go to deliver the other present (the sleigh must wait for the elves to get back before going to the next house), taking another four seconds

(18s) The fourth house is not in the Christmas spirit, so has 0 naughty and 0 nice people, and is skipped

(18s) The fifth house has 4 naughty and 7 nice people. This gets a bit complicated...
I. All nine of the elves go to deliver three gifts of coal (leave t+0s, return t+5s)
II. After 5s, they are all back on the sleigh, and three of them go to deliver the last present of coal (leave t+5s, return t+10s) while the other six of them go to deliver three nice presents (leave t+5s, return t+9s).
III. After four seconds, six of the elves are back and go to deliver three more nice presents (leave t+9s, return t+13s).
IV. One second after they leave, the three elves that were delivering the coal present get back, and two of them leave to deliver the last nice present (leave+10s, return t+14s)

(18 + 14 = 32 seconds) Santa is finished delivering presents to that region.

As we can see, it takes Santa a total of 32 seconds to deliver presents to this region. That was an over-simplified version of one of Santa's maps, though. Normally, Santa's maps have multiple lines, and are in a square shape as to better fit on his list. A normal map might look something like this (a \n at the end of each line)
1*2+*+*4+1*
2*4+3*+1*6+*
*+*+4*2+1*1
*4+*3+1*+2*3
3*10+2*+*5+*

With 26 elves (or any higher amount), it would take Santa 71 seconds.
With 20 elves, it would take Santa 76 seconds.
With 15 elves, it would take Santa 80 seconds.
With 3 elves, it would take Santa 288 seconds.
With 2 elves (or any lower amount), it would be impossible.
Oh, and one more thing — the order in which the elves deliver presents matters (because of the time difference of delivering presents naughty/nice people), so your code should always output the least amount of time that the elves can take delivering presents.
Challenge
Help Santa determine how long it will take for a given number of elves to deliver presents.
Houses

A house is represented by a *
Houses are split by +
The number on the left of the house symbolizes the number of naughty people (no number means 0)
The number on the right symbolizes the number of nice people (no number means 0)
There may be newlines (\n) in the input, which should also be handled as a split

Elves

Santa needs help from three elves for naughty people (coal is much heavier than presents), and it will take these elves five seconds* to deliver the presents
Santa needs help from two elves for nice people, and it will take these elves four seconds* to deliver the presents
If there is no number on either side of the house, Santa will not visit that house, and therefor it will not take any time (people not in the Christmas spirit don't even deserve coal)

Santa

Santa must deliver presents to the houses one-by-one
Santa can not move onto the next house until all of the elves are back on the sleigh and all of the presents have been delivered to that house (we don't want to leave elves behind, now do we?)
Santa's sleigh doesn't spend any time traveling from house to house (Again, for reasons which I am not at liberty to share)

What to do
Given a map of a houses and a number of elves, print how long it will take Santa to deliver presents to the houses on the map.
* (I may not share the amount of time it takes elves to deliver presents. I can neither confirm nor deny that the times included in this challenge are correct)
Rules

There are two inputs — the map and the number of elves. The inputs can be either taken as arguments to a function, or from STDIN or equivalent. If taking two inputs is impossible in your language, then and only then may you accept the two inputs as a single input string, delimited by some character not normally in an input (not one of +*\n or 0-9 — the input string can't be ambiguous) e.g.  ,.
The number of elves will always be a non-negative integer (0 is valid)
The output can either be the return value of a function, or printed to STDOUT or equivalent. If it is impossible for Santa to deliver presents to the given region with a given number of elves, you must output a consistent negative number, or a consistent message without any numbers in it
Everything printed to STDERR will be ignored, so you may not print the result or the error message to STDERR
Your program can not crash given an invalid number of elves for a region
The output should be only the total amount of time it will take Santa to deliver the presents with the given number of elves.
The output should always be the least amount of time it takes for the elves to deliver presents
The input will only contain numbers, +, *, and newlines \n (unless you specify another character which the input will include if your language can't take two inputs (look at the first rule))
Standard loopholes apply

Test Cases
"1*1", 5 elves => 5
"1*1", 3 elves => 9
"1*2", 7 elves => 5
"1*2", 5 elves => 10
"1*2", 3 elves => 13
"2*1", 8 elves => 5
"2*1", 5 elves => 9
"2*1", 3 elves => 14
"1*" , 3 elves => 5
"1*" , 2 elves => (error message)
"*1" , 2 elves => 4
"*1" , 0 elves => (error message)
"*"  , 0 elves => 0

"1*1+1*1",   5 elves => 10
"1*1+1*1",   3 elves => 18
"1*1+*+1*1", 3 elves => 18
"1*2+2*1",   8 elves => 10
"1*2+2*1",   7 elves => 14
"1*2+2*1",   6 elves => 18
"1*2+2*1",   3 elves => 27
"1*2+2*1",   2 elves => (error message)
"*+*+*+*",   2 elves => 0
"*+*+*+*",   0 elves => 0

"1*3+2*+*5+*+4*7", 9 elves => 32

(hopefully I got all of that correct)
Scoring
Santa spends every single day always looking at a lot of things — all of the presents he's going to deliver, all of the elves he has, all of the houses he's delivering presents to... For Santa, the best Christmas present would be being able to see a little bit of a something. For this reason, the shortest submission in bytes wins.
Leaderboard
This is a Stack Snippet that generates both a leaderboard and an overview of winners by language.
To ensure your answer shows up, please start your answer with a headline using the following Markdown template
## Language Name, N bytes

Where N is the size, in bytes, of your submission
If you want to include multiple numbers in your header (for example, striking through old scores, or including flags in the byte count), just make sure that the actual score is the last number in your header
## Language Name, <s>K</s> X + 2 = N bytes

var QUESTION_ID=151568;var OVERRIDE_USER=20634;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(-?\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

I think 288 should read 281: (1+0+0+1+2+3+1+0+0+0+4+1+0+0+1+2+3+2+0+0)*5+(2+0+4+0+4+0+6+0+0+0+2+1+4+3+0+3+10+0+5+0)*4=21*5+44*4=105+176=281 (although I must say I have not read the whole "essay"!)

@JonathanAllan Yea... I accidentally spent way too much time writing the challenge... oops... Anyways, the key thing that's missing is that Santa's sleigh has to wait for all of the elves to get back on board before moving to the next house, so although adding all of the numbers up and multiplying them might work in some cases, it doesn't work in most. For example, with 9 elves the house 4*7 takes 14 seconds (that's covered about half way in the "essay", just before the 2D map is introduced) but (4 * 5) + (7 * 4) = 48

The 288 value is for the example with 3 elves, so they'd always have to perform the full whack of naughty*5+nice*4 at each house, right? (note that there is no 4*7 in that example)

Do the elves always get the coal out of the way first (like in your example) or do they schedule efficiently? For example if the map were 5*15 and there were 9 elves would it take the (minimal) 20 seconds or 22 seconds? See these textual representations to see an illustration of that example.

EDIT to above 5*15 should read 4*15.

@JonathanAllan sorry it took me so long to get back to you. It actually takes 5 seconds per coal and 4 per normal present, but you are correct. For some reason I couldn't for the life of me find an example for which that happened while I was writing the challenge, but I'll update it now. Hopefully this won't make the challenge too complicated.

The QUESTION_ID in the leaderboard has to be 151568 instead of 67600 (that's the old question)

@wastl oops, thanks! Fixed.

Thank god you fixed the leaderboard snippet. I would be worried if I saw somebody on it... :P

@JoKing Yea... I thought this challenge would be a lot easier but it wasn't until I finished accidentally writing a  book that I realized how hard it is.

Am I missing something or should "2*1", 5 elves take 10 seconds instead of 9? You send out 3 elves with coal and 2 with presents but when those two return after 4 seconds they still can't take the final coal out until another elf returns from the first coal delivery.

Also shouldn't 1*1+*+1*1", 3 elves take 18 seconds rather than 10?

@LukeStevens Thanks! I'm not sure why those were incorrect. I've updated the challenge.

@Jojodmo No problem! It might also be worth adding "4*14", 9 elves => 20 as a test case, as my current solution passed all test cases but failed for that!

@Jojodmo Sorryabout this but I keep finding quicker solutions to the test cases as I improve my solution! "1*2", 5 elves can be done in 9 seconds rather than 10 as you can deliver both the present in 4 seconds, then the coal in 5 and "1*2+2*1",   6 elves can be done in 17 rather than 18 by again delivering both presents before the coal for the first house, and both coal before the present for the second house!

@Jojodmo Actually I think "1*2", 5 elves can even be done in 8 seconds if you send out 1 coal and 1 present at the same time, then send out the final present as soon as the elves get back from delivering the first present.

Ruby, 433 400 392 bytes
Well, this one is indeed hard, because it turns out the elf scheduling is NP hard.
Also, please be nice, this is my first submission, so I might have missed some obvious optimizations:
->e,h{h.split(/\+|\n/).map{|h|n,g=h.split(?*).map(&:to_i)+[0,0];return-1if(g>0&&e<2)||(n>0&&e<3);([[3,5]]*n+[[2,4]]*g).permutation.map{|j|c=[0]*e;j.map{|q|w,y=q;i=j=0;r=c.map{|x|a=b=0;c[i..e].map{|r|r<=x ?a+=1:p};(t=i+=1).times{c[t-=1]<=x ?b+=1:p};[a,b]};d=r.inject([]){|k,x|k<<j if x[0]>=w;j+=1;k}.min{|a,b|c[a]<=>c[b]};b=d-r[d][1]+1;z=c[d]+y;(b..(b+w-1)).map{|x|c[x]=z}};c.max}.min||0}.sum}

Try it online!
I initially had longer test cases, but because I'm iterating over all possible permutations for the scheduling in some cases it takes to long, so I removed them.

Welcome to PPCG! You definitely picked a hard challenge for your first answer

Java (OpenJDK 8), 344 bytes
Elf scheduling is more difficult than I thought so this took a little while, and is pretty long.
Despite that, this has definitely been my favourite challenge to code golf!
(e,d)->{int r=0,x,y,c,p,b,g,m;for(String h:d[0].split("\\+")){d=h.split("\\*",-1);b=new Byte("0"+d[0]);g=new Byte("0"+d[1]);m=-1>>>1;for(y=1;y<=e/3&(x=(e-y*3)/2)>0;c=b/y+(b%y++<1?0:1),p=g/x+(g%x<1?0:1),x=c*5>p*4?c*5:p*4,m=x<m?x:m);for(y=0;b+g>0;b-=c,g-=p){c=e/3<b?e/3:b;x=(e-c*3)/2;p=x<g?x:g;if(c+p<1)return-1;y+=c>0?5:4;}r+=m<y?m:y;}return r;}

Try it online (with all tests)!
Explanation;
Brace yourself: It's a long one
    int r=0,x,y,c,p,b,g,m;               // Define all the variables I need

    for(String h:d[0].split("\\+")){     // Split houses on '+' and loop through them

        d=h.split("\\*",-1);             // Split the current house on '*' using the limit
                                         // to preserve empty strings.

        b=new Byte("0"+d[0]);            // Parse the naughty (b) and nice (g) people
        g=new Byte("0"+d[1]);

        m=-1>>>1;                        // Initialise minimum time as max integer using
                                         // overflow

        for(y=1;y<=e/3&(x=(e-y*3)/2)>0;  // For each number of elves that can concurrently
                                         // deliver coal, and still leave enough elves to
                                         // deliver presents

            c=b/y+(b%y++<1?0:1),         // Determine the number of runs needed to deliver
                                         // all coal using this number of elves

            p=g/x+(g%x<1?0:1),           // Determine the number of runs needed to deliver
                                         // all presents using this number of elves

            x=c*5>p*4?c*5:p*4,           // Get the maximum time required for the
                                         // delivery of coal or presents

            m=x<m?x:m);                  // If this is less than the current minimum time,
                                         // set it as the minimum time

        for(y=0;b+g>0;b-=c,g-=p){        // While there are still people to deliver to;

            c=e/3<b?e/3:b;               // Determine the max amount of coal to deliver

            x=(e-c*3)/2;                 // Determine how many presents can be
                                         // delivered with the remaining elves.

            p=x<g?x:g;                   // If this number is more than nice people
                                         // remaining, just use the nice people remaining

            if(c+p<1)return-1;           // If no presents can be delivered, return the
                                         // error code (-1)

            y+=c>0?5:4;                  // Increase the time by 5 if coal was
                                         // delivered, and 4 if only presents

        }                                // At the end of each loop (see above)
                                         // remove the presents and coal delivered
                                         // from the number of naughty and nice houses

        r+=m<y?m:y;                      // Increment the total time by which ever
                                         // is smaller of the calculated times
    }
    return r;                            // Return the total time

NB: This answer depends on my corrections to the test cases being correct

I think (e-y*3)/2 -> e-y*3>>1 saves a byte. (Most likely also applicable to (e-c*3)/2.)

runTest("1*4",5,12); fails (you get "1*4", 5 elves => 13  FAILED. I was amazed at how your algorithm was so good to schedule in so few bytes, so I ran it against all possible combinations of 0 to 7 (elves, naughty and nice) and found just a few where it fails to give the optimal time. This is the smallest combination were it fails. BTW, amazing logic to schedule, for a long while I didn't had any idea how you did it.


text:
Draw me a domino
Challenge
Given two digits 0-9 as input, output a domino (from the double-nine domino set) with these number of pips (dots) on the two faces. The ten possible faces look like this (separated by pipes):
     |     |    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

Or on separate lines:

-----

  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

Input formats
You may take input in any reasonable format, including but not limited to:

Two separate integers, strings, or singleton arrays;
A single integer from 0-99;
An array of two integers;
A string of two digits.

Output formats

The two faces may be horizontally aligned, separated by pipes like so:

    o|o   o
     |  o
o    |o   o

Or they may be vertically aligned, separated by hyphens like so:

    o

o
-----
o   o
  o
o   o

You may output a border around the domino if you wish.
You may also choose to output a list of lines, a list of the two faces, or a combination of these.
You may use any non-whitespace character for the pips (I used o).
If you really wish, you can use 0 for whitespace and 1 for the pips, or False/True (or your language's equivalent) if outputting an array.
You may remove the whitespace between columns; this is a valid output for 7, 7:

ooo|ooo
 o | o
ooo|ooo

Any of the faces may be rotated by 90 degrees. This is also a valid output for 7, 7:

o   o|o o o
o o o|  o
o   o|o o o

You may have as much/little leading/trailing whitespace as you like, as long as the main part of the output still fits the other constraints.
Each face must be 3 lines tall, even if the lines are empty. For 0, 1 you could not output this:

-----

  o

But you could output this:

-----

  o

Similarly, if you were outputting a list of two lists of lines, you could do [["", "", ""], ["", " o", ""]], but not [[""], [" o "]].
Scoring
This is code-golf, so the shortest code in bytes in each language wins.

So, for input [2, 1], I could output [[[0,0,1],[0,0,0],[1,0,0]],[[0,0,0],[0,1,0],[0,0,0]]]?

@Dennis Correct.

Does the separator between the faces have to be dashes, or can it be some other consistent value?

@JoKing  I'll say you can use any consistent  character  other  than  the  ones you're already using.

[0,5,21,29,31] are all important numbers here my friends.

Python 2, 101 97 92 68 64 bytes
lambda*a:[[[n>3,n>5,n>1],[n>7,n%2,n>7],[n>1,n>5,n>3]]for n in a]

Try it online!
Credits

Reduced from 101 bytes to 92 by Mr. Xcoder
Reduced from 92 bytes to 68 by Jonathan Allan (Dennis)
Reduced from 68 bytes to 64 by totallyhuman

@Mr.Xcoder Updated again.

The formatting is optional. Returning a pair of matrices saves at least 22 bytes.

68 bytes with no formatting (note that 0 and False are equal in Python, so it should be OK).

@JonathanAllan Very clever, updated.

64 bytes. If you have to make a lambda, a list comprehension's probably shorter.

@totallyhuman Updated.

61 bytes in Python 3.8 using :=

C (gcc), 252 242 269 262 241 235 220 bytes
I was on stack overflow for sockets in python, when this popped up, said why not? first code golf, so i'm not entirely sure if I followed the rules 100% (and if not and someone wants to steal my proverbial cookie and fix it, so be it). With 'o' and ' ', 255 245 272 265 244 238 228 bytes. replace +48 with *79+32.
#define Q(P,R)(R>>P&1)+48
char a[11];i=0;f(char*c){char b=c[0];a[3]=a[7]='\n';a[5]=Q(0,b);a[1]=a[9]=Q(3,b);a[2]=a[8]=Q(2,b)|a[1];a[0]=a[10]=Q(1,b)|a[2];a[4]=a[6]=a[1]|Q(2,b)&Q(1,b);puts(a);if(i++<1){puts("---");f(c+1);}}

Try it online!
How it works:
I use a bit shift and bitwise and to find if a spot should be clear or a pip, then offset the 0 or 1 to the correct ASCII value. it messes up on 4 and 5, so they needed some fixing. actually added a few bytes. was able to remove several bytes by removing a mask and just using 1 (doh)
Special thanks to Mr. Xcoder for the 7 less bytes by removing an excess #define
Changes: removed memset -21 bytes. redid the bit logic for 6, 4, 2 to depend on 8|4&2, 8|4, 8|4|2, respectively. -6 bytes. removed extra newlines by using puts instead of printf, which is also shorter. shortened the array to 11, removing extra assignment. -15 bytes. NOW I think that's the best I can do.

Welcome to PPCG!

Hi, welcome to PPCG! You can shorten your code a bit further, 245 bytes

'\n' can be replaced by 10. (because in C, char data types are also integer data types) Some char can probably be replaced by int. (or omit entirely)

Down to 184 bytes here but that's still more than the current c golf, so.

173

155 bytes

Jelly, 20 bytes
“¤o.ƤẸʠṚ’B¬s5ŒBị@s€3

Try it online!
Alternate version, original output, 33 32 31 bytes
“¤o.ƤẸʠṚ’ṃ⁾ os5ŒBị@s€3K€€Zj€”|Y

Thanks to @user202729 for golfing off 1 byte!
Try it online!
How it works
First, “¤o.ƤẸʠṚ’ – an integer literal in bijective base 250 – sets the return value to 1086123479729183.
Then, B¬ converts the return value to binary and takes the logical NOT of each digit, yielding the array
00001001000010110100101011110011101111101111100000

Next, s5ŒB splits that array into chunks of length 5, then bounces each chunk, turning abcde into abcdedcba, yielding
000010000 001000100 001010100 101000101 101010101

111000111 111010111 111101111 111111111 000000000

Now, ị@ retrieves the jth and kth item of this array, where j, k is the program's first argument. Note that indexing is 1-based and modular, so the zeroth element is also the tenth.
Finally, s€3 splits each chunk of length nine into three chunks of length three.

Still looks like magic to me, but I appreciate the attempt at an explanation.  I will admit the fault is probably mine as I am just a lowly PHP web developer

The 3 is using 0 for the pips, not 1 like all the others.

“¤o.ƤẸʠṚ’ should work.

@JonathanAllan Thanks! Not sure how that happened...

Jelly, 13 bytes
⁽½ÑD<;ḂŒBs3µ€

Try it online!
Combining Dennis' idea of using ŒB (bounce) in this answer and Xcali's observation in this answer to get 13 bytes.

Jelly, 28 bytes
(with pretty printing)
Only now do I know that Jelly string literal is automatically terminated...
⁽½ÑD<;ḂŒBị⁾o Ks6Yµ€j“¶-----¶

Try it online!

Apparently my approach ⁽½ÑD leads to less bytecount than EriktheOutgolfer's answer “¤¦¢¬‘ here

Wouldn't it be best to reorder the functions so the 13 bytes (outgolfing Dennis) is up top and can be seen more easily?

@Zacharý Temporary solution. Will fix it later.

Perl 5, 107 76 70 67 + 1 (-a) = 67 bytes
$,="
---
";say map{'351
7 7
153'=~s/\d/$_>$&||0/ger=~s/ /$_%2/er}<>

Try it online!
Uses 0 for whitespace and 1 for pips.  Pretty simple method: observe that as the digit goes up, once a pip is "on", it never goes "off," except for the one in the middle.  In the middle position, it is on for all odd numbers.  Thus, for each position, it's a simple matter of checking if the digit is greater than the last digit for which it is off.  The ||0 creates output when the condition is false. In Perl, false is undef which outputs as null.

Nice answer! You can save a couple more bytes too, using map...,<> and |0 (instead of ||0)

PHP 155, 150 bytes
function d($a){foreach($a as$n){$o="---";for($i=0;$x=2**$i,$i<9;++$i)$o.=([0,16,68,84,325,341,365,381,495,511])[$n]&$x?0:' ';echo chunk_split($o,3);}}

It takes an array of integers as the input. For testing:
d([1,2]);

echo "=========\n";

d([0,1,2,3,4,5,6,7,8,9]);

Output Format:
---

 0

---
  0

0

Check it out live here
My Solution
For my solution I used a matrix consisting of bitwise numbers ( powers of 2 ). It can be visualized like this:
 1  |  2  |  4
 8  | 16  | 32
 64 | 128 | 256

And then a storage array consisting of the bit positions for the pips of  each domino correlated by the numbered index:
[0,16,68,84,325,341,365,381,495,511]

So just to clarify:

example 0: index 0 or value 0 would be the blank domino, which is always false.
example 1: index 1 or value 16 would be the number one domino and in the matrix that is in the center 16.
example 2: index 2 or value 68 would be the number two domino and in the matrix that is top right 4 and bottom left 64  or 4|64
example 3: index 5 or value 341 would be the number five domino and in the matrix that is 1|4|16|64|256
example 4: index 9 or value 511 would be the number nine domino and in the matrix its the combination of all the bits.

Once that is established it's a fairly simple matter of looping for the 9 positions in the matrix, and setting $x to 2 to the power of $i
for($i=0;$x=2**$i,$i<9;++$i)

Then we do a bitwise And & as we iterate through those spots.  So for examples sake will use example 2 from above and I will use x's instead spaces for sake of visual clarity:

iteration 1, 68 & 1 ? 0 : 'x' which results in 'x'
iteration 2, 68 & 2 ? 0 : 'x' which results in 'x'
iteration 3, 68 & 4 ? 0 : 'x' which results in 0
iteration 4, 68 & 8 ? 0 : 'x' which results in 'x'
iteration 5, 68 & 16 ? 0 : 'x' which results in 'x'
iteration 6, 68 & 32 ? 0 : 'x' which results in 'x'
iteration 7, 68 & 64 ? 0 : 'x' which results in 0
iteration 8, 68 & 128 ? 0 : 'x' which results in 'x'
iteration 9, 68 & 256 ? 0 : 'x' which results in 'x'

When the loop is complete we wind up with this string "xx0xxx0xx".
Then  we add the border "---xx0xxx0xx" to it ( I actually start with the border, but whatever).
And finally we chunk_split() it on 3's for:
---
xx0
xxx
0xx

Feel free to let me know what you think.

You can shorten it even further by using the exponentiation operator ** introduced in PHP 5.6 instead of pow()
http://php.net/manual/en/language.operators.arithmetic.php

@Daniel - Thanks saved 5 bytes! I wasn't aware they added that, I always try to use the ^ but its the bitwise XOR ... lol

I don't think you are allowed to print an extra border.

show me where it even remotely hints at that in the OP.

I guess this would be shorter operating on $argv. The function overhead in PHP is usually 13 bytes.

JavaScript (ES6), 79 78 bytes
Saved 1 byte thanks to @ETHproductions
Takes input in currying syntax (a)(b) and outputs a vertical ASCII domino.
a=>b=>(g=n=>`351
707
153`.replace(/./g,d=>' o'[(+d?n>d:n)&1]))(a)+`
---
`+g(b)

Demo

let f =

a=>b=>(g=n=>`351
707
153`.replace(/./g,d=>' o'[(+d?n>d:n)&1]))(a)+`
---
`+g(b)

console.log(f(4)(2))
console.log(f(3)(7))

Horizontal version, 80 79 bytes
Saved 1 byte thanks to @ETHproductions
Takes input as an array of 2 integers and outputs a horizontal ASCII domino.
a=>`240|351
686|797
042|153`.replace(/\d/g,d=>' o'[(d<8?(x=a[d&1])>(d|1):x)&1])

Demo

let f =

a=>`240|351
686|797
042|153`.replace(/\d/g,d=>' o'[(d<8?(x=a[d&1])>(d|1):x)&1])

console.log(f([4,2]))
console.log(f([3,7]))

Nice, very similar to what I had. Save a byte with either n>d|0 or (+d?n>d:n)&1

Whoa, I had no idea .replace() could take a function as a replacement. I learn some cool things around here. :)

APL (Dyalog), 25 bytes
2∘|(3 3⍴⊢,,∘⌽)¨>∘3 5 1 7¨

Try it online!
-2 thanks to ngn.
The output format is a little bit weird: this function returns an array containing two shape-3,3 arrays each containing 0s and 1s.

a rewrite for -2 bytes: 2∘|(3 3⍴⊢,,∘⌽)¨>∘3 5 1 7¨

@ngn thanks, that's clever :p

C (gcc), 115 113 bytes
-2 bytes thanks to ceilingcat
i;g(x){for(i=0;9/++i;)printf("%c%c",32+(i^5?x>" CEAG@GAEC"[i]%8:x%2),i%3?32:10);}f(a,b){g(a),puts("-----"),g(b);}

Try it online!

Javascript (ES6), 87 bytes
a=>b=>[(s=n=>[[n>3,n>5,n>1],[n>7,n%2,n>7],[n>1,n>5,n>3]].map(c=>c.map(b=>+b)))(a),s(b)]

f=a=>b=>[(s=n=>[[n>3,n>5,n>1],[n>7,n%2,n>7],[n>1,n>5,n>3]].map(c=>c.map(b=>+b)))(a),s(b)]

<input id=a type=number min=1 max=9 value=1><input id=b type=number min=1 max=9 value=1>

Nice DOMinoes...

Haskell - 88 characters
map$zipWith(zipWith($))[[(>4),(>5),(>1)],[(>7),odd,(>7)],[(>1),(>5),(>3)]].repeat.repeat

Takes a list of two numbers indicating the faces, returns a list of list of list of bool. Not that short but I find the solution interesting.

You can just use map instead of repeat and zipWith: map$(<$>[[(>4),(>5),(>1)],[(>7),odd,(>7)],[(>1),(>5),(>3)]]).map.flip($)Try it online!

Non-pointfree saves two more bytes: Try it online!

Pip, 32 27 24 21 bytes
-3 bytes thanks to @DLosc
FcgP[Yc>_M3517c%2RVy]

Try it online!
Explanation:
F                      For each
 c                       character $c
  g                      in the list of inputs:
   P                     Print
    [               ]      an array consisting of
                             an array of bits representing whether
      c>                       $c is greater than
        _M                       each of
          3517                     3, 5, 1, and 7
     Y                       (call this bit array $y),
              c%2            $c mod 2,
                 RV          and the reverse
                   y           of $y.

Congratulations on winning the Pip bounty! Now that the bounty period is over, I can tell you: save 3 bytes by mapping to a scalar 3517 instead of a list [3 5o7]. ;)

Jelly, 16 bytes
>⁽¤xb8¤;ḂŒḄs3
Ç€

Try it online!
Used Neil's strategy and base decompression to generate the values; outputs as a binary array. Takes a list as input.
Explanation:
Ç€
 € for €ach input,
Ç  execute the previous line.

>⁽¤xb8¤;ḂŒḄs3
 ⁽¤xb8¤       the array [3, 5, 1, 7]
>             1 if the input is greater than each element, 0 otherwise
       ;Ḃ     append input % 2
         ŒḄ   bounce array
           s3 split into chunks of 3

Charcoal, 46 44 43 39 bytes
ＥＥ²℅§@APQTUVW^_ＮＥ⪪Ｅ⁹§ o÷ιＸ²↔⁻⁴λ³⪫λ Ｍ⁵↑⁵

Try it online! Link is to verbose version of code.  Explanation:
ＥＥ²℅§@APQTUVW^_Ｎ

Read two integers and map them in the lookup table. Then map over the result. (This effectively captures the result in a temporary.)
  Ｅ⁹                Loop `l` (!) from 0 to 8
            ⁻⁴λ     Subtract from 4
           ↔        Absolute value
         Ｘ²         Power of 2
       ÷ι           Divide into the looked-up value `i`
    § o             Convert to space or o
 ⪪             ³    Split into (3) groups of 3
Ｅ                   Map over each group
                ⪫λ  Join the 3 characters with spaces

The results are then implicitly printed on separate lines, with an extra blank line between each face because the results are nested.
Ｍ⁵↑⁵

Move up and draw the dividing line in between the faces.
Previous 43-byte horizontal version:
↶Ｐ³Ｍ⁷←ＦＥ²℅§@APQTUVW^_ＮＦ⁹«Ｆ¬﹪κ³⸿⸿§ o÷ιＸ²↔⁻⁴κ

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

Work vertically.
Ｐ³

Print the dividing line.
Ｍ⁷←

Position to the start of the first face.
ＦＥ²℅§@APQTUVW^_Ｎ

Read two integers and map them in the lookup table.
Ｆ⁹«

Prepare to output up to 9 os.
Ｆ¬﹪κ³⸿⸿

But start a new column every three os.
§ o÷ιＸ²↔⁻⁴κ

Convert the lower 5 bits of the ASCII code to binary, and then mirror the output for the remaining 4 os.

The output format is rather liberal, which should save a few bytes.

What is this witchcraft

@Dennis Actually the original output format is the most helpful, as it automatically gives me room to draw the dividing line.

Oh god, there are two Neils.

@Zacharý Actually according to the user page there are eight, or 40 if you include people whose names contain Neil...

You both answered the same question ... o_o

@Dennis OK you win, I found out a way to leave a gap when printing horizontally which lets me save a few bytes.

(I mean vertically don't I. Anyway, I found a slightly more idiomatic formulation.)

C (gcc), 150 146 145 bytes

Saved four five bytes thanks to ceilingcat.

#define p(x)printf(" %c",33-(x)),
P(a){p(a<4)p(a<6)p(a<2)p(23)p(a<8)p(~a&1)p(a<8)p(23)p(a<2)p(a<6)p(a<4)p(23)0;}f(a,b){P(a),puts(" -----"),P(b);}

Try it online!

@ceilingcat Thank you.

@ceilingcat Thankss again.

><>, 57+3 = 60 bytes
>{:3)$:5)$:1)$:7)$:2%$\ao \
\?%cl999)3$)5:$)1:$)7:/nnn<rp

Try It Online. Outputs as a vertical domino with 1s for dots, 0s for whitespace and 9s for separators like so:
001
000
100
999
111
111
111

Technically this can be extended to up to 12 inputted values.
Old Version:
><>, 76+3 = 79 bytes
>{:3)$:5)$:1)$a$:7)$:2%$:7)\&?o~?!n\
\?(*a3la"---"a)3$)5:$)1:$a$/$&:)9::<r~p

Try It Online. Outputs as a vertical domino with 1s for dots and 0s for whitespace like so:
001
000
100
---
111
111
111

Chip, 142 135 bytes
! CvDvB
>v-]-x.
|Z-]-]e
|Z]xe|
|ZR(-'
|Zx.AD
|Zxx]x.
|Zx^-]e
|Z<,(-.
|Zx]xe|
|Zx-]-]e
|Zx-]-x'
|Z<C^D^B
|>x~s
|Zx.
|Zx<
|Zxb
|Z+^~f
`zd

Try it online!
Input is a string of digits. Uses zeroes as the pips. Draws the pips for one number, reads next input byte. If no next byte, terminate, else draw the divider and go to start.
Each Z (or z) corresponds to one character of output, they are positioned to fire in order top to bottom. The capitalized A, B, C, and D correspond to the low four bits of the input (that's all we look at, so "34" == "CD" == "st" ...). The lowercase b, d, e, f correspond to various bits of the output.
Can make infinite-length dominoes too; try giving 0123456789 as input.

Javascript (ES5), 103 characters
(a,b,h=(y=7)=>
  ' o   o ooo'.slice(+y,+y+3))=>
    ['223355','242424245','221155'].map(z=>
      h(z[a])+'|'+h(z[b]))

Linebreaks and whitespace inserted for readability.

APL+WIN,   49   47 bytes
4⌽'|',⌽⍉6 3⍴,⍉(9⍴2)⊤(+\∊0 241 52 24 114,¨16)[⎕]

Edited as per Adam's comment, thanks, to run with index origin zero.
Prompts for screen input as a vector of integers one for each face.
The output is of the form:
1 1 1 | 0 0 1    0 0 0 | 1 0 1
0 1 0 | 0 1 0    0 0 0 | 0 1 0
1 1 1 | 1 0 0    0 0 0 | 1 0 1

for an inputs of 7 3 and 0 5
Explanation:
(+\∊0 241 52 24 114,¨16) create a vector of integers whose binaries
                         represent the dots on the domino faces

[1+⎕] take input integers as indices to select from above vector

⍉6 3⍴,⍉(9⍴2)⊤ convert selected integers to a 9x2 binary matrix and reshape
              to match the orientation of the domino faces

4⌽'|',⌽ rotate, concatenate centre line markers and rotate again to centre

Why not use ⎕IO←0 to save yourself the 1+?

@Adam Why not indeed - lazy ;)

Python 2, 121 bytes
lambda x,y,d="001155777702020202570044557777":[("%03d"%int(bin(int(o))[2:]),"---")[o=="3"]for o in d[x::10]+"3"+d[y::10]]

Try it online!
Reduced to 121 using a lambda after going back and re-reading the rules. Now outputs a list of lines.
Previous version with nicely formatted output:
Python 2, 156 153 147 141 bytes
x,y=input()
d="001155777702020202570044557777"
a=["%03d"%int(bin(int(o))[2:])for o in d[x::10]+d[y::10]]
for x in a[:3]+["---"]+a[3:]:print x

Try it online!
-3 with thanks to @NieDzejkob
Takes input as 2 integers and outputs in vertical format with 0=space and 1=dot.

153 bytes

05AB1E, 34 bytes
•ΩõIº•R2ô¹2÷è¹È-bDg5s-ú.∞3ô»TR„ o‡

Try it online!

This was difficult because 05AB1E has bad padding.

Basic explanation:

There are 4 significant patterns here which are 2, 4, 6 and 8.
3,5,7 and 9 are the other patterns plus 1.
1 is not significant due to symmetry, if the input is even, subtract 1 to toggle the middle bit.
Toggling the LSB allows the middle bit to be flipped due to mirroring.

SmileBASIC, 92 69 bytes
INPUT N,M
DEF Q?N>3;N>5;N>1?N>7;1AND N;N>7?N>1;N>5;N>3
END
Q?777N=M
Q

Example:
? 7,2
111
010
111
777
001
000
100

This is what happens when your rules aren't strict enough.

FALSE, 116 80 78 70 69 66 63 61 59 58 bytes
[$3[>_$.\$]$p:!5p;!1p;!"
"7p;!%1&.."
"..."
"]$s:!"---
"s;!

still working on this...

Pyt, 220 154 bytes
Second attempt (154 bytes)
46281ᴇ8264áĐ9ř3%¬Đ¬2⁵*⇹1ᴇ*+03Ș←Đ3Ș≥Đ6²⁺3**⇹¬2⁵*+⇹9ř5=⇹2%*9²2-*+⇹9ř9<*Ž⇹ŕ⇹9ř3%¬Đ¬2⁵*⇹1ᴇ*+03Ș←Đ3Ș≥Đ6²⁺3**⇹¬2⁵*+⇹9ř5=⇹2%*9²2-*+⇹9ř9<*Ž⇹ŕ5⑴9△*Ƈǰ⇹Ƈǰ64ȘƇǰ6↔ŕ↔ŕ↔

Explanation:
46281ᴇ8264áĐ                                    Pattern matching for every cell but the middle
9ř3%¬Đ¬2⁵*⇹1ᴇ*+03Ș                              Non-pip characters
←Đ3Ș≥Đ6²⁺3**⇹¬2⁵*+⇹9ř5=⇹2%*9²2-*+⇹9ř9<*Ž⇹ŕ⇹     Make top cell
9ř3%¬Đ¬2⁵*⇹1ᴇ*+03Ș                              Non-pip characters
←Đ3Ș≥Đ6²⁺3**⇹¬2⁵*+⇹9ř5=⇹2%*9²2-*+⇹9ř9<*Ž⇹ŕ      Make bottom cell
5⑴9△*Ƈǰ⇹Ƈǰ64ȘƇǰ6↔ŕ↔ŕ↔                          Make boundary and combine

First attempt (220 bytes):
2`↔←Đ4≥Đ6²⁺3**⇹¬5«+2⁵⇹3ȘĐ6≥Đ6²⁺3**⇹¬5«+2⁵⇹3ȘĐ2≥Đ6²⁺3**⇹¬5«+1ᴇ⇹3ȘĐ8≥Đ6²⁺3**⇹¬5«+2⁵⇹3ȘĐ2%Đ6²⁺3**⇹¬5«+2⁵⇹3ȘĐ8≥Đ6²⁺3**⇹¬5«+1ᴇ⇹3ȘĐ2≥Đ6²⁺3**⇹¬5«+2⁵⇹3ȘĐ6≥Đ6²⁺3**⇹¬5«+2⁵⇹3Ș4≥Đ6²⁺3**⇹¬5«+1ᴇ9△ĐĐĐĐ1ᴇ↔⁻łŕ↔ŕŕŕŕŕŕáƇǰ

Explanation:
2                           Push 2 (this is how many 'cells' to make)
`     ... ł                 While the top of the stack is not zero, loop
↔                           Flip the stack (useless at the beginning, undoes the flip at the end of the loop)
←Đ4≥Đ6²⁺3**⇹¬5«+            Set top-left pip
2⁵⇹3Ș                       Space
Đ6≥Đ6²⁺3**⇹¬5«+             Set top-middle pip
2⁵⇹3Ș                       Space
Đ2≥Đ6²⁺3**⇹¬5«+             Set top-right pip
1ᴇ⇹3Ș                       New line
Đ8≥Đ6²⁺3**⇹¬5«+             Set middle-left pip
2⁵⇹3Ș                       Space
Đ2%Đ6²⁺3**⇹¬5«+             Set center pip
2⁵⇹3Ș                       Space
Đ8≥Đ6²⁺3**⇹¬5«+             Set middle-right pip
1ᴇ⇹3Ș                       New line
Đ2≥Đ6²⁺3**⇹¬5«+             Set bottom-left pip
2⁵⇹3Ș                       Space
Đ6≥Đ6²⁺3**⇹¬5«+             Set bottom-middle pip
2⁵⇹3Ș                       Space
4≥Đ6²⁺3**⇹¬5«+              Set bottom-right pip
1ᴇ                          New line
9△ĐĐĐĐ                      Add 5 dashes
1ᴇ                          New line
↔⁻ł                         Decrement counter (if >0, loop; otherwise, exit loop)
ŕ↔ŕŕŕŕŕŕ                    Remove all unnecessary items on the stack
áƇǰ                         Push stack to an array, get characters at unicode codepoints given by values in the array, join characters with empty string

Try it online!

PHP, 116 bytes
while($i<6)echo strtr(sprintf("%03b",[_011557777,_202020267,_044557777][$i/2][$argv[$i%2+1]]),10,"o "),"|
"[$i++%2];

requires PHP 5.5 or later. Run with -nr or try it online.

Vyxal j, 41 bytes
»⟑-⁰ɖṄwi⁋ǏSżƛ»b9ẇ:£?i¥?i3(2p)Jƛ`o -`$i;3ẇ

Try it Online!
A mess.


text:
Be as evil as possible
Introduction
This is a follow-up of this challenge where you're taking the role of that person's evil twin. Being evil you don't want to maximize your share, but rather be as unfair as possible and you're not going to make it too obvious, that's why you came up with the following scheme:
You're going to tell the others that you want to be as fair as possible like your sibling and thus you're going to split the integer into pieces of equal length. So for each integer you will come up with the right amount of people such that the difference between the largest and the smallest piece is maximal.
For example if you're given the integer 6567 you could leave it as is, split it into two pieces 65,67 or four 6,5,6,7. This gives you the following maximal differences:
6567    -> max() = 0
65,67   -> max(|65-67|) = 2
6,5,6,7 -> max(|6-5|,|6-5|,|6-6|,|6-7|,|5-6|,|5-7|,|6-7|) = 2

Since you only want to be evil you don't prefer 67 over 7 and thus you will output either 2 or 4.

Another (less special case); given the integer 121131 you could split it like this:
121131      -> max() = 0
121,131     -> max(|121-131|) = 10
12,11,31    -> max(|12-11|,|12-31|,|11-31|) = 20
1,2,1,1,3,1 -> max(…) = 2

This time there's only one solution - namely 3 - since with three people the difference is maximal.
Challenge
Given an integer determine any possible way of being maximally evil and report the number of people needed to achieve this.
Rules

Input will always be ≥ 1
Input can be either an integer, list of digits or string
You don't have to handle invalid inputs

Testcases
You only need to report the resulting number of people needed, the possible partitions are only for illustration:
In -> splits (difference) -> Out
1 -> [1] (0) -> 1
10 -> [1,0] (1) -> 2
11 -> [11] or [1,1] (0) -> 1 or 2
12 -> [1,2] (1) -> 2
42 -> [4,2] (2) -> 2
101 -> [1,0,1] (1) -> 3
2222 -> [2222] or [22,22] or [2,2,2,2] (0) -> 1 or 2 or 4
6567 -> [65,67] or [6,5,6,7] (2) -> 2 or 4
123000 -> [123,000] (123) -> 2
123001 -> [123,001] (122) -> 2
121131 -> [12,11,31] (20) -> 3
294884 -> [294,884] (590) -> 2
192884729 -> [192,884,729] (692) -> 3
123456189012 -> [123456,189012] (65556) -> 2
123457117346 -> [1234,5711,7346] (6112) -> 3

I wonder if someone will submit a solution in the programming language evil? :D

Jelly,  16  14 bytes
Ṁ_Ṃ
sLÆD$ḌÇÞṪL

A monadic link taking a list of integers (the digits) and returning an integer.
Try it online! or see a test-suite
How?
Ṁ_Ṃ - Link 1, maximal difference: list of numbers
Ṁ   - maximum
  Ṃ - minimum
 _  - subtract

sLÆD$ḌÇÞṪL - Main link: list of numbers, theDigits  e.g. [1,2,3,0,0,1]
    $      - last two links as a monad:
 L         -   length                                    6
  ÆD       -   divisors                                  [1,2,3,6]
s          - split into chunks (vectorises)              [[[1],[2],[3],[0],[0],[1]],[[1,2],[3,0],[0,1]],[[1,2,3],[0,0,1]],[[1,2,3,0,0,1]]]
     Ḍ     - from decimal (vectorises)                   [[1,2,3,0,0,1],[12,30,1],[123,1],[123001]]
       Þ   - sort by:
      Ç    -   call last link (1) as a monad              3             29        122     0
           -                                         ... [[123001],[1,2,3,0,0,1],[12,30,1],[123,1]]
        Ṫ  - tail                                        [123,1]
         L - length                                      2

Yup, I know you don't know Pyth! +1 because Jelly minds think alike! Too bad ŒṖ and ./ are both longer

Pyth, 20 bytes
leoeSaM^N2vcRQ*M{yPl

Try it here!
I no longer use partitions, because it turns out to be longer!!! I ended up splitting into sublists of length equal to the divisors of the length.

05AB1E, 12 bytes
gDÑΣôDδαà}θ÷

Try it online!
05AB1E, 12 bytes
gDÑΣôàsß-}θ÷

Try it online!
How it works

gDÑΣôDδαà}θ÷ | Full program.

g            | Length (count of digits).
 D           | Duplicate (push two copies of the length to the stack).
  Ñ          | Get the divisors (of the top of the stack).
   Σ     }   | Sort by a key function.
--------------------------------------------------------------
    ôDδαà    | Key function #1.
    ô          | Split (the input) into chunks of that size.
     D         | Duplicate.
      δα       | Outer product of absolute difference.
        à      | Get the maximum.
    ôàsß-    | Key function #2 (alternative).
    ô          | Split (the input) into chunks of that size.
     à         | Maximum.
      s        | Swap top two elements.
       ß       | Minimum.
        -      | Subtract.
--------------------------------------------------------------
          θ÷ | Divide the length by the maximum element using the custom sorting.

05AB1E is just incredibly terse for this challenge.

JavaScript (ES6), 118 115 bytes
Saved 3 bytes thanks to @edc65
Takes input as a string.
f=(s,k=l=s.length,m)=>k?f(s,k-1,l%k||(d=Math.max(...a=s.match(eval(`/.{${l/k}}/g`)))-Math.min(...a))<m?m:(r=k,d)):r

Test cases

f=(s,k=l=s.length,m)=>k?f(s,k-1,l%k||(d=Math.max(...a=s.match(eval(`/.{${l/k}}/g`)))-Math.min(...a))<m?m:(r=k,d)):r

console.log(f('1')) // [1] (0) -> 1
console.log(f('10')) // [1,0] (1) -> 2
console.log(f('11')) // [11] or [1,1] (0) -> 1 or 2
console.log(f('12')) // [1,2] (1) -> 2
console.log(f('42')) // [4,2] (2) -> 2
console.log(f('101')) // [1,0,1] (1) -> 3
console.log(f('2222')) // [2222] or [22,22] or [2,2,2,2] (0) -> 1 or 2 or 4
console.log(f('6567')) // [65,67] or [6,5,6,7] (2) -> 2 or 4
console.log(f('123000')) // [123,0] (123) -> 2
console.log(f('123001')) // [123,1] (122) -> 2
console.log(f('121131')) // [12,11,31] (20) -> 3
console.log(f('294884')) // [294,884] (590) -> 2
console.log(f('192884729')) // [192,884,729] (692) -> 3
console.log(f('123456189012')) // [123456,189012] (65556) -> 2
console.log(f('123457117346')) // [1234,5711,7346] (6112) -> 3

Did you try eval instead of RegExp ?

@edc65 I keep forgetting about that one. Thank you!

Python 2, 138 132 bytes
n=input()
l=len(n)
print len(max([[int(n[l/i*j:][:l/i])for j in range(i)]for i in range(1,l+1)if l%i<1],key=lambda a:max(a)-min(a)))

Try it online!

Haskell, 114 bytes
f n|l<-length n=snd$maximum[(a-b,div l i)|i<-[1..l],mod l i<1,a<-i%n,b<-i%n]
i%[]=[]
i%n=read(take i n):i%drop i n

Try it online!

Perl 5, 70 bytes
s%.%/A/g;/$/,map$;[$-=$`-$_]=@1,@1for@1=(/.{@{+}}/gc)x!/./g%eg;$_=pop@

Try it online!

Jelly, 20 bytes
ŒṖL€E$ÐfḌạþ`ẎṀ$$ÐṀḢL

Try it online!