[Question]
      [
## Introduction
[OEIS sequence A127421](https://oeis.org/A127421 "OEIS sequence A127421") is the sequence of numbers whose decimal expansion is a concatenation of 2 consecutive increasing non-negative numbers. Put simply, every number in the sequence is formed by putting together *n* with *n+1* for some non-negative, integer value of *n*. The first several terms are:
>
> 1, 12, 23, 34, 45, 56, 67, 78, 89, 910, 1011, 1112, 1213, 1314, 1415,
>  1516, 1617, 1718, 1819, 1920, 2021, 2122, 2223, 2324, 2425, 2526,
>  2627, 2728, 2829, 2930, 3031, 3132, 3233, 3334, 3435, 3536, 3637,
>  3738, 3839, 3940, 4041, 4142, 4243, 4344, 4445, 4546, …
>
>
>
## Challenge
Given a single positive integer *n*, print the first *n* entries of OEIS sequence A127421 in increasing order.
* Input and output can be in [any acceptable format](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods). Strings or numbers are fine for output.
* Leading zeroes are **not** permitted.
* Either a full program or function is permitted.
* For the purposes of this challenge, *n* will be positive and under 100.
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are disallowed by default.
* This question is code golf, so lowest byte-count wins.
* Here is some sample input and output:
```
1 => 1
2 => 1, 12
3 => 1, 12, 23
10 => 1, 12, 23, 34, 45, 56, 67, 78, 89, 910
```
If you have any questions, don't hesitate to ask. Good luck.
*P.S this is my first challenge, so hopefully this all makes sense.*
*EDIT: Removed output restriction to allow numbers or strings.*

[Answer]
# Twig, 72 bytes
Twig is very verbose, causing some issues when trying to reduce the length.
```
{%macro f(a)%}{%for i in 1..a%}{{o~i}}
{%set o=i%}{%endfor%}{%endmacro%}
```
This requires that "strict variables" is disabled (default).
---
## How to use?
Simply import the macro and call it:
```
{% import "fn.twig" as fn %}
{{ fn.f(<number>) }}
```
You can test it on <https://twigfiddle.com/lah1a5>
[Answer]
# [Haskell](https://www.haskell.org/), 35 bytes
```
f n="1":map(show.(-1+)<>show)[2..n]
```
[Try it online! 1](https://tio.run/##FcbBCgIhEAbgV/nZkxJJdgzdS117gugwsG4rrTOiAz2@1eGDb6P@Tvs@cqnSFDdScndhyQsMTJgt7FjBcfLTpVA1fZOPM0d/sGH@3z7OzvFzFMqMiNoyKxzWn5ZoQQwBr6RXYU2sffjTFw "Haskell – Try It Online")
## Explanation / Ungolfed
The operator `(<>)` is the addition of Semigroups, in case of the Semigroup `a -> b` (where `b` needs to be a Semigroup) it is defined as:
```
(f <> g) = \x-> f x <> g x
```
And in case of the Semigroup `String` it is the same as concatenation, so the code becomes:
```
f n = "1" : map (\x-> show (x-1) ++ show x) [2..n]
```
---
1 (imports `(<>)` since it's not part of the Prelude in GHC 8.2.2)
[Answer]
## TI-Basic, 22 bytes
```
:seq(A,A,1,Ans
:Ans+(Ans-1)10^(1+int(log(Ans
```
[Answer]
# Bash, 56 bytes
```
echo 1;for i in $(seq $(($1-1)));do echo $i$((i+1));done
```
A pretty naive approach.
[Answer]
# [Lua](https://www.lua.org), 62 bytes
```
loadstring't={1}for i=2,(...)do t[#t+1]=(i-1)..i end return t'
```
[Try it online!](https://tio.run/##DcJBCgIxDADArwQ9bIJrsN77EvFQt60ESgMxiwfx7dFhxl6i5xha6stN5nPx/EnfrgaSrysyM1UFvx39lO4Z5ZyIWaDNCtZ8twm@hCi/Tbyhl8dovOnciiNAx3QhgBUO/0QRPw "Lua – Try It Online")
---
### Explanation
This is an anonymous function.
```
t={1} -- initializes the return table, with the number 1 already in it
for i = 2, (...) do -- loop from 2 to the number of the input
                  -- (this is actual code, ... gets the arguments of the program/function
  t[#t+1] = (i-1)..i -- append to the table i-1 concatenated with i
end
return t -- returns the table
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~34~~ 33 bytes
```
->n{$><<i||=p(1);p(i+=1)<n&&redo}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6vWsXOxiazpsa2QMNQ07pAI1Pb1lDTJk9NrSg1Jb/2f1q0oUHsfwA "Ruby – Try It Online")
Pseudocode:
```
loop
  if i is undefined
    set i to 1
    print 1
    print newline
  end if
  print i
  increment i by 1
  print i
  print newline
  if i >= n
    break and return
  end if
end loop
```
[Answer]
# [Swift 4](https://developer.apple.com/swift/), 43 bytes
```
print(1);(1..<n).map{print("\($0)\($0+1)")}
```
[Try it online!](https://tio.run/##Ky7PTCsx@Z@TWqKQp2Cr4JlXolGUmpjik5mXqqGpqKn4v6AoEyhmqGmtYainZ5OnqZebWFANEVSK0VAx0AQR2oaaSpq1//8bAwA "Swift 4 – Try It Online")
`n` is the input of the program
[Answer]
# [Noether](https://github.com/beta-decay/Noether), 15 bytes
```
I(iWi1+W+WP?!i)
```
[Try it online!](https://tio.run/##y8tPLclILfr/31MjMzzTUDtcOzw@wF4xU/P/f0MDAA "Noether – Try It Online")
## Explanation
```
I(             ) - Loop until the top of the stack equals the input
  iW             - Push i and convert it to a string
    i1+W         - Add one to i and convert to string
        +        - Concatenate two strings
         WP      - Convert string to a number and print it
           ?     - Print a newline
            !i   - Increment i
```
[Answer]
**VBA (Excel), 31 bytes**
using immediate window and Cell `[A1]` as input
`for x=1to[a1]:?int(x-1 &x):next`
[Answer]
# [Python 2](https://docs.python.org/2/), 42 bytes
I know there are plenty of shorter answers already.
```
a=0
exec"print`a`[:a]+`a+1`;a+=1;"*input()
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9HWgCu1IjVZqaAoM68kITEh2ioxVjshUdswwTpR29bQWkkrM6@gtERD8/9/QwMA "Python 2 – Try It Online")
[Answer]
# [Pepe](https://github.com/Soaku/Pepe), 68 bytes
```
RrEEEEEREeErREEREEEEEREErEEEEEeEErEEEereEEreeErEEEEEeeEReerREEREeRee
```
[Try it online!](https://soaku.github.io/Pepe/#--iR@F-jFS6!oMIS2/@FD/)
Previous code has errors when giving input 0, so this is fixed!
Explanation:
```
# Preparation
  RrEEEEE # Stack r: [0, 1]

  REeE # Stack R: [input]
# Loop
  rREE # create label input (r flag: skip until REe)
    REEEEE # increment input (loop preparation)
    REE # create label input
      rEEEEEeEE # join all
      rEEEe # move r pointer to last
      reEE # output as int
      reeE # output newline "\n"
      rEEEEEeeE # increment all
    Ree # repeat if input != last content of stack
    rREE # create label input + 1 (r flag: skip until REe)
    REe # stop skipping commands
  Ree # if not 0, go to loop

```
[Answer]
# [Microscript II](https://github.com/SuperJedi224/Microscript-II), 16 bytes
```
1vsN-s{lPps1+v}*
```
Output is newline-separated.
[Answer]
# [Gol><>](https://github.com/Sp3000/Golfish), 11 bytes
```
IFLL?nLPN|;
```
[Try it online!](https://tio.run/##S8/PScsszvj/39PNx8c@zyfAr8b6/39DAwMA "Gol><> – Try It Online")
Explanation:
```
IFLL?nLPN|;
I           //Take a number as input
 F          //Loop as many times as the input specified
  LL        //  Push the loop counter twice to the stack (same as L:)
    ?n      //  Check wether the count is zero, if not print the counter as the first digit
      LP    //  Push the loop counter and add 1
        N   //  Output the next digits of the number with nl
         |; //Exit code
```
[Answer]
# [Dart](https://www.dartlang.org/), ~~46~~ 45 bytes
```
f(n)=>List.generate(n,(e)=>e<1?1:'$e${e+1}');
```
- -1 byte by replacing `e==0` by `e<1`
[Try it online!](https://tio.run/##S0ksKvn/P00jT9PWziezuEQvPTUvtSixJFUjT0cjFSiYamNob2ilrpKqUp2qbVirrmn9vyw/M0UhNzEzT0OzmouzoCgzr0QjTcNQU9MajaegAOcbofGN0fiGBiCB2v8A "Dart – Try It Online")
[Answer]
# [Kotlin](https://kotlinlang.org),  ~~43~~  41 bytes
```
{(1..it).mapIndexed{i,v->"$i$v".toInt()}}
```
[Try it online!](https://tio.run/##NY3BCoMwEETvfsUSPOxCDS29iab0KHjrFwRMZamuElNpEb89DQXnNsxj3msKA0t8vgVGy4LW90sJd@/tt3oEz9Ibgi2DlNUOkDZsJBAUBlpeQpWKgTpueNGaA@nRzo107uO6jU9rYVTO@ap0mBKItO/xeBKoAb2zXcvikOBWgjorOsi/cU7@gAsKUbbH6w8 "Kotlin – Try It Online")
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang), 29 bytes
```
;=n+0P;=i 0W>n iO+0++""i=i+1i
```
[Try it online!](https://knight-lang.netlify.app/#WyI7PW4rMFA7PWkgMFc+biBpTyswKytcIlwiaT1pKzFpIiwiMTAiLCIyLjAiXQ==)
[Answer]
# [Gema](http://gema.sourceforge.net/), 42 characters
```
*=@repeat{*;${n;}@set{n;@add{${n;};1}}$n }
```
Sample run:
```
bash-5.1$ gema '*=@repeat{*;${n;}@set{n;@add{${n;};1}}$n }' <<< 5
1 12 23 34 45
```
[Try it online!](https://tio.run/##S0/NTfz/X8vWoSi1IDWxpFrLWqU6z7rWoTi1BEg7JKakVIMFrA1ra1XyFGr//zc0BQA "Gema – Try It Online")
[Answer]
# [Ly](https://github.com/LyricLy/Ly), 12 bytes
```
Rrp[:u`u' o]
```
[Try it online!](https://tio.run/##y6n8/z@oqCDaqjShVF0hP/b/f1NTAA "Ly – Try It Online")
This is pretty brute force, but short enough to warrant a post I think...
```
R            - generate an inclusive rangefrom "0" to the STDIN number
 rp          - reverse the stack, delete the "0"
   [       ] - for each number on the stack...
    :u       - duplicate number, print it
      `u     - increment the number, print it
        ' o  - print a space
```
# [AWK](https://www.gnu.org/software/gawk/manual/gawk.html), 26 bytes
```
a=$1{for(;a;a--)$a=a a+1}1
```
[Try it online!](https://tio.run/##SyzP/v8/0VbFsDotv0jDOtE6UVdXUyXRNlEhUduw1vD/f2MTAA "AWK – Try It Online")
Turns out that a version in AWK is pretty short too, so here's that one...
```
a=$1                       - stash the number we want
    {                   }  - code always runs if STDIN>0
     for(;a;a--)           - loop for N, N-1, N-2, ... 1
                $a=a a+1   - set positional var to N appended w/ N+1
                         1 - print all the positional vars we just set
```
This really just abuses the fact that AWK will reset the positional variable count if you set them to a value. And it uses a "truthy" condition with no associated code block to print them all.
[Answer]
# [Go](https://go.dev), 122 bytes, using string operations
```
import(."strconv";."fmt")
func f(n int)(o[]int){for i:=0;i<n;i++{k,_:=Atoi(Sprintf("%d%d",i,i+1))
o=append(o,k)}
return o}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VY49CsJAEIX7nGJZEGZJlEQbMaawsxQsRSQk2TDEzCzrxsLgSWyCYOeFvI1GBbF6fPD-LteSu7tJsyotC1GnSLfG6eH0ccLasHUwkgdnM6ajjEdS104qTzeUCQ0kkJwC3mx7bTVbgbMkjHFOMfp-WwW7WbJwjLA29mXRIAf5IJcBBuhHSnmcpMYUlAMHlTp7tnCNJcHn74Ple6e_BEq03qrv2BNo6LM_Gv_R5I-i8IXfvq776BM)
# [Go](https://go.dev), 125 bytes, using formula
```
import."math"
func f(n int)(o[]int){for i:=0;i<n;i++{o=append(o,i*int(Pow10(1+int(Floor(Log10(float64(i)+1)))))+i+1)}
return}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VU9BasNADLz7FYtPsretvUkIpamvPfXge0hgSbyOqC2ZZU0Pxi_pxRTyiDwlv8naTqERCGmGGUb6-S15uDT68KXLQtQaKcC6YeteQlO78Nw68_x67f-4WrtTGJiWDsIACSQXAW934-wMW4FvWbrBd9qglB1numkKOgI_YewlkPO3SkHJcf-omC18cukZU7F26xVgJFU0lkS_9IEtXGupvx9BSSIoVukelJDCTP6KS6DJ5CnyrebjxkcgEl2QWx9WERjwon9o8YCWD0ilHt5Th2GeNw)
Uses the formula \$a(n) = n\cdot10^{1 + \lfloor\log\_{10}(n+1))\rfloor} + n + 1\$ for \$n \ge 0\$.
[Answer]
# SAS
Input is passed by:
```
%let n=123;
```
# 4GL - 38
```
data;
do i=1to &n;x=cats(i-1,i)+0;put x;end;
run;
```
The `data;` and `run;` are obligatory for every 4GL data step, so the code effectively doing the job is in line 2.
# Macrolanguage - 44
```
%macro
m(n,x);%do i=1%to&n;%put&x&i;%let x=&i;%end;
%mend;
```
The `%macro` and `%mend;` are obligatory for every Macroprogram, so the code effectively doing the job is in line 2.
To run macro execute:
```
%m(&n)
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 29 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 3.625 bytes
```
ʀzṅ⌊
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyI9IiwiIiwiyoB64bmF4oyKIiwiIiwiMTAiXQ==)
## Explained
```
ɾzṅ
ɾ   # range [1, input]
 z  # overlapping pairs (equivalent to 2l)
  ṅ # concatenate each pair into a single string
```
]


[Question]
      [
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty sections such that no two adjacent equal values in the initial list are separated into different sections.
For example if the input is `[1,1,0,0,1]` then `[1,1],[0,0,1]` is a valid partition but `[1,1,0],[0,1]` is not since the adjacent `0`s are divided.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the goal is to minimize the size of your source code as measured in bytes.
## Test cases
```
[1,0] ->
  [ [[1,0]]
  , [[1],[0]]
  ]
[1,1,1,1] ->
  [ [[1,1,1,1]]
  ]
[1,1,0,0,1] ->
  [ [[1,1,0,0,1]]
  , [[1,1],[0,0,1]]
  , [[1,1,0,0],[1]]
  , [[1,1],[0,0],[1]]
  ]
```

[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 22 bytes
```
{(&'+1,!2-1_=':x)_\:x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs6rWUFPXNtRRNNI1jLdVt6rQjI+xqqjl4uJKczBUMACTYAhlGQChIQBVpwuO)
`1_=':x` For pairs of adjacent values: are they equal?
`2-` 2 minus that. Gives 2s for the lines between sections and 1s in sections.
`!` odometer. Returns a matrix with all binary patterns bounded by the vector.
`+1,` prepend a 1 and transpose to have the binary patterns with leading 1s in the rows.
`&'` Get indices of 1s for each row.
`(...)_\:x` For each of those integer vectors, split the input at those indices.
[Answer]
# [Factor](https://factorcode.org) + `math.combinatorics math.unicode`, 81 bytes
```
[ dup 2 clump [ Σ 1 = ] arg-where 1 v+n all-subsets [ split-indices ] with map ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PU4xTsQwEOzvFdOjWAcVAiHRIRokhKiiFD5nL1mR2MZe34EQD0E0kRC8gHfQ329wznDaYnZ2dmfn_Wutjbgw7d7u765vrs7wQMHSgC645Nl2GLX0Klk2riVEekxkDUVFTxJ0LOqGZos_Yty4YqvzgE1E9AOLzD6HU_hAIs8-sBWcLxYvOMYSr3ss9d8vc2X2mWRdne5ua7TJ4wRmSKNHjZ-PrF6ggQ5dte0pUOabIws9DFVMq0gS89o-QsW25fl5gy1Ln6N6NMX4u4ZSKgs5uXeRIIEvizRNBX8B)
* `dup 2 clump [ Σ 1 = ] arg-where 1 v+n` get the indices of rising and falling edges
* `all-subsets` take all the subsets of that
* `[ split-indices ] with map` split the input according to each of these
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ITŒP‘œṖ€
```
A monadic Link that accepts a list of ones and zeros and yields a list of the valid partitions.
**[Try it online!](https://tio.run/##y0rNyan8/98z5OikgEcNM45Ofrhz2qOmNf8Ptx@d9HDnDCAz8v//aEMdQx0DIDREggaxAA "Jelly – Try It Online")**
### How?
```
ITŒP‘œṖ€ - Link: list, B  e.g. [0, 0, 1, 1, 0, 1]
I        - deltas (of B)       [  0, 1, 0,-1, 1]
 T       - truthy indices      [     2,    4, 5]
  ŒP     - powerset            [[],[2],[4],[5],[2,4],[2,5],[4,5],[2,4,5]]
    ‘    - increment           [[],[3],[5],[6],[3,5],[3,6],[5,6],[3,5,6]]
       € - for each:
     œṖ  -   partition (B) at  [[[0,0,1,1,0,1]],[[0,0],[1,1,0,1]],[[0,0,1,1],[0,1]],[[0,0,1,1,0],[1]],[[0,0],[1,1],[0,1]],[[0,0],[1,1,0],[1]],[[0,0,1,1],[0],[1]],[[0,0],[1,1],[0],[1]]]
```
[Answer]
# [Curry (PAKCS)](https://www.informatik.uni-kiel.de/%7Epakcs/), 40 bytes
```
f(a++b:c:d)|b/=c=(a++[b]):f(c:d)
f a=[a]
```
[Try it online!](https://tio.run/##Sy4tKqrULUjMTi7@/z9NI1FbO8kq2SpFsyZJ3zbZFsSPTorVtErTAAlypSkk2kYnxv7PTczMU7BVSFOINtQx1DEAQsPY/wA "Curry (PAKCS) – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 6 bytes
```
ĠøṖvvf
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJQQSIsIiIsIsSgw7jhuZZ2dmYiLCIiLCJbMSwwXVxuWzEsMSwxLDFdXG5bMSwxLDAsMCwxXSJd)
Port of @UnrelatedString's Brachylog answer.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 (or 4?) [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
γ.œ€€˜
```
[Try it online](https://tio.run/##yy9OTMpM/f//3Ga9o5MfNa0BotNz/v@PNtQx1DEAQsNYAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c5v1jk5@1LQGiE7P@a/zPzraUMcgVgdIgiGUZQCEhrGxAA).
If we can use strings as I/O, this could be 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) instead by replacing `€€˜` with `J`:
[Try it online](https://tio.run/##yy9OTMpM/f//3Ga9o5O9/v83NDQwMAQA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c5v1jk72@q/zP9rQQMcQCICEgYFhLAA).
**Explanation:**
```
γ       # Split the (implicit) input-list into groups of equal adjacent values
 .œ     # Get all partitions of these groups
   €    # For each partition:
    €   #  For each part of groups within a partition:
     ˜  #   Flatten the part of groups to a single list
        # (or alternatively:)
   J    # Join each list/part of groups within each partition together
        # (after which the result is output implicitly)
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 5 bytes
```
ḅ~ccᵐ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6OmpofbFjzc1Vn7cOuE/w93tNYlJ4NY/6OjDXUMYnWAJBhCWQZAaBgbCwA "Brachylog – Try It Online")
Takes a list through the input variable and [generates](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/10753#10753) a list of lists of lists through the output variable.
```
ḅ        Partition into runs of consecutive equal elements.
 ~c      Take an arbitrary partition of the list of runs,
   cᵐ    and concatenate each slice.
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 20 bytes
```
Ė!|ḅa₀cPl;?b₍↰;Pgᵗ↔c
```
A predicate that takes a list of 0's and 1's as input and outputs each possible partition [one after another](https://codegolf.meta.stackexchange.com/a/9134/16766).
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/qG3Do6bGh7s6H3Ut/X9kmmLNwx2tiY@aGpIDcqztkx419QIVWAekP9w6/VHblOT//6MNdQx1DIDQMBYA "Brachylog – Try It Online")
### Explanation
This seems way too long.
```
Ė!|ḅa₀cPl;?b₍↰;Pgᵗ↔c
Ė!                    Either the input is an empty list (in which case return empty list)
  |                   Or, take the input and...
   ḅ                  Partition into blocks of equal elements
    a₀                Get a prefix of that list of blocks
      c               Flatten it
       P              Call that list P
        l             Take its length
         ;?b₍         The original input with that many elements removed from the front
             ↰        Recurse (returns a list of lists)
              ;P      Pair with P
                gᵗ    wrapped in a list
                  ↔   Reverse the order of the pair
                   c  Flatten once
```
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 65 bytes
```
Q+[E|F]:-append(A,[B,C|D],Q),B\=C,append(A,[B],E),[C|D]+F.
Q+[Q].
```
[Try it online!](https://tio.run/##KyjKz8lP1y0uz/z/P1A72rXGLdZKN7GgIDUvRcNRJ9pJx7nGJVYnUFPHKcbWWQdJIlbHVVMnGiSr7abHBdQaGKv330pXIS2/KDEnRyPaUMdQxwAIDWO1g3QUyosyS1Jz8jSCNDX1/gMA "Prolog (SWI) – Try It Online")
Similar to @alephalpha's Curry answer. Outputs as a list of choicepoints.
[Answer]
# [J](http://jsoftware.com/), 27 bytes
```
<;.1~1,.[:(#:[:i.*/)2-2=/\]
```
[Try it online!](https://tio.run/##y/pvqWhlGGumaGWprs6lpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/baz1DOsMdfSirTSUraKtMvW09DWNdI1s9WNi/2tycaUmZ@QrpCkYKhggmGAI5@oY6hgAoeF/AA "J – Try It Online")
*-1 bytes thanks to the "2 minus" trick stolen from ovs's answer*
Say we have, eg, `1,1,0,0,1` -- then we have 2 "change points" and 4 possible combos. This is *essentially* just the problem of listing:
```
0 0
0 1
1 0
1 1
```
except we want that that list to be embedded in the `X`s of this list:
```
0 X 0 X
```
The key insight is that this is 0..3 converted using the *mixed base* number `1 2 1 2`. After that we just cut the original input using our 4 lists, with a 1 prepended to each.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
Ir0Œpk€
```
[Try it online!](https://tio.run/##y0rNyan8/9@zyODopILsR01r/h9uPzrp4c4ZQObDnYsi//@PNtQx1DEAQkMkaBALAA "Jelly – Try It Online")
Inspired by [Jonathan Allan's solution](https://codegolf.stackexchange.com/a/252314/85334).
```
I          Get the forward differences of the list.
     k     Partition the list after each truthy position
      €    of each element of
   Œp      the Cartesian product of
 r0        the ranges from each difference to 0 inclusive.
```
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ŒgŒṖẎ€€
```
[Try it online!](https://tio.run/##y0rNyan8///opPSjkx7unPZwV9@jpjVA9P9wO0hgBpD5cOeiyP//DXUMdQyA0BAJGgAA "Jelly – Try It Online")
Port of my Brachylog solution.
```
Œg         Partition into runs of consecutive equal elements.
  ŒṖ       Generate every partition of the runs,
    Ẏ€€    and concatenate the runs in each slice.
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 28 bytes
```
(.),(?!\1)
$1#
+%1`#
;$'¶$`,
```
[Try it online!](https://tio.run/##K0otycxL/H9oG9ehbYe2/dfQ09TRsFeMMdTkUjFU5tJWNUxQ5rJWUT@0TSVB5/9/Qx0DLkMdMATTBkBoCAA "Retina 0.8.2 – Try It Online") Link includes test cases. Outputs semicolon-delimited lists. Explanation:
```
(.),(?!\1)
$1#
```
Find all acceptable cutting points.
```
+
```
Loop until each cutting point has been processed.
```
%
```
Loop over each partially cut list.
```
1`
```
Only process the first remaining cutting point on each pass.
```
#
;$'¶$`,
```
Create two lists, one cut at that point, one not cut at that point.
[Answer]
# [Perl 5](https://www.perl.org/), 80 bytes
```
sub{@p=pop=~/0+|1+/g;$s="@p";map$s=~s, ,$r=$_%2?$&:'';$_/=2;$r,ger,0..2**@p/2-1}
```
[Try it online!](https://tio.run/##VY9RT8IwFIWf3a84aQpjUFiZ4YWmshefTXhVQjTZyFS22s5Eg/DX5@02QPvQfPeec09vTWbfF83@GzzXjft8OaRGm8roUywnP/NJvFPcaZYapvbPhvDkBAS3mm8HyYoPl2Go@DbWieJW7DIr5GyWjMepiZPp/NioIK8sfHqduRqjAMAjEM5lSAR916KgG9TZiItOJ@z1Dv35q0tJ3U736CMo40xS4tojxCaIDn6YdhnxojQizb5MpNN2L9UrSHdVDY0hz1tTdBE4uV1t9WtVlD63Hb@qNPZfpUanGluUdQ42mC4cKHKJlgCa93wrfUF2KtxTyURw07@F7OMcjBVY9cawBLtfrx/Wrct/4mL21HlVcGx@AQ "Perl 5 – Try It Online")
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang) (v2), 125 bytes
```
;=lL=p+=a@P;W=l-lT|?Gp lT Gp-lT1=a+a,l;=n^2LaW+1=n-nT;=x!=b+=o@p;=kLa;W+=k-kT1&%/n^2k 2;=o+o,GbF=d+~x=x[Ga kT=bSbFd@;D+o,bO''
```
[Try it online!](https://knight-lang.netlify.app/v2#WyI7PWxMPXArPWFAUDtXPWwtbFR8P0dwIGxUIEdwLWxUMT1hK2EsbDs9bl4yTGFXKzE9bi1uVDs9eCE9Yis9b0BwOz1rTGE7Vys9ay1rVDEmJS9uXjJrIDI7PW8rbyxHYkY9ZCt+eD14W0dhIGtUPWJTYkZkQDtEK28sYk8nJyIsIjExMDAxIl0=)
Input as a binary string. Outputs each partition on a separate line.
This probably is not even the golfiest strategy lol, but whatever. The general strategy is to construct a list `a` that contains the possible indexes that can be cut at (the easy part), then enumerate over all possible combinations of cuts using `a` (the annoying as f\*\*\* part).
[Answer]
# [Haskell](https://www.haskell.org/), 94 bytes
```
import Data.List
f l=nub[w|w<-subsequences[id=<<x|x<-tails=<<(inits.group)l,x>[]],(w>>=id)==l]
```
[Try it online!](https://tio.run/##jYqxDoIwFEV3vuKFOEACBPeWyZHNselQpOiLpUD7Ghj490p0cjHmDDcn9zyUf2pjYsRxnhzBRZGqWvSUDGC4DZ1Y95WVPnReL0Hbm/YCe87Ytm@sJIXGH5KhRfLV3U1hzk2xNULKIlubhmOfc25kHBVa4NBPCcwOLcEJBnEuanl4oCu51kKafp9vfgf1wT/JZ2V8AQ "Haskell – Try It Online")
Corrected as x specifications.
Thanks to @Wheat Wizard for saving some bytes using *id=<<x* instead of concat.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 45 bytes
```
⊞υ⟦Ａ⟧ＦυＦ…ι¹Ｆ²Ｆ⁺¹⌕Ａ⪫κω⁺Ｉλ¬λ⊞υ⁺⟦…κμ✂κμ⟧ΦιξＥυ⭆¹ι
```
[Try it online!](https://tio.run/##RU7LCsIwELz3K3LcQATjtScpCApKoceQQ4jVBtekpImPr49Jrbh7GGZ3Z2b1oLx2ClNq4zRAZETs7RgDUEnr6uI8gUjJjM1bY98MbgTDCKfLdLNgi3ECzsjO2PMWEQ7OWLgx8qSMzLtGTQEws5MrWIr8MucD8Q/Iunu@7NDo/ktkccbQ@xL@ytq6ar2xAY5qLA5dyOxaSP7BlH1KQnDG2To3lzKtHvgB "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
⊞υ⟦Ａ⟧
```
Start with the original list, which is always a valid partition.
```
Ｆυ
```
Loop over the partitions found so far.
```
Ｆ…ι¹
```
Loop over the lists in the current partition, but stop after the first. (This is a sneaky way of getting the first list into a variable.)
```
Ｆ²
```
Loop over the possible first bits of a cutting point.
```
Ｆ⁺¹⌕Ａ⪫κω⁺Ｉλ¬λ
```
Loop over all of the possible cutting points that start with that bit. The cutting point is in between the bits, thus the extra `1` added to the positions. (`Incremented` works on empty lists in the newer version of Charcoal on ATO which would save a byte.)
```
⊞υ⁺⟦…κμ✂κμ⟧Φιξ
```
Cut the first list of the partition at that point and push the resulting partition to the list of partitions where it will be reevaluated for cutting.
```
Ｅυ⭆¹ι
```
Pretty-print all of the found partitions.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 11 10 bytes
```
mmrk9d./r8
```
[Try it online!](https://tio.run/##K6gsyfj/Pze3KNsyRU@/yOL/f3VDQwMDQ3UA "Pyth – Try It Online")
### Explanation
```
        r8    length encode the implicitly evaluated input
      ./      get all partitions
mmrk9d        map length decoding to each partition element
```
[Answer]
# [Python](https://www.python.org), 230 bytes
```
from itertools import*
import re
def f(M):L=re.split(r'((.)\2*)',''.join(map(str,M)))[1::3];l=len(L);I=[*range(1,l)];return[[M]]+[[[int(c)for c in''.join(L[i:j])]for i,j in pairwise([0,*P,l])]for s in I for P in combinations(I,s)]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NZBBTsQwDEX3c4rsapdQTWGDWvUAlVpp9iGLUlJwlSaRkxHiLGxmA6fgIlyAc9BqqLzwl5_lb_vjK7ynV-8ul89zmm4ffn4n9ougZDh5b6OgJXhO-eGaBZvDs5nEBD1WXcOmiMFSAs4ACny8yzGTWVbMnhwsQ4CYWPaIqMqqute1baxx0GHdNirnwb0YKKVFXbNJZ3ZK9VrfKKXIJRhx8ixGQW4f2CmqZo16q5OcVyLCQPxG0YA6yvwk7T-NG2vFJk-bHP3yRG5I5F2EVkbU12u_Vb5tGXg1lBOoUpbyuEapcW_ZH_MH)
Python 3.10+ required for `pairwise`.
for `[1,1,0,0,1]` returns:
```
[[[1, 1, 0, 0, 1]],
 [[1, 1], [0, 0, 1]],
 [[1, 1, 0, 0], [1]],
 [[1, 1], [0, 0], [1]]]
```
ungolfed:
```
from itertools import *
import re
def f(M):
  # produce ['11', '00', '1'] by splitting on regex which checks 2 consecutive duplicates
  L = re.split(r'((.)\2*)',''.join(map(str,M)))[1::3]
  l = len(L)
  indexes = [*range(1,l)]
  return [[M]]+[
    # wrap list for each consequtive pair of index combos and convert back from string
    [[int(c) for c in ''.join(L[i:j])]
      for i,j in pairwise([0,*partition_indexes,l])]
    for partition_size in indexes
    for partition_indexes in combinations(indexes,partition_size)
  ]
```
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata), 4 bytes
```
ĉJᵐj
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHFZtJJurlLsgqWlJWm6FsuPdHo93Doha0lxUnIxVGzB7mhDHYNYLiAJhlCWARAaxkKUAAA)
A port of [@Unrelated String's Brachylog answer](https://codegolf.stackexchange.com/a/252326/9288).
```
ĉ       Partition into runs of consecutive equal elements.
 J      Take an arbitrary partition of the list of runs,
  ᵐj    and concatenate each slice.
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), 71 bytes
```
f=([x,...y],z='')=>x?f(y,z+x)|f(y,[z,x]):/^,|1,1|0,0/.test(z)||print(z)
```
[Try it online!](https://tio.run/##FcZBCoAgEADAex/RpU3dWxTWQ6IgIqEOESVisn83nNOca1jf7Tlu34Q2Z2flFFEp9c2YrBBghzg6@WGqI3DJlDDO0OkFmZDYoNHK76@XCZjv57jKcl85KYiMIQH5Bw "JavaScript (V8) – Try It Online")
Seems they look same
# [JavaScript (V8)](https://v8.dev/), 72 bytes
```
f=([x,...y],z='')=>x?f(y,z+x)|f(y,z+[,x]):/^,|1,1|0,0/.test(z)||print(z)
```
[Try it online!](https://tio.run/##JcZBCoAgEADAex/Rpc3cWxTWQ6JAIsEOESVhsn83ojnNZm97Lac/QnU3OTsjx4hKqWfCZIQA08fByQdTGYH/jBgnaOsZmZBYo65VWK8gEzAfp9@/5a5wUhBpTQLyCw "JavaScript (V8) – Try It Online")
]


[Question]
      [
Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted).
Your random sample should be uniformly sampled from all lists of n non negative integers that sum to one hundred.
Your code should run in a reasonable amount of time (e.g. should terminate on TIO) for n less than a 200 . This is just to prevent brute force solutions.
# Examples
If n=1 the code should always output 100
If n=2 the code should output 100,0 or 99,1 or 98,2 or 97,3 ... or 2,98 or 1,99 or 0,100 with equal probability. There are 101 different possible outputs in this case.
If n>100 then some of the values in the output will necessarily be 0.

[Answer]
# [R](https://www.r-project.org), 64 bytes
```
\(n,m=rle(c(1,sample(!c(1:99,!1:n-1)),1)))c(m$l[!m$v],!1:n)[1:n]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=jU9BasMwELzrFTINRgsK2IVC4yLoP9IghKLYTiTFSOuSUvqSXtxDH5U_9BGVrR56aw_aXWZnZkfvH2G60qjcYI3sPZrWhCixUyjVfi_xLOuqEp8jHtb318cn5rkTwRqmWc2zihVpbjYbXtSNX9cAPD3QzK3stnCr592ygG0qux-fLzQRpRe3d4TcUHNZfGgYfUP-SMKyEmad7ow-0ZlAlbVpMNQa32IXqQrJrm87pOWCx9H9AhuS-CyqYbAvKXqyrfhh9Br7s2cXeD2Kf6Z4yPfYEYTIEC3L-diCJOIbAMl_nqbcvwE)
Implementation of 'sticks-and-stones' as suggested by xnor.
**Ungolfed**
```
function(n){
    w=rep(0:1,times=c(n-1,100)) # n-1 zeros, followed by 100 ones
    x=sample(w)                 # randomly shuffle it
    y=c(0,x,0)                  # and add zeros at the start & the end
    m=rle(y)                    # get the lengths of runs of 1s and 0s
    o=m$lengths[m$values==1]    # lengths of the runs of ones
    p=m$lengths[m$values==0]-1  # lengths of the runs of zeros, minus 1
    q=sum(p)                    # so q is the number of zero-length runs of 1s
    z=rep(0,q)                  # repeat zero that many times
    return(c(o,z))              # and return the concatenation of the runlengths of 1s and the zero-length runs
}
```
**Golfing tricks**
`rep(0:1,times=c(n-1,100))` -> `!c(1:99,!1:n-1)`
`c(m$lengths[m$values==1],rep(0,sum(m$lengths[m$values==0]-1)))` -> `c(m$l[!m$v],!1:n)[1:n]`
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 46 bytes
```
@(n)diff([0,sort(randperm(n+99,n-1)),n+100])-1
```
[Try it online!](https://tio.run/##y08uSSxL/Z@mYKugp6f330EjTzMlMy1NI9pApzi/qESjKDEvpSC1KFcjT9vSUidP11BTUydP29DAIFZT1/B/moaRgYHmfwA "Octave – Try It Online")
Based on [@xnor](https://codegolf.stackexchange.com/users/20260/xnor)'s comment. But instead of shuffling a list of zeros and ones, here I generate a random permutation of `1:n+99`, and see the first `n-1` terms as the positions of zeros.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 16 bytes
```
lMc.S+*100N*tQdd
```
[Try it online!](https://tio.run/##K6gsyfj/P8c3WS9YW8vQwMBPqyQwJeX/f2MDAA "Pyth – Try It Online")
Based on xnor's comment.
* `*100N`: 100 `"` characters
* `*tQd`: n-1 space characters
* `.S+`: Concatenate, shuffle
* `c ... d`: Split on spaces
* `lM`: Map to lengths of remaining pieces
[Answer]
# [J](http://jsoftware.com/), 27 bytes
```
0+/;.1@,1 0({~#?#)@#~100,<:
```
[Try it online!](https://tio.run/##y/pvqWhlGGumaGWprq7g56Sn4JKfp16ikJZZoVCUmJeSn6tQnJqaoselpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DbT1rfUMHXQMFQw0quuU7ZU1HZTrDA0MdGys/mtypSZn5CukKZjCGEYGMBZQyX8A "J – Try It Online")
Sticks and stones method thanks to [xnor's idea from the comments](https://codegolf.stackexchange.com/questions/247970/sample-integers-that-sum-to-one-hundred#comment554669_247970).
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~125~~ ~~120~~ 115 bytes
* *-5 bytes thanks to @ceilingcat*
```
i=99,j,a[];main(n){scanf("%d",&n);n+=i;for(srand(&n);a[rand()%n]++||i--;);for(;i<n;)j=a[++i]?j+1:!printf("%d ",j);}
```
An implementation of xnor's suggestion in C.
[Try it online!](https://tio.run/##HYxBCsIwEAC/ooVKwiYH8VTX4ENCDktKyoa6SiJ4sH7diLkNwzDRxpVkaY3dNJlsyAe8EYsS/a6RJKlhnAdzEI0CjjHdi6qFZFZ/Rb6jHiUAbBtbi7onyBdBnR15AA7XDMfz/lFYnv23G0zW@Gnt9I1ppaU2@/oB "C (clang) – Try It Online")
[Answer]
# [Desmos](https://desmos.com/calculator), 77 bytes
```
l=[2...n]
L=join(0,[1...99+n].shuffle[l[l0+n>1]].sort,100+n)
f(n)=L[2...]-L-1
```
Uses xnor's Stars and Bars idea.
[Try It On Desmos!](https://www.desmos.com/calculator/yftw79pgpc?nographpaper)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/npcsficqdl?nographpaper)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
т∍ú¦.r#€g
```
Inspired by [*@isaacg*'s Pyth answer](https://codegolf.stackexchange.com/a/248041/52210), using [*@xnor*'s approach](https://codegolf.stackexchange.com/questions/247970/sample-integers-that-sum-to-one-hundred#comment554669_247970).
[Try it online](https://tio.run/##yy9OTMpM/f//YtOjjt7Duw4t0ytSftS0Jv3/f1MA) or [verify a few random outputs at once](https://tio.run/##yy9OTMpM/X@xyUevyOLQ4otNFUd3HFqmV2R0aPGh1dVlSp55BaUlVgpK9pU6XEr@pSUwngtQy6OO3sO7QIqVHzWtSf@vc2ib/X8A).
**Explanation:**
```
 ∍         # Extend the (implicit) input
т          # to length 100
           # (resulting in a string - e.g. n=50 becomes "505050...50")
  ú        # Pad this string with the (implicit) input amount of leading spaces
           # (it's important to note that `∍` results in a string instead of integer,
           # otherwise this would have resulted in "50" with 505050...50 amount of
           # leading spaces instead)
   ¦       # Remove the first space, so there are input-1 amount of spaces
    .r     # Randomly shuffle the characters in this string
      #    # Split it on spaces
       €g  # Get the length of each inner string
           # (after which the result is output implicitly)
```
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 82 bytes
```
n->Vec(Ser(concat([Set(numtoperm(m=n+99,random(m!))[1..n-1]),m+1]))*(y=1-x)-1/y,n)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728ILEoMz69YMHiNAXbpaUlaboWN4PydO3CUpM1glOLNJLz85ITSzSig1NLNPJKc0vyC1KLcjVybfO0LS11ihLzUvKBPEVNzWhDPb08XcNYTZ1cbSCpqaVRaWuoW6Gpa6hfqZOnCTVZuTi1BKRJIz21pDwxJ6ckMzdV05qroCgzr0QjTcPIwEATqnTBAggNAA)
Based on [@xnor](https://codegolf.stackexchange.com/users/20260/xnor)'s comment:
>
> It doesn't look like anyone has done this yet, but a slick approach is to make a list of 100 ones and n-1 zeros, shuffle it, and list off the lengths of the n runs of ones separated by zeroes. – [xnor](https://codegolf.stackexchange.com/users/20260/xnor)
>
>
>
PARI/GP doesn't have a built-in for shuffling, but we can generate a random permutation of `[1..n+100-1]` using `numtoperm` and `random`, and see the first `n-1` terms as the positions of zeros.
---
# [PARI/GP](https://pari.math.u-bordeaux.fr), 94 bytes
```
n->b=binomial;r=random(b(n+99,k=100));[while(r>=s=b(n-l+k-1,k),r-=s;i++;k--)+i|l<-[1..n],!i=0]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=LY1BDoIwEEX3nkLjpk07BFxp6nARgqbEgpOWQkoNG2_ihsQYz-RtlODqLf7Lf493rwOdm3561mt83WIN-8_JQ15hRb5rSTsVMGh_6VpWMS8OB2kxS1POVTFeyRkWchzwN4ETFjJpuQyAgyIhlAXggu7uCEWWJL6UG8K0_Fe2g4nzMWtMHLVzkVrD1aoP5COr2W5uLOo0LfwC)
The number of possible outputs is `binomial(n+100-1,100)`. Here I first generate a random number `r` in the range `[0..binomial(n+100-1,100)-1]`, and then find the `r`th result. So this is guaranteed to be uniform.
[Answer]
# [Python 3](https://docs.python.org/3/), 88 bytes
```
lambda n:[*map(len,bytes(sample([0]*100+[9]*~-n,n+99)).split(b'	'))]
from random import*
```
[Try it online!](https://tio.run/##DcWxDsIgEADQWb@iW@9oNagTJn4JZYAUIgkcF2Dp0l9H3/L46N9CrxE@20g2u91O9NYiW4bkaXVH9w2azZw8aGnEQ8pFKyPOG620KIV4b5xiBzdfZkRzDbXkqVra/8XMpXYxuEbqEOApJeL4AQ "Python 3 – Try It Online")
Also uses the "sticks and stones" method.
This creates a list of 100 0s and n−1 9s, then `sample` gives n+99 elements (which is all of them) in a random order. The result is then converted to `bytes` in order to use `split`; 9 was chosen because it corresponds to the tab character (which is placed in the `bytes` literal for the argument to `split`). Finally, use `map` to take the `len`gth of each piece, and `[*…]` makes it into a list.
[Answer]
# [APL(Dyalog Unicode)](https://dyalog.com), 28 bytes [SBCS](https://github.com/abrudz/SBCS)
```
-↑∘{+/¨⍵⊂⍨1@1~⍵}{100≥?⍨⍵+99}
```
[Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=033UNvFRx4xqbf1DKx71bn3U1fSod4Whg2EdkFNbbWhg8KhzqT1QCMjVtrSsBQA&f=03jUtUjnUe/SR11N2vqaaQqmAA&i=AwA&r=tryapl&l=apl-dyalog&m=dfn&n=f)
A train which takes a single integer. Uses the sticks and stones method, since it translates quite well to APL.
-6 from ovs.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 43 bytes
```
.+
*
_$
100*@¶
+@v`(.)(.*¶)
$2$1
¶
S`_
%`@
```
[Try it online!](https://tio.run/##K0otycxLNPz/X0@bS4srXoXL0MBAy@HQNi5th7IEDT1NDT2tQ9s0uVSMVAy5gKJcwQnxXKoJDv//GxoAAA "Retina – Try It Online") Explanation:
```
.+
*
```
Convert to unary (using `_`).
```
_$
100*@¶
```
Decrement the input, append 100 `@`s, and create a work area for the shuffle.
```
+@v`(.)(.*¶)
$2$1
```
Repeatedly select a character randomly from the first line and move it to the start of the second line. (The `+` indicates to repeat, the `@` selects randomly, and the `v` allows the matches to overlap, which doesn't matter here since we're only replacing one at a time.)
```
¶
```
Delete the input area.
```
S`_
```
Split the working area on `_`s. Since there were `n-1` of them, there are now `n` lines.
```
%`@
```
Count the number of `@`s on each line.
[Answer]
# Wolfram Language (Mathematica), 41 bytes
Edit: I have made my code much simpler and shorter.
```
Values[Counts[RandomInteger[{1,#},100]]]&
```
RandomInteger creates a random number between 1 and the given input integer, with uniform probability. This is done 100 times, and Counts tallies up the number of appearances of each number.
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7PywxpzS1ONo5vzSvpDg6KDEvJT/XM68kNT21KLraUEe5VsfQwCA2Nlbtf0BRZl6JQ0hiUk5qdFp0ZqxOdaaOIVC2NvY/AA "Wolfram Language (Mathematica) – Try It Online")
Old code from my previous submission is below.
```
Length/@Select[Flatten[Split[RandomChoice[Join[Riffle[Table[1,{#}]&/@#,0]]&/@Flatten[Permutations/@IntegerPartitions[100+#,{#}]-1,1]]],1],Length[#]>1&]&
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 99 bytes
```
f=(n,a=[100])=>--n?f(n,a.flatMap(v=>(s||s++)<p&&(s+=v)>p?[d=s-p|0,v-d]:v,p=Math.random(s=0)*101)):a
```
[Attempt This Online!](https://ato.pxeger.com/run?1=jVXNbttGEL7lwKeYQ2ruSiRFKjVSy6aMIAkCF3ETxLkpArQhVzJdapfhLpkUFp8klxzah2qfJrPLH0lpDdSAKHp-vp2Z79vR1z-FTPm3b39Veu3_8neyjonwWLyIwnBJ47nvi8u1sQTrnOlrVpA6nhO126nxmF4UJydEjeOazovLRRorv9iFXu2ny1ntFfE107dByUQqt0TFIR1FYUTpjLVH_fOInjtOIoXS8P7d1bPXNxADnop_aF84kedMPeeJ55x6ThR6zmQytc9T-8RAZxmsZfmSJbdEQDyHewfAwMmcB7nckBVa4fG9aFZ4UOvSUHJV5Vqh574xVkQAknMNGZrCc_y66KrBd2zRoh4nYyBOxGIeO250ib7VAg9tDcGdzARxPXBpA0sggz3nYqNvG7pqQbI1kCMPxHEMAk5OOuSg5GmVcEJUtfWgpqZdfIUx1B6E1IbjRPpqoW9zMRS2xMrIf1h3O5M_hqitpAGeKz7AHI3zQzV9-nMCr6QeGkSIxo7weNSI47SfdjzYFPrffLzjiQ5-53-ovhLa9WuSDAmJ3H6Uhpyot2QDSYags7NzPGqMLM1Nv0iR79M-axS3vqOMyCT4NiHsGO3CJ3Hr2WsjkZWw0ugqrVle8YNat0b9ZvQ1TDqRHChry5npsgX5gTCWH1LGckvaxMxln690-oIjPNhroz6VmvyAVe-RasQh-A82YM6lMBrBdI86lNWTZxkwIoFLcA2DEeSZ0i7MYNUSihENVCL7VHHrUiDXwL8UOAieor-dmuH08T2xvY6s5AIt35Y8yVQmBXlCm59sQW1Y19JDgUrjbmBlCimvM6bRfnhTTREPqUZJnI7gn-FK6Dx4LnPcTbIkVnouF65n33oVi2rLyyyZgS4r7nXGSrENn4FroNzemG2ELPnbSiS6sgXNYM3wQgyapgHOoWAlt4Wae2sma8QYUVtxoIo8Q7JwY1nZ-zANbax19vuKoAIy2i-tvmOs06jv15s3vwV4huIkt3CauMSlC9zHhzunYMpEm6R_bQ1r_H87Yw_Za8UCo0zMfQ9PjUTcD-bm4x5bGVb7LZIvh2vwIMWbVlvDXjiamKk0s3Wc0aMK3CAIXJvR4BM_7S9G_yP1HQ)
A recursive approach that starts with the array `[100]`, and 'splits' it randomly `n` times.
eg. `[27, 51, 22]` -> `[27, 11, 40, 22]`
The hardest (and most costly) part is making sure `[0, 100]` is a possible output.
There is an extremely slim chance (at most approx. 1 in 253, [source](https://stackoverflow.com/a/52095861/14117133)) of the function producing invalid output, when `Math.random()` returns exactly `0`.
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 42 bytes
```
100\(:a+,{;9.?rand}${a<}%1+{.1?.@@)>n\.}do
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPlvaABEBjEaVonaOtXWlnr2RYl5KbUq1Yk2taqG2tV6hvZ6Dg6adnkxerUp@f//AwA "GolfScript – Try It Online")
For some reason I just *had* to use GolfScript for this. No idea why though, I've never used this language before. Anyways, this is yet another implementation of xnor's idea.
```
100         # push 100 onto the stack
\(:a        # store n-1 in variable a
+,          # create array of ints from 0 to (100 + n-1) - 1
{;9.?rand}$ # shuffle array, method taken from GS tips page
{a<}%       # map items to 0 if they are >=a and to 1 if they are <1
1+          # append 1 to list.
            # This is done so that ? always finds a 1 later
{
  .1?       # find position of first 1 in array
  .@@       # move a copy of that position to the back of the stack
  )>        # discard all elements with an index < (position - 1)
  n\        # push a newline onto the stack, flip array back to the top
            # The implicit output concats all stack values together :(
.}do        # repeat until array is empty
```
The program expects n to be at to top of the stack. TIO's input field does ...unexpected things, so the header field is used to provide input instead.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `W`, 13 bytes
```
‹(₁ʀ℅)₁Ws₍h¯f
```
choose cut positions and sort them, append 100 at the end, calculate the difference
=>`first number, differences...`
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJXIiwiIiwi4oC5KOKCgcqA4oSFKeKCgVdz4oKNaMKvZiIsIiIsIjUiXQ==)
[Answer]
# [Ly](https://github.com/LyricLy/Ly), 22 bytes
```
'dspn,[r0l?:lf-spr,]pl
```
[Try it online!](https://tio.run/##y6n8/189pbggTye6yCDH3ionTbe4oEgntiDn/38LAA "Ly – Try It Online")
This meets the requirements in that all possible combinations of numbers that sum to 100 could be returned, but I don't think all of them have an equal chance. But someone with better understanding of statistics would have to weigh in to be sure... If that's a disqualification, I'll remove the answer. But from what I can tell, the approach is different from the other algorithms used so it might be interesting?
At a high level, the code loops `N-1` times where `N` is the count requested on STDIN. Each time through the loop it generates a random number in `0-X` where `X` starts at 100 and is decremented by the number added to the list each time. Once the loop is exhausted, it finds the number requires to get the sum to 100 and uses that as the last entry.
```
'dsp                   - Load "100", save to backup cell and pop from stack
    n,                 - Read list size "N" requested from STDIN, decrement
      [r         r,]p  - Loop once for "N-1" times
        0l?            - Load backup cell, generate random number in "0-X"
           :           - Duplicate random pick
            lf-        - Sub random pick from previous "left to sum" number
               sp      - Save new "left to sum" to backup cell and pop from stack
                     l - Load "left to sum" from backup cell
                       - Stack prints as numbers by default on exit
```
[Answer]
# Python 3.9, 233 226 224 211 Bytes
```
import random
from functools import*
r,p=range,cache(lambda n,s:s<1 if n<1 else sum(p(n-1,k)for k in r(s+1)))
def f(n,s):
    k=random.choices(r(s+1),[p(n-1,k)for k in r(s+1)])[0]
    return[]if n<1 else[s-k]+f(n-1,k)
```
[TIO link](https://tio.run/##dY0xTsQwEEV7n2LKGdaLHGjQavcKXCCKUHBsYiWescZOwelDpFDQUP3iv6dXvtss/PpWdN9TLqINdORJsokqGeLGvomsFc7zyagtj4P4CnbV7cOPfg74LhwI1zF/TiOwrbd67yBF4GPCWgPULWNBvnZ2oSgKCyQGxXrpiMhMIULEw6ObgeVx9p/9LMmHiidm@3/8gXo3GNDQNuV@@FPt63UZLvFX24smbhjxxTnbOUe0/wA). Slightly longer as the cache decorator is only available in Python 3.9.
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 49 bytes
```
s10 100rn1bx100.*FL{jg_x/0x/ia}{g1-.Js1}w!q0;;)++
```
[Try it online!](https://tio.run/##SyotykktLixN/V9dkPq/2NBAwdDAoCjPMKkCSOtpuflUZ6XHV@gbVOhnJtZWpxvq6nkVG9aWKxYaWFtramv/zyypDc/5b6BgzGUIJoxAhDHQEC5DBUMA "Burlesque – Try It Online")
Inputs are random seed and count.
```
s1         # Save count
0 100rn    # Random numbers 0..100 (seeded by second input)
1bx100.*FL # 100 1s
{
  j        # Reorder stack
  g_       # Get head of random number
  x/0x/ia  # Insert a 0 at that position
 }{
  g1-.Js1  # Decrement count and check
 }w!       # While
 q0;;      # Split on 0s
 )++       # Sum each block
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 34 bytes
```
≔Ｅ⊖Ｎ⁰θ≔Ｅ×χχ¹η⊞υ⁰Ｗ⁺θη⊞υ⎇‽ι⁺⊟υ⊟η⊟θＩυ
```
[Try it online!](https://tio.run/##TYzLCsIwEEX3/YosZ6BCs@5KdONCKdIfiO1gAnk1D8Wvj4kouLjMDOfcWaQIixO6lH2M6m7hLDwcaQlkyCZa4WR9TpdsbhQAsWdDzYZj96fPylAEPvSMN8prZDWmHCXk1hi7p1SaGEw6R9gaRvbDMwUrwguuwq7OgKrtjzY5D7kddUr8Lhu2x0HZBAcRUxVwLIUPZffQbw "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Uses @xnor's method.
```
≔Ｅ⊖Ｎ⁰θ
```
Create a list of `n-1` `0`s.
```
≔Ｅ×χχ¹η
```
Create a list of `100` `1`s.
```
⊞υ⁰
```
Start the output list with one `0` for now.
```
Ｗ⁺θη
```
Repeat until all of the `0`s and `1`s have been popped.
```
⊞υ⎇‽ι⁺⊟υ⊟η⊟θ
```
Select one of them at random. If it's a `1`, then increment the latest number in the output list, otherwise push one of the `0`s to the output list, all while removing the `1` or `0` from its list as appropriate.
```
Ｉυ
```
Output all of the integers.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 94 bytes
```
f=(n,s=100,g=Math.random,i=g()*-~s|0)=>--n?g()*s**n<(i+1)**n-i**n?[...f(n,i),s-i]:f(n+1,s):[s]
```
[Try it online!](https://tio.run/##JY1NCoMwEEb3nsJlYjJBl1VTT9ATiGDwr2NtIo6UUkqP3jTSWcy8Dx7zzeZhqNtw3cG6fvB@1MxK0lmayklfzH5Vm7G9u0vUE@MJfOidcn0GsNWRKUlsyVBkPABgWFWtlBrDE@SSAJs8sMgk8bymxo9uY9g/dVbE4ZShpoiFCMijzllyy6AWN7HxkLiaHdpWtDzyX7fuGAQPQLvpbkD4GvTpPz8 "JavaScript (Node.js) – Try It Online")
Probable ret[0]==s-i is `((i+1)**n-i**n)/s**n`
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 13 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
î ÅiLî¬ ö¬¸mÊ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=7iDFaUzurCD2rLhtyg&input=OA)
]


[Question]
      [
*This is the cops' thread of a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. The robbers' thread can be found [here](https://codegolf.stackexchange.com/questions/251451/polyglot-quiz-robbers-thread)*
In this challenge as a cop you will choose two programming languages **A** and **B**, as well as a non-empty string **S**. You are then going to write 4 programs:
1. A program which outputs exactly **S** when run in both **A** and **B**.
2. A program which outputs **S** in **A** but not in **B**.
3. A program which outputs **S** in **B** but not in **A**.
4. A program which doesn't output **S** in either **A** or **B**.
You will then reveal all 4 programs (including which number each program is) and **S**, but keep the languages hidden.
Robbers will try to figure out a pair of languages such that they print the correct results for the 4 programs, and cops will try to make posts that are hard to figure out while remaining as short as possible.
**Warning: There is a slight difference in the rules from "normal" [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'")**
Cops' posts here can have 4 different states:
1. Vulnerable
2. Cracked
3. Safe
4. Revealed
All cops' posts start as *vulnerable*. If a robber finds and posts a solution to a *vulnerable* post they will receive 1 point and the post will become *cracked*. If a post lasts 10 days in *vulnerable* without being solved it automatically becomes *safe*. A cop with a *safe* post may choose to reveal **A** and **B** and their *safe* post will become *revealed*. A robber can still solve a *safe* post, if they do they receive a point and the post becomes *revealed*.
Only *revealed* posts are eligible for scoring. Robbers are only permitted to solve *vulnerable* and *safe* posts.
## Scoring
Cops will be scored on the sum size of all four programs as measured in bytes, with the goal being to have an answer with as low a score as possible. Answers that are not *revealed* effectively have infinite score by this measure until they become *revealed*.
## Languages and Output
In the interest of fairness, we are going to require that languages are free and reasonably cross platform. Both languages you choose must be freely available on Linux and FreeBSD (the two largest foss operating systems). This includes languages which are free and open source.
Your selected languages must predate this challenge.
Since this challenge requires that **A** and **B** produce different outputs for the same program, there is no requirement for what "counts" as a different language, the fact that they produce different outputs is enough.
Programs do not have to compile, run without error or "work" in the cases where they do not need to output **S**. As long as **S** is not the output it is valid.
Programs here should be complete programs not functions, expressions or snippets.
Running a program is assumed to be done with no input. All four programs must be deterministic, within an environment. It is fine for example if as a part of an error the program outputs the name of the file or your host name, this is not considered non-determinism since it is determined by the environment running the program. However if it is included in the output please indicate what the file is named etc.

[Answer]
# A = [HQ9+](https://esolangs.org/wiki/HQ9%2B), B = [Python 3](https://docs.python.org/3/), 291 bytes, [Cracked](https://codegolf.stackexchange.com/a/251464/107310)
**S** is `Hello, world!`
1. Both **A** and **B** work
```
#console.log("Hello, world!")/*
print("hello, world!".capitalize())
#*/
```
2. **A** only
```
console.log("Hello, world!")/*
print("hello, world!")
*/
```
3. **B** only
```
#console.log("Hello, world!")/*
print("Hello, world!")
#*/
```
4. Neither work
```
console.log(String.fromCharCode(49-1)+"ello, world!")/*
print(String.fromCharCode(49-1)+"ello, world!")
*/
```
GG
[Answer]
# [A] and [B], 64 Bytes, [Cracked](https://codegolf.stackexchange.com/a/251462/92689) by @Steffan
S = "Cop"
Both *A* and *B* works
```
main=print"Cop"
```
Works only *A*
```
main=print
 "Cop"
```
Works only *B*
```
main=
print"Cop"
```
None works
```
main=print
"Cop"
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands) and [yup](https://github.com/ConorOBrien-Foxx/yup/wiki), 8 bytes, [Cracked by *@FryAmTheEggman*](https://codegolf.stackexchange.com/a/251649/52210)
\$S\$: `0`
1. Works in \$A\$=05AB1E and \$B\$=yup:
```
0#?
```
2. Works in just \$A\$=05AB1E:
```
0?
```
3. Works in just \$B\$=yup:
```
0#
```
4. Works in neither \$A\$=05AB1E nor \$B\$=yup:
```
0
```
---
**Explanation now that it's cracked:**
```
0#?    # 05AB1E: Push 0; pop and split on spaces (no-op that just pops); print
       # without newline, which implicitly uses the last value that was on the now
       # empty stack, which is the 0
       # yup: Push 0; pop and print it without newline; no-op character '?'
0?     # 05AB1E: Push 0; pop and print it without newline
       # yup: Push 0; no-op character '?', so don't print anything
0#     # 05AB1E: Push 0; no-op pop; implicitly output 0 with trailing newline
       # yup: Push 0; pop and print it without newline
0      # 05AB1E: Push 0; implicitly output 0 with trailing newline
       # yup: Push 0; don't print anything
```
[Answer]
# Hexagony and Labyrinth, 44 bytes, [Cracked](https://codegolf.stackexchange.com/a/251469/78410) by Aiden Chow
**S** = `1234`
1. Works in both A and B
```
"123_1234!@
```
2. Works in A, but not in B
```
123+1
234!@
```
3. Works in B, but not A
```
1234@
;!;!;
```
4. Does not work in A or B
```
;!;!;
1234@
```
[Answer]
# ??? and ???, 69 bytes, vulnerable
S = `A`
1. Both A and B work:
```
:-%~! v
put(97)
.% >`a
```
2. Works in A, but not B:
```
:-%~v!
put(a)
.% >97
```
3. Works in B, but not A:
```
:-%~!<
put a.
.%^97C
```
4. Works in neither A or B:
```
put(97)
```
[Answer]
# [Glypho](https://web.archive.org/web/20060621185740/http://www4.ncsu.edu/%7Ebcthomp2/glypho.txt) and [Somme](https://github.com/ConorOBrien-Foxx/Somme), 747 bytes, revealed
## Explanation
For this approach, I thought it would make sense to choose two languages which cared very little about the actual content of their source codes, and instead cared about some properties the code has.
Glypho is a language who cares about the distinct permutations formed by chunks of 4 bytes. It has 15 commands, and is a stack-based language. For example, the string `UU{u` corresponds to the `push` command, since it is equivalent to `aabc` (in terms of uniqueness).
Somme is a language which is usually a fairly innocuous stack-based language, but once multiple lines are involved, the columns are summed and converted into a corresponding command. (Addition is performed by treating space, 32, as 0, `!` as 1, etc., then taking the result mod 95.)
Hence, the programs consist almost entirely of red herrings.
Recall that
**S** = `owo!owo!owo!owo!owo!owo!owo!owo!`
a string chosen because I thought it was funny.
## Both **[Glypho](https://tio.run/##VY9NSwNBDIbv8yv6theV0g74cXE7mVI8eQjTcRlQbPekHixpDxKKP37N7AoiuQQenrxv3j/Pxw/p@7b9/mJWARGEbVQlb/O2UW0KChvzUqQE1QAHVzk8vANc0qRsAwIt5ot5ZZEi/bqoTEqR0XUYXHh1KOZqGl2iIVfU/XeV/3IHV@G9t7UkPaXKa64IGxONRLHRYK6VVussBUGDji5bZw@Xc04mWyse/wUHBHKzdTfZrJ7v3s6bl7bL@fB0Gy8PXbh@nax2/LC7n9oJTK9ulqfH/cW@738A)** and **[Somme](https://tio.run/##VY9BSwNBDIXv8yv62otKaQfUXtxOphRPHsJ0XAYU273obQlFShB//JrZFURyCXx8eS@f0vfvw9C23xdmFRBB2EZV8iEfGtWmoLAxL0VKUA1wcJXDwzvAJU3KNiDQarlaVhYp0q@LyqQUmVyH0YVXh2KupsklGnNF3X9X@S93dBXee1tL0nOqvOaKsDHRSBQbDeZaabXOUhA06OSydfZwOedksrXi6V9wQCC32HWz/fZl8/G1f227nPvn@3jdd@H2bbY98uPxYW4nML@5W5@fTlenYfgB)** work:
```
UU{uOOwo!??!oOoOowwoSRSR<ww<W!WOOOw0oWoW>ww>!
!
owwo!0!0
!!
QwQwOwOw!?!?.,.,owwo@?@?<ww<W!W!OwOwoWWo>ww>!
!owwo!!0w
!W
QwwQOwOw!???oOoOoow
@?@?<ww<W!W!OwwOoWoW>ww>!
!owww!000
!WQwqQOwwO!?!?ooO!owow@??@<w><W!!WOww0ooW!>w>w!
!owOo!00!
SSSQQwqOwoO!??!oO!O>!>?
#A` C=Z6fyC[U`SSmT5@)m`>3] =^OE^;"owO!"*4/qK_(_
```
This corresponds to the [Glypho (shorthand) program](https://tio.run/##S8@pLMjI1y3OyC8qyUjMS/n/39BQOwUIow1TwHQKEIApbSAw1NVOyU@Bymjn54P4QJ6uthaYBPFjo1MRIPb/fwA) (`[eeeeeeeeeee]` is a loop that never runs):
```
11+d+d+[1d+d+d+dddd+d+dd++++1-+dod1d+d+d++oo1-+d1d+-+*1d+-+o1-+][eeeeeeeeeee]
11+                                                                 stack: 2
   d+d+                                                             stack: 8 (loop counter)
       [                                                    1-+]    loop 8 times
        1d+d+d+                                                     stack: LC, 8
               dddd                                                 stack: LC, 8, 8, 8, 8, 8
                   +d+dd++++                                        stack: LC, 8, 112
                            1-+                                     stack: LC, 8, 111
                               do                                   output and keep 'o'
                                 d1d+d+d++                          stack: LC, 8, 111, 119
                                          oo                        output 'wo'
                                            1-+                     stack: LC, 7
                                               d1d+-+*              stack: LC, 35
                                                      1d+-+         stack: LC, 33
                                                           o        output '!'
                                                            1-+     stack: LC-1
```
In Somme, this corresponds to the following program after the columns are summed:
```
F1+7*1-::8+\3B*m,m,m,m,m,m,m,m,0;!fw'@9AH     `
F                                                   stack: 15
 1+                                                 stack: 16
   7*1-                                             stack: 111
       ::                                           stack: 111, 111, 111
         8+\                                        stack: 111, 119, 111
            3B*                                     stack: 111, 119, 111, 33
               m,                                   map output (,) over stack
                 m,m,m,m,m,m,m,                     ...eight times in total
                               0;                   exit with exit code 0
                                 !fw'@9AH     `     (never executed)
```
## Only **[Glypho](https://tio.run/##Pc0xDgIxDETRPqew444GFy62WOEj5ABRaiiQDNWI0wcrLGuXo6d/f35ej5izdxvO@are0FCiRBAFIoqSxhjWVdF25h0CcRHPEd2s/5xrA1pJllARBUqkw/7O0wk85XJb35yZ3XNcvQxSUPbSKaUbCmj2OJ24C5YDjt7hRG6nU4rDIXsOSK2CGkBUu9j1PdbN@QU)** works:
```
[[4]?!?!?00?OwOw
o
oo  owoo
0 0o]]4[00wO<!!<w#w#?##?owow[44[?!?!?0?0OwwO
oooo 0wo
w0  0]44[00wO<!?<w##w?#?#owow[8[8?!!!??0wOwOw
oo
o o woow0 0 ]44]0ww0<!!!w###??#wowow[ww[?!?!?00wOwOw
##>o o woow00 o]44]0www<!??ww#""#w"owwo"4*4/q]]]]]]
```
This corresponds to the following [Glypho (shorthand) program](https://tio.run/##HYlBCoBADAPfsteGPeQ96kEI2INsRb34@lqWITBkjvO7PPrjcb@@D2VSkGALCWH6yg6rSQrOD4hpVoCIVnVrI/MH):
```
1d+dd+*[11+d+d+dd+\1-+*1-+dddo1d+d+d++oo1d+d*d*d+1+o!1-+]!n
1d+dd+*                                                       stack: 8
       [                                             1-+]     loop 8 times
        11+d+d+dd+                                            stack: LC, 8, 16
                  \1-+*1-+dd                                  stack: LC, 8, 111, 111, 111
                            do                                output and keep 'o'
                              1d+d+d++                        stack: LC, 8, 111, 111, 119
                                      oo                      output 'wo'
                                        1d+d*d*d+1+           stack: LC, 8, 111, 33
                                                   o          output '!'
                                                    !         discard 111
                                                     1-+      stack: LC-1
                                                         !n   discard; no-op
```
And also to the (gibberish) [Somme program](https://tio.run/##Pc0xDgMxCETR3qcA06UJBcUWq3AEH8BymXKFohRzfAc5TqAcPf13XNdzzt5tOOerekNDiRJBFIgoShpjWFdFO5lPCMRFPEd0s/51rg1oJVlCRRQokQ77OU8n8JTLHf1wZnbPcfUySEHZS6eUbiig2eN04i5YDti97UQef6cU2yF7DkitghpAVLvZ/TXWzfkB):
```
u>B-t$?@+@@v)IUnX'PFK;~{k**bj2Q1J02is?F}zRC/)mmU-U-w
```
This errors out immediately because `u` is not a command that exists.
## Only **[Somme](https://tio.run/##K87PzU39/z8zTaGgKDOvREMpv9xfSVOhJCM1z0pBOYxLASbuX56vpMmVmpfCpZxqYK1V52qXklTo6FtVq@1elGhbaRWQmcqVlFpSnpqap5CamJyhkF9aUlBaopCcmJOjo5CSb4UwShFoAQjkRcc4mOVUWykYgM0tSi1ITSxRKCnPTE7liojWSjcycFDKDteoNvHRLQrOVinXM6nVrNOy9ga6FwA)** works:
```
if print("owO") then: #V
  print("Owo")
end
#e0;*~E>dbqAMz}+Gra=y:Pie
between each output call, do:
  print("!")     n[\@6l{: 0
end
repeat twice
X[*g20@"kW({4L-rSk$w.4})~*;Ke
```
This corresponds to the following Somme program:
```
F1+7*1-::8+\3B*r`,{`FF+2+*0;
F1+7*1-::8+\3B*                 same as previous
               r                reverse stack
                `,{`            push this string
                    FF+2+       push 32
                         *      execute that string 32 times
                                (once for each character)
                          0;    exit with exit code 0
```
And to the (gibberish) [Glypho (shorthand) program](https://tio.run/##S8@pLMjI1y3OyC8qyUjMS/n/PxUMtFLhQFcRiFMNgTA6D8SPjYXJ/P8PAA):
```
eeeeee*eeeeeeeeee-!ee-e1e1e[neeee]]eeeeeeee
```
This errors out immediately due to `e` (execute) having no parameters.
## Neither **[A]** nor **[B]** work:
Didn't need to spend too much time here, since the answer was probably fine without it.
```
print("owo!"*8)
#&7("owo!"-1)
```
Thanks for reading!
[Answer]
# [Python](https://www.python.org/) and [PARI/GP](https://pari.math.u-bordeaux.fr/), 48 bytes, [Cracked](https://codegolf.stackexchange.com/a/251466/9288) by @Steffan
An easy one.
**S** is `Cop`
1. Both **A** and **B** work
```
print("Cop")
```
2. **A** only
```
print('Cop')
```
3. **B** only
```
print('Cop)'
```
4. Neither work
```
print("Cop)"
```
[Answer]
# ??? and ???, 54 bytes
String: `8356830650`
Works in A and B (hex):
```
00000000: 300b 3366 b87e 0b00 247e e239 2a83 2a3b  0.3f.~..$~.9*.*;
00000010: 0fd6 30                                  ..0
```
Works in A (hex):
```
00000000: a4ac b3bb 762b 3a74 d6                   ....v+:t.
```
Works in B (hex):
```
00000000: 300b 01f9 3033 1f0b 3131 5ee2 8891 5ebb  0...03..11^...^.
00000010: 2d88 7661 8976 0bce 0000 0b2b            -.va.v.....+
```
Works in neither:
```
We're no strangers to love
You know the rules and so do I (do I)
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
We've known each other for so long
Your heart's been aching, but you're too shy to say it (say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
(Ooh, give you up)
(Ooh, give you up)
(Ooh) Never gonna give, never gonna give (give you up)
(Ooh) Never gonna give, never gonna give (give you up)
We've known each other for so long
Your heart's been aching, but you're too shy to say it (to say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
```
Or the empty program.
[Answer]
# [A] and [B], 46 bytes, Cracked by @mousetail
**S** is `0`
1. Both **A** and **B**, 14 bytes
```
print('0')
out
```
2. **A** but not **B**, 15 bytes
```
print('0')
out#
```
3. **B** but not **A**, 17 bytes
```
print('0',)
out #
```
4. Neither **B** nor **A**, 0 bytes
Yeah, I'm not wasting any bytes here `:-)`
[Answer]
# ??? and ???, 300 bytes
S = `A\n` (as in, `A` with a trailing newline)
1. Works in *A* and *B*
```
puts A
n = A[ exit ]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
```
2. Works in *A* but not *B*
```
puts 'A'
n = A[ exit ]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
```
3. Works in *B* but not *A*.
```
puts A
n = A[exit]
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
```
4. Works in neither *A* nor *B*
```
n = A[ exit ]
puts A
n = 8
m = n - 1
p = m - n
n = 3 * 10
p /= 2
t = p * p
```
[Answer]
# [A] and [B], ACTUALLY 3 BYTES!!!, [Cracked](https://codegolf.stackexchange.com/questions/251451/polyglot-quiz-robbers-thread/251487#251487)
**S** is `0`
* Both, 0 bytes:
* Only **A**, 1 byte:
```
!
```
* Only **B**, 1 byte:
```
r
```
* Neither, 1 byte:
```
"
```
[Answer]
# [Lightlang](https://esolangs.org/wiki/Lightlang) and [PDAsephone](https://esolangs.org/wiki/PDAsephone), 141 bytes, revealed
## Explanation
My thought process for this approach was to choose two obscure esolangs with interpreters not on TIO. Since there are no interpreters online available, I recommend you download [`lightlang.py`](https://github.com/bangyen/esolangs/blob/master/register-based/lightlang.py) and [`PDASephone.java`](https://esolangs.org/wiki/Talk:PDAsephone).
My strategy with this one was further devious. If you were hurriedly scanning through esolangs, and found this language, the program will not complete immediately. The `_` command in Lightlang sleeps for one second, meaning the program takes about 13 seconds to complete.
Lightlang is a curious language which only has 1 bit of memory, whose implementation clocks in at 35 sloc. My solutions use the "interesting" parts of the language, bouncing, jumping, and conditional skipping, to produce varied output. The program otherwise is just a garden path through toggling a bit on and off and printing it occasionally.
PDAsephone is a language with a PDA (push-down automaton) datatype. Unfortunately, I didn't want to spend bytes (or mental energy) getting a non-trivial PDA functional in the language, especially when the other language is so simple that it would be hard to replicate any meaningfully complex behavior implemented in PDAsephone. Hence, I use it just for its stack-based capabilities, and most of the work done is to make it play nice with Lightlang.
**S** = `0110100`
Both **Lightlang** and **PDAsephone** work:
```
__@;"1_&^"0^!^!.$$:.__/!^#&!^&$$:."0:v..^:..___
```
Only **Lightlang** works:
```
[*)`!$]^|>,=+!+/#(]+|!!-+)$'%)}|^!]>*].==`^{;"|
```
Only **PDAsephone** works:
```
'**"0-'})'"1=/:+?.`/:~'{++:.>.'+*/(:./:-./::'..
```
Neither **Lightlang** nor **PDAsephone** work: (the empty program)
Thanks for reading!
[Answer]
# ??? and ???, 43 bytes, safe
output: `2147483647`
|  |  |
| --- | --- |
| both | `-print /*"\r"%S #*/|2**31-1` |
| only A | `-print %S` |
| only B | `2**31-1` |
| neither |  |
hint:
none of the languages are esoteric or recreational, both are practical and one of them is even quite popular, the other one is free open source but not available on any service like TIO, it's a script for a domain-specific tool
[Answer]
# ??? and ???, 406 bytes, [cracked by Conor O'Brian](https://codegolf.stackexchange.com/a/251507/91213)
S=`2`
Both A and B:
```
# print("22222222222") //
!\print("22222222222")# 2
\\     ("11111111111")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;
```
## A but not B:
```
# print("11111111110") //
!\print("11111111110")# 2
\\     ("11111111110")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;
```
## B but not A:
```
print("22222222222") //
!\print("22222222222")# 2
\\     ("11111111111")<<n
;;;;;;;;;;;;;;;;;;;;;;;;;
```
## Neither A nor B:
```
# print("11111111111") //
!\print("11111111111")# 1
\\\    ("11111111111")>>n
;;;;;;;;;;;;;;;;;;;;;;;;;
```
[Answer]
# Pyth and V, 11 bytes, [Cracked](https://codegolf.stackexchange.com/questions/251451/polyglot-quiz-robbers-thread/251500#251500) by @Steffan
S = `3`
Both:
```
l"aa3
```
Only A:
```
3
```
Only B:
```
dl3P1é3
```
None: (empty)
]