text:
Convert alphanumeric (base-36) sentences into hexadecimal (base-16) sentences
I use "sentence" here loosely to mean "any sequence of words separated by spaces" and "words" to mean "sequences of alphanumeric (hexatrigesimal) characters unseparated by spaces".

Conversion is from base-36 (0123456789abcdefg...) or (0123456789ABCDEFG...)
Conversion to base-16 (0123456789abcdef) or (0123456789ABCDEF)
Bonus -1 off your byte score if you are case-insensitive on input
Bonus -1 off your byte score if you are insensitive to non-alphanumeric characters (ignore them, except space)

Conversion of sentences
E.g. if your input sentence is "The meaning of life is 31313" then your out put should convert the following base-36 "words" into base-16 numbers (the, meaning, of, life, is, 31313) and then output them in order.
Bonus -1 off your byte score for retaining spaces in output sentence
Test Cases
You may convert these to your preferred single-case form if you choose not to opt for the case-insensitive bonus, strings end after spaces. Assume input will never start with a space.

Input text:

"The meaning of life is 31313"

Output: ("9542 B59F1602C 36F F508A 2A4 4DA897") - with or without spaces, with lower or upper case letters

Bonus -1 off your byte score for removing leading zeroes i.e. "9542" not "000009542".

Input text:

"Jet fuel can't melt steel beams"

Output: ("6245 B47AD 8C0F9 FF371 2E28A2D 1241854")

Input text:

"fhs8230982t90u20's9sfd902 %2'+13jos32*'ej eos"

Output: ("74510A686B453A2B1933C7AADA25DD2 BB8E18A11AEB 4A5C")

The Winner
This is code-golf, so the fewest bytes wins (including bonus -1 bytes). :)
Can accept the inputs in any way that works, as long as your code can solve arbitrary problems like the test cases.

bonus -1 bytes only one byte? Also, bonuses in code-golf are generally discouraged

Yes, I had a feeling it might be like that, but I wanted to give a minor incentive. All four bonuses add up nicely for any language that implicitly does them, but still definitely not worth adding characters to solve them.

@DrQuarius The bonuses don't add anything interesting for the golfer -- either the language base-conversion has that feature and it's a free -1 byte, or it doesn't and it's not worth adding anything to their code to achieve it. The bonuses are just clutter in the challenge and in scoring.

@xnor hmm, thanks for the explanation. I will avoid them in future, but don't want to 'move the goalposts' now, so to speak.

By removing leading zeros do you mean ignoring them in input or not outputting them?

@EmbodimentofIgnorance in the output: so that 000009542 becomes 9542.

Very tempted to -1 this for getting the mean of life so very wrong!

Japt -S, 6 - 3 = 3 bytes
¸®n36G

Saved two bytes thanks to @Shaggy
Try it

Very nice, and you do indeed remove leading zeros. so yeah 8-3=5 (but you said 8-2=5 in current edit). You also ignore apostrophes but get NaN for the %2'+13jos32*'ej string in the third test case, so -3 out of -4 bonus.

I think yours will probably be the winner. :) Your Japt golfing is marvellous!

n36G saves you 2 bytes.

@DrQuarius, that "bonus" would cost at least 4 bytes.

Perl 6, 28 bytes - 2 = 26
{S:g{\S+}=:36(~$/).base(16)}

Try it online!

So fast! and very nice!

MATL array, 9 - 1 = 8 bytes
Yb36ZA1YA

Try it online!
Case-insensitive, but turns spaces into line breaks.
MATL inline, 20-2 = 18 bytes (inelligible)
Yb36ZA1YAO10Z(!999e!

Try it online!
Takes case-insensitive and preserve-spaces bonuses, (last test case fails due to implicit size assumptions = inelligible submission)
Yb     % Split the input at spaces, place the results in a cell array
36ZA   % convert from base-36
1YA    % Convert to hexadecimal. Gives a char array

O10Z(  % Assign char 0 to 10th column. Adds "Spaces"
!999e! % Reshape in row-major order as a 999-column char array
       % Implicitly display. Display 0 as space.

(I hope Luis Mendo comes and improves on this, because I got most of this from his answers here, here, here and sundar's answer here.)

Good job. I came but I don't see how to improve it :-D

Ruby -p, 23-1 = 22 bytes
Only uses the case-insensitive bonus.
$_=$_.to_i(36).to_s(16)

Try it online!
Ruby -p, 33-2 = 31 bytes
Takes case-insensitive and preserve-spaces bonuses.
gsub(/\w+/){$&.to_i(36).to_s(16)}

Try it online!
Ruby -p, 46-3 = 43 bytes
Takes all 3 bonuses.
gsub(/\S+/){$&.gsub(/\W/){}.to_i(36).to_s(16)}

Try it online!

No need for parentheses around the last method's argument.

Gema, 20 characters
<A>=@radix{36;16;$1}

Sample run:
bash-4.4$ gema '<A>=@radix{36;16;$1}' <<< 'The meaning of life is 31313'
9542 B59F1602C 36F F508A 2A4 4DA897

Try it online!

05AB1E, score 3 (4 bytes - 1 bonus)
#₆öh

Bonus -1: no leading 0s, since this is done implicitly.
Outputs as a list of converted words.
Try it online.

05AB1E, score 8 (12 bytes - 4 bonus)
u#εžKÃ}₆öhðý

All four bonuses:
-1 for no leading 0s, since this is done implicitly;
-1 case-insensitivity by first converting to uppercase with u;
-1 for retaining spaces in the output by joining the list by spaces with ðý;
-1 for ignoring every character apart from [A-Za-z0-9 ], by keeping [A-Za-z0-9] after the split_on_spaces with εžKÃ}
Try it online.
Explanation:
#             # Split the (implicit) input-string on spaces
 ₆ö           # Convert each string from base-36 to integers
   h          # Convert those integers to hexadecimal
              # (and output the list implicitly as result)

u             # Convert the (implicit) input to uppercase
 #            # Split it on spaces
  ε           # Map each string to:
   žK         #  Push builtin string "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
     Ã        #  And only keep those characters in the mapped string
      }₆ö     # After the map: convert each string from base-36 to integer
         h    # Convert those integer to hexadecimal
          ðý  # And join them by spaces
              # (after which the result is output implicitly)

Python 2, 47 - 2 = 45 bytes
lambda S:[hex(int(s,36))[2:]for s in S.split()]

Try it online!
Because case insensitive. And also leading 0s.

Perl 5 -Mbigint -MList::Util=reduce -p, 92 - 4 = 88 bytes
y/_/*/;s|\S+|Math::BigInt::as_hex reduce{$a*36+$b}map{7x/\d/+ord(uc)-55}$&=~/\w/g|ge;s/0x//g

Try it online!
Qualifies for all 4 bonuses (case insensitive, keeps spaces, ignores punctuation, no leading 0s).  Handles even large test cases properly, including the last one.

Charcoal, 14 bytes - 1, score 13
⪫Ｅ⪪Ｓ ⍘⍘ι³⁶¦¹⁶

Try it online! Link is to verbose version of code. Only qualifies for the leading zeros bonus. Explanation:
   Ｓ            Input string
  ⪪             Split on spaces
 Ｅ              Map over words
       ι        Current word
      ⍘ ³⁶      Convert from base 36
     ⍘     ¹⁶   Convert to base 16
⪫               Join on spaces
                Implicitly print

If output of the hex numbers on separate lines is acceptable, then the first and last characters can be removed for a 2-byte saving.
Case insensitive input is possible at a cost of 1 byte, which would not affect the score.
Preservation of multiple spaces is possible at a cost of 2 bytes, unless the current misbehaviour is a Charcoal bug, in which case it would work once the bug is fixed.
Skipping of punctuation is possible at a cost of 4 bytes. (Currently the only supported case is a single trailing .)

Java, 94-2 = 92 bytes
These "bonuses" are too expensive to intentionally claim. I get case insensitive and leading zeros for free though.
s->{for(var w:s.split(" "))System.out.print(new java.math.BigInteger(w,36).toString(16)+" ");}

TIO

Ecmascript 2020, score 90 - 3 = 87
Likely it would be there, already works in Firefox 68+ and Chrome 67+.
s=>s.replace(/\w+/g,x=>[...x].reduce((r,x)=>36n*r+BigInt(parseInt(x,36)),0n).toString(16))

Bonuses:

Bonus -1 off your byte score if you are case-insensitive on input

Bonus -1 off your byte score for retaining spaces in output sentence
Bonus -1 off your byte score for removing leading zeroes i.e. "9542" not "000009542".

Test:

f=s=>s.replace(/\w+/g,x=>[...x].reduce((r,x)=>36n*r+BigInt(parseInt(x,36)),0n).toString(16))

console.log([
["The meaning of life is 31313", "9542 B59F1602C 36F F508A 2A4 4DA897"],
["Jet fuel can't melt steel beams", "6245 B47AD 8C0F9 FF371 2E28A2D 1241854"],
["fhs8230982t90u20's9sfd902 %2'+13jos32*'ej eos", "74510A686B453A2B1933C7AADA25DD2 BB8E18A11AEB 4A5C"],
["  123   1234   tyu ", "  55B   C0D0   97B6 "],
].map(([t,k])=>f(t.replace(/(?!\s|_)\W/g,"")).toUpperCase()==k))


text:
Incremental Ranges!
Your task is to, given two positive integers, \$x\$ and \$n\$, return the first \$x\$ numbers in the incremental ranges sequence.
The incremental range sequence first generates a range from one to \$n\$ inclusive. For example, if \$n\$ was \$3\$, it would generate the list \$[1,2,3]\$. It then repeatedly appends the last \$n\$ values incremented by \$1\$ to the existing list, and continues.
An input of \$n=3\$ for example:
n=3
1. Get range 1 to n. List: [1,2,3]
2. Get the last n values of the list. List: [1,2,3]. Last n=3 values: [1,2,3].
3. Increment the last n values by 1. List: [1,2,3]. Last n values: [2,3,4].
4. Append the last n values incremented to the list. List: [1,2,3,2,3,4]
5. Repeat steps 2-5. 2nd time repeat shown below.

2nd repeat:
2. Get the last n values of the list. List: [1,2,3,2,3,4]. Last n=3 values: [2,3,4]
3. Increment the last n values by 1. List: [1,2,3,2,3,4]. Last n values: [3,4,5].
4. Append the last n values incremented to the list. List: [1,2,3,2,3,4,3,4,5]

Test cases:
n,   x,   Output
1,  49,   [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
2, 100,   [1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47,48,48,49,49,50,50,51]
3,  13,   [1,2,3,2,3,4,3,4,5,4,5,6,5]

Python 2, 39 bytes
lambda n,x:[v/n+v%n+1for v in range(x)]

Try it online!

Also works in Python 3 with the replacement of / with //

R, 33 bytes
function(n,x,z=1:x-1)z%%n+z%/%n+1

Try it online!
Ports Jonathan Allan's Python solution.
R, 36 bytes
function(n,x)outer(1:n,0:x,"+")[1:x]

Try it online!
My original solution; generates an \$n\times x\$ matrix with each column as the increments, i.e., \$1 \ldots n, 2\ldots n+1,\ldots\$, then takes the first \$x\$ entries (going down the columns).

Jelly, 4 bytes
Ḷd§‘

A dyadic Link accepting two positive integers, x on the left and n on the right, which yields a list of positive integers.
Try it online!
How?
Ḷd§‘ - Link: x, n              e.g   13, 3
Ḷ    - lowered range (x)             [0,1,2,3,4,5,6,7,8,9,10,11,12]
 d   - divmod (n)                    [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
  §  - sums                          [0,1,2,1,2,3,2,3,4,3,4,5,4]
   ‘ - increment (vectorises)        [1,2,3,2,3,4,3,4,5,4,5,6,5]

Wait... is that divmod? Clever! And I was struggling with p...

J, 13 12 bytes
[$[:,1++/&i.

Try it online!
how
We take x as the left arg, n as the right.  Let's take x = 8 and n = 3 for this example:

+/&i.: Transform both args by creating integer ranges i., that is, the left arg becomes 0 1 2 3 4 5 6 7 and the right arg becomes 0 1 2.  Now we create an "addition table +/ from those two:
 0 1 2
 1 2 3
 2 3 4
 3 4 5
 4 5 6
 5 6 7
 6 7 8
 7 8 9

1 +: Add 1 to every element of this table:
 1 2  3
 2 3  4
 3 4  5
 4 5  6
 5 6  7
 6 7  8
 7 8  9
 8 9 10

[: ,: Flatten it ,:
 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10

[ $: Shape it $ so it has the same number of elements as the original, untransformed left arg [, ie, x:
 1 2 3 2 3 4 3 4

Nice! My 12-byte alternative

Perl 6, 18 bytes
{(1..*X+ ^*)[^$_]}

Try it online!
Curried function f(x)(n).
Explanation
{                }  # Anonymous block
      X+     # Cartesian product with addition
  1..*       # of range 1..Inf
         ^*  # and range 0..n
 (         )[^$_]  # First x elements

05AB1E, 6 bytes
L<s‰O>

Port of @JonathanAllan's Jelly answer, so make sure to upvote him!
First input is \$x\$, second input is \$n\$.
Try it online or verify all test cases.
Explanation:
L       # Push a list in the range [1, (implicit) input]
        #  i.e. 13 → [1,2,3,4,5,6,7,8,9,10,11,12,13]
 <      # Decrease each by 1 to the range [0, input)
        #  → [0,1,2,3,4,5,6,7,8,9,10,11,12]
  s‰    # Divmod each by the second input
        #  i.e. 3 → [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2],[3,0],[3,1],[3,2],[4,0]]
    O   # Sum each pair
        #  → [0,1,2,1,2,3,2,3,4,3,4,5,4]
     >  # And increase each by 1
        #  → [1,2,3,2,3,4,3,4,5,4,5,6,5]
        # (after which the result is output implicitly)

My own initial approach was 8 bytes:
LI∍εN¹÷+

First input is \$n\$, second input is \$x\$.
Try it online or verify all test cases.
Explanation:
L         # Push a list in the range [1, (implicit) input]
          #  i.e. 3 → [1,2,3]
 I∍       # Extend it to the size of the second input
          #  i.e. 13 → [1,2,3,1,2,3,1,2,3,1,2,3,1]
   ε      # Map each value to:
    N¹÷   #  The 0-based index integer-divided by the first input
          #   → [0,0,0,1,1,1,2,2,2,3,3,3,4]
       +  #  Add that to the value
          #   → [1,2,3,2,3,4,3,4,5,4,5,6,5]
          # (after which the result is output implicitly)

Octave, 25 bytes
@(n,x)((1:n)'+(0:x))(1:x)

Anonymous function that inputs numbers n and x, and outputs a row vector.
Try it online!
How it works
Consider n=3 and x=13.
The code (1:n)' gives the column vector
1
2
3

Then (0:x) gives the row vector
0  1  2  3  4  5  6  7  8  9 10 11 12 13

The addition (1:n)'+(0:x) is element-wise with broadcast, and so it gives a matrix with all pairs of sums:
1  2  3  4  5  6  7  8  9 10 11 12 13 14
2  3  4  5  6  7  8  9 10 11 12 13 14 15
3  4  5  6  7  8  9 10 11 12 13 14 15 16

Indexing with (1:x) retrieves the first x elements of this matrix in column-major linear order (down, then across), as a row vector:
1 2 3 2 3 4 3 4 5 4 5 6 5

Haskell, 31 bytes
n#x=take x$[1..n]++map(+1)(n#x)

Try it online!
This might be my favorite kind of recursion. We start with the values from 1 to n and then concatenate those same values (via self-reference) +1. then we just take the first x values.

Brain-Flak, 100 bytes
(<>)<>{({}[()]<(({}))((){[()](<{}>)}{}){{}{}<>(({})<>)(<>)(<>)}{}({}[()]<(<>[]({}())[()]<>)>)>)}{}{}

With comments and formatting:
# Push a zero under the other stack
(<>)<>

# x times
{
    # x - 1
    ({}[()]<

        # Let 'a' be a counter that starts at n
        # Duplicate a and NOT
        (({}))((){[()](<{}>)}{})

        # if a == 0
        {
            # Pop truthy
            {}
            <>

            # Reset n to a
            (({})<>)

            # Push 0 to each
            (<>)(<>)
        }

        # Pop falsy
        {}

        # Decrement A, add one to the other stack, and duplicate that number under this stack
        ({}[()]<
            (<>[]({}())<>)
        >)
    >)
}

Try it online!

Jelly, 5 bytes
+þẎḣ’

Try it online!

MATL, 16, 10 bytes
:!i:q+2G:)

Try it online!
-6 bytes saved thanks to Guiseppe and Luis Mendo!
Explanation:
:!          % Push the array [1; 2; ... n;]
  i:q       % Push the array [0 1 2 ... x - 1]
     +      % Add these two arrays with broadcasting
      2G    % Push x again
        :)  % Take the first x elements

Forth (gforth), 34 bytes
: f 0 do i over /mod + 1+ . loop ;

Try it online!
Code Explanation
: f            \ start a new word definition
  0 do         \ start a loop from 0 to x-1
    i          \ put the current loop index on the stack
    over       \ copy n to the top of the stack
    /mod       \ get the quotient and remainder of dividing i by n
    + 1+       \ add them together and add 1
    .          \ output result
  loop         \ end the counted loop
;              \ end the word definition

Gaia, 8 bytes
…@┅+‡t_<

Try it online!
Does basically the same thing as the Octave and MATL answers.

Stax, 6 bytes
⌐çYæ▄9

Run and debug it
Unpacked & explained:
rmx|%+^ Full program, implicit input (n, x on stack; n in register X)
r       Range [0 .. x)
 m      Map:
  x|%     Divide & modulo x
     +    Add quotient and remainder
      ^   Add 1
          Implicit output

Japt -m, 12 7 bytes
Port of Jonathan's Python solution.
Takes x as the first input.
%VÄ+UzV

Try it

Ruby, 32 bytes
->n,x{(0...x).map{|i|i/n+i%n+1}}

Try it online!

Haskell, 34 33 bytes
n#x=take x$do j<-[1..];[j..j+n-1]

Try it online!

JavaScript, 36 bytes
n=>g=x=>x?[...g(--x),1+x%n+x/n|0]:[]

Try It Online!

Using alert or print instead of return an Array may reduce this to 34 bytes: n=>g=x=>x&&print(g(--x)|1+x%n+x/n)

Perl 5 -na, 43 bytes
@r=map$_..$_+$F[1]-1,1..$_;say"@r[0..$_-1]"

Try it online!

K (oK), 17 16 bytes
{y#,/1_y(1+)\!x}

Try it online!

APL (Dyalog Unicode), 8 10 bytesSBCS
⊢↑∘∊⊣,/∘⍳⌈

Try it online!
A dyadic train. Left arg = interval (n), right arg = number of terms (x). ⎕IO←1.
How it works
⊢↑∘∊⊣,/∘⍳⌈  ⍝ Left: interval n, Right: terms x
       ∘⍳⌈  ⍝ Generate range [1..max(n,x)]
            ⍝ (Too short array will complain at N-wise reduce)
    ⊣,/     ⍝ Extract length-n intervals (dyadic N-wise reduce)
  ∘∊        ⍝ Flatten and list the elements into a vector
⊢↑          ⍝ Take first x terms from the above

Porting Jonah's J answer would be 10 bytes in Extended (traditional APL doesn't have an equivalent to J's &):
APL (Dyalog Extended), 10 bytes
⊣↑∘,1++\⍥⍳

Try it online!
Uses ⎕IO←0. If ⎕IO←1 were used, I'd need to replace 1+ with ¯1+, costing one more byte (instead of saving two bytes).
How it works
⊣↑∘,1++\⍥⍳  ⍝ Left: x, Right: n
        ⍥⍳  ⍝ Create 0-based ranges for both args
      +\    ⍝ Outer product by addition (shortcut of ∘.+)
    1+      ⍝ Increment
  ∘,        ⍝ Flatten the matrix into a vector
⊣↑          ⍝ Take first x elements

Julia 1.0, 34 bytes
f(n,x)=[v÷n+v%n+1 for v in 0:x-1]

Ports Jonathan Allan's Python solution.
Try it online!

25

Alchemist, 77 bytes
_->In_n+In_x
x+n+0y+0z->a+Out_a+Out_" "+m+y
y+n->n
y+0n->z
z+m+a->z+n
z+0m->a

Try it online!
Increments and outputs a counter n times, then subtracts n-1 before repeating.

Charcoal, 18 bytes
ＮθＦＮ⊞υ⊕⎇‹ιθι§υ±θＩυ

Try it online! Link is to verbose version of code. I had dreams of seeding the list with a zero-indexed range and then slicing it off again but that was actually 2 bytes longer. Explanation:
Ｎθ                  Input `n` into variable
   Ｎ                Input `x`
  Ｆ                 Loop over implicit range
         ι          Current index
        ‹           Less than
          θ         Variable `n`
       ⎇   ι        Then current index else
               θ    Variable `n`
              ±     Negated
            §υ      Cyclically indexed into list
      ⊕             Incremented
    ⊞υ              Pushed to list
                Ｉυ  Cast list to string for implicit output

APL+WIN, 29 23 16 bytes
 x↑,1+(⍳x←⎕)∘.+⍳⎕

Index origin = 0 and prompts for n and x
Try it online! Courtesy of Dyalog Classic

JS, 54 bytes
f=(n,x)=>Array.from(Array(x),(_,i)=>i+1-(i/n|0)*(n-1))

Try it online!

Welcome to PPCG :) As this isn't a recursive function, you don't need to count the f=. You can save one byte by currying the parameters (n=>x=>) and another by spreading & mapping the array ([...Array(x)].map()).

C (gcc), 49 44 bytes
Using recursion to save some bytes.
f(n,x){x&&printf("%d ",x%n+x/n+1,f(n,--x));}

Try it online!

Perl 5, 39 bytes
say 1+int($_/$F[1])+$_%$F[1]for 0..$_-1

Try it online!

Icon, 48 bytes
procedure f(x,n)
write((0to n)+(1to x))\n&\z
end

Try it online!

C(clang), 843 bytes
#include <stdlib.h>
main(int argc, char* argv[]){
        int x,n;
        if (argc == 3 && (n = atoi(argv[1])) > 0 && (x = atoi(argv[2])) > 0){
                int* ranges = calloc(x, sizeof *ranges);
                for (int i = 0; i < x; i++){
                        if (i < n){
                                ranges[i] = i+1;
                        }
                        else {
                                ranges[i] = ranges[i-n] + 1;
                        }
                }
        printf("[");
        for (int j = 0; j < x - 1; j++){
                printf("%d",ranges[j]);
                printf(",");
        }
        printf("%d",ranges[x - 1]);
        printf("]\n");
        free(ranges);
        }
        else {
                printf("enter a number greater than 0 for n and x\n");
        }
}

Hi, welcome to PPCG! This challenge is tagged [code-golf], which means you have to complete the challenge in as few as possible bytes/characters. You can remove loads of whitespaces, and change variable names to single characters in your code (the argc, argv and ranges). Also, no need to add any warning messages.. You can assume the input is valid, unless the challenge says otherwise.

C# (Visual C# Interactive Compiler), 41 bytes
x=>n=>new int[x].Select((_,a)=>a/n+a%n+1)

Try it online!

Factor, 55 bytes
: f ( a b -- c ) [0,b) [ over /mod + 1 + . ] with map ;

Try it online!

Io, 50 bytes
Port of Jonathan Allan's answer.
method(n,x,Range 0 to(x-1)map(v,(v/n)floor+v%n+1))

Try it online!

Husk, 6 bytes
↑Σ¡m→ḣ

Try it online!
↑Σ¡m→ḣ
     ḣ  Make a range [1, n]
  ¡     Make an infinite list of ranges by repeatedly
   m→   incrementing each element in that range
 Σ      Flatten that into a 1-D list
↑       Take the first x elements of that

Factor, 35 bytes
[ iota swap '[ _ /mod + 1 + ] map ]

Try it online!

Vyxal, 6 bytes
ʁ$vḋṠ›

Try it Online!
Port of Jelly.
ʁ$vḋṠ›
ʁ       # Range [0, first input)
 $      # Swap so the second input is at the top
  vḋ    # For each in the range, divmod by that
    Ṡ   # Sum each
     ›  # Increment

source: Stack Exchange

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

sort: votes


text:
Implement Homestuck's Catenative Doomsday Dice Cascader
Challenge
I'm under attack by the larcenous Midnight Crew and I need to summon the Catenative Doomsday Dice Cascader in order to defend myself. Since I'm low on space, I need the code to be as short as possible.
The algorithm for the Catenative Doomsday Dice Cascader is as follows:
First, the six sided die in the Prime Bubble is rolled, and the result will determine how many iterations of the next step take place.
Start with a six sided die. For as many times as the roll of the Prime Bubble die, multiply the number of sides on the next die by the result of the roll of the current die.
For example, if on your first roll of the six-sided die your roll is 2, then your next die will have 6*2 = 12 sides.
Your goal is to write a function or program that takes no input and outputs the final result of the last die rolled. Since this is code-golf, the lowest byte count in each language wins!
Examples
Example #1 (Taken directly from the link above):
The Prime Bubble rolls a 6, meaning that the Cascader will iterate six times

#1: We always start with a 6 sided die, and it rolls a 2, so the next die has 6x2=12 sides
#2: The 12 sided die rolls an 8, meaning that the third die has 12x8=96 sides
#3: The 96 sided die rolls a 35, meaning that die 4 has 96x35=3360 sides
#4: The 3360 sided die rolls a 2922, so die 5 has 3360x2922 = 9,817,920 sides
#5: The 9.8 million sided die rolls a 5,101,894, so the final die has 50,089,987,140,480 sides
#6: The 50 trillion sided die rolls a one. Hooray.
Since the last die rolled gave a 1, your function or program should output 1.
Example #2
The Prime Bubble rolls a 2, meaning that the Cascader will iterate twice.

#1: We always start with a 6 sided die, and it rolls a 4, so the next die has 6x4 = 24 sides
#2: The 24 sided die rolls a 14

Since the last die rolled gave a 14, your function or program should output 14.

Whats the maximum output? If every roll results in the maximum side? I think it's 7958661109946400884391936 = ((((6^2)^2)^2)^2)^2 = 6^(2^5) = 6^32

@KjetilS. Indeed, and the likelihood of that output should be $\frac{1}{6*\prod_{i=0}^5(6^{2^i})}=\frac{1}{6\times 6\times 6^2\times 6^4\times 6^8\times 6^{16}\times 6^{32}}=\frac{1}{2155416739906037495048372267884096782336}$

Is this supposed to be random?  The question doesn't mention anything about randomness at all?

@SriotchilismO'Zaic Dice-rolling implies randomness.

Numbers are really huge this time — 6³² > 2⁶⁴ obviously.

Does the roll of a 1 on the Prime Bubble mean you immediately roll the Final Die?

@Stackstuck yes, and it’s just a 6-sided one

@SriotchilismO'Zaic https://xkcd.com/221/

To confirm: We don't need to worry about type size limits, right?

It's interesting not seeing a JavaScript answer, when current implementations have a BigNum type built in.

@Stackstuck you don't have to worry about integer size limits. Just pretend that int is infinitely large

@KevinCruijssen That settles that question, then.

Python 2, 76 69 bytes
from random import*
R=randint
v=6;exec"p=R(1,v);v*=p;"*R(1,6)
print p

Try it online!

Perl 6, 43 37 bytes
-6 bytes thanks to nwellnhof
{(6,{roll 1..[*] @_:}...*)[1+6.rand]}

Try it online!
Anonymous code block that returns the doomsday dice result.
Explanation:
{                                   }   # Anonymous code block
 (                       )[1+6.rand]    # Take a random number from
                     ...*               # The infinite list of
  6,{roll 1..[*] @_:}                   # Cascading dice values
  6,                                    # Starting from 6
    {roll          :}                   # And choosing a random value from
          1..                           # One to
             [*] @_                     # The product of every value so far

Wolfram Language (Mathematica), 43 bytes
(r=RandomInteger)@{1,Nest[r@{1,#}#&,6,r@5]}

Try it online!

J, 21 bytes
1+[:?(*1+?)^:(?`])@6x

Try it online!
+6 bytes thanks to a logic problem spotted by FrownyFrog
NOTE: J has no niladic verbs.  However, this verb will work the same no matter what argument you give it.  In the TIO example, I'm calling it with 0, but I could have used 99 or '' just as well.
how

1+ add one to...
[:? a single roll of an n-sided die (sides reading 0 to n-1), where the number n is determined by...
(*1+?) take the current argument y and roll ? to produce a random number between 0 and y-1.  1+ makes that 1 to y, inclusive.  Finally the * creates a J hook, which will multiply that by y again.
^: do the above this many times...
(?`]) ? roll the initial argument, which is 6, to determine how many times to repeat.  If we roll 0 (corresponding to a 1 on the Prime Bubble), the argument will pass through unchanged.  The ] indicates that 6, unchanged, will be the starting value of repeated (*1+?) verb that determines the die value for the final roll.
@6x attaches the constant verb 6, so that we can call it with anything, and the x forces J to use extended integer computation which we need for the possibly huge numbers.

in this case 0 executes the previous verb once, 1 twice, etc why is that?

because i made a mistake :(.  will fix soon.

Fixed now.  Thanks.

K (oK), 32 bytes
Solution:
*|{x,1+1?x:(*).x}/[*a;6,a:1+1?6]

Try it online!
Start with 6 and "1 choose 6", iterate over "1 choose 6" times:
*|{x,1+1?x:(*).x}/[*a;6,a:1+1?6] / the solution
  {             }/[n;    c     ] / iterate over lambda n times with starting condition c
                            1?6  / 1 choose 6, between 0..5 (returns a list of 1 item)
                          1+     / add 1 (so between 1..6)
                        a:       / store as 'a'
                      6,         / prepend 6, the number of sides of the first dice
                   *a            / we are iterating between 0 and 5 times, take first (*)
           (*).x                 / multi-argument apply (.) multiply (*) to x, e.g. 6*2 => 12
         x:                      / save that as 'x'
       1?                        / 1 choose x, between 0..x-1
     1+                          / add 1 (so between 1..x)
   x,                            / prepend x
*|                               / reverse-first aka 'last'

You can see the iterations by switching the over for a scan, e.g.
(6 3        / 1 choose 6 => 3, so perform 3 iterations
 18 15      / 1 choose (6*3=18) => 15
 270 31     / 1 choose (18*15=270) => 31
 8370 5280) / 1 choose (270*31=8730) => 5280

(*).x -> */x and { }/[*a;6,a:1+1?6] -> a{ }/6,a:*1+1?6

Jelly, 9 bytes
6X×$5Ð¡XX

A niladic Link which yields a positive integer.
Try it online!
Saving a byte over the more obvious 6X×$6X’¤¡X
How?
6X×$5Ð¡XX - Link: no arguments
6         - initialise left argument to 6
    5Ð¡   - repeat five times, collecting up as we go: -> a list of 6 possible dice sizes
   $      -   last two links as a monad = f(v):           e.g [6,18,288,4032,1382976,216315425088]
 X        -     random number in [1,v]                     or [6,6,6,6,6,6]
  ×       -     multiply (by v)                            or [6,36,1296,1679616,2821109907456,7958661109946400884391936]
       X  - random choice (since the input is now a list) -> faces (on final die)
        X - random number in [1,faces]

Nice. I was trying to think of a way from moving beyond my ‘obvious’ answer, but didn’t think of generating all the dice and then picking one at random.

Heh, I missed that you'd posted almost that exact answer!

05AB1E, 10 bytes
X6DLΩF*DLΩ

The random choice builtin for large lists is pretty slow, so may result in a timeout if the Prime Bubble roll is for example a 6.
Try it online or try it online with added prints to see the rolls. (TIO uses the legacy version of 05AB1E, since it's slightly faster.)
Explanation:
X           # Push a 1 to the stack
 6          # Push a 6 to the stack
  D         # Push another 6 to the stack
   L        # Pop the top 6, and push a list [1,2,3,4,5,6] to the stack
    Ω       # Pop and push a random item from this list (this is out Prime Bubble roll)
     F      # Loop that many times:
      *     #  Multiply the top two values on the stack
            #  (which is why we had the initial 1 and duplicated 6 before the loop)
       D    #  Duplicate this result
        LΩ  #  Pop and push a random value from its ranged list again
            # (after the loop, output the top of the stack implicitly)

Jelly, 9 bytes
6×X$X’$¡X

Try it online!
Jonathan Allan's answer claims that it's

Saving a byte over the more obvious 6X×$6X’¤¡X

. In fact, we don't need to make such a big modification. Therefore, this is an alternative approach to Jonathan Allan's answer, and, also, a resting place for my initial invalid 6-byter. :(

R, 43 bytes
s=sample
for(i in 1:s(k<-6))T=s(k<-k*T,1)
T

Try it online!
k keeps track of the current number of faces on the die. Uses the fact that T is initialized as 1.
I tried a few other things, but couldn't beat this simple, straightforward approach.

Python 3, 76 bytes
from random import*
r=randint
a=6
for i in" "*r(0,5):a*=r(1,a)
print(r(1,a))

Try it online!
-2 bytes thanks to TFeld

-2 bytes by changing the import

@TFeld thanks [filler]

Perl 5, 54 bytes
$a=6;map$a*=$r=1+int rand$a,0..rand 6;say 1+int rand$r

Try it online!

That's one rand too many, you should just say$r

Charcoal, 16 bytes
⊞υ⁶Ｆ⊕‽⁶⊞υ⊕‽ΠυＩ⊟υ

Try it online! Link is to verbose version of code. Explanation:
⊞υ⁶

Push 6 to the predefined list.
Ｆ⊕‽⁶

Repeat a random number of times from 1 to 6...
⊞υ⊕‽Πυ

... push a random number between 1 and the product of the list to the list.
Ｉ⊟υ

Output the last number pushed to the list.
Alternative approach, also 16 bytes
≔⁶θＦ‽⁶≧×⊕‽θθＩ⊕‽θ

Try it online! Link is to verbose version of code. Explanation:
≔⁶θ

Set the number of sides to 6.
Ｆ‽⁶

Repeat a random number between 0 and 5 times...
≧×⊕‽θθ

... multiply the number of sides by a random number from 1 to the number of sides.
Ｉ⊕‽θ

Print a random number from 1 to the number of sides.

Java 10, 214 93 86 bytes
v->{int r=6,n=0;for(var d=Math.random()*6;d-->0;n*=Math.random(),r*=++n)n=r;return n;}

Try it online or try it online with additional print-lines to see the steps.
-128 bytes by using int instead of java.math.BigInteger. \$6^{32}\$, the largest possible result, doesn't fit inside an int nor long, which is why BigInteger was used initially. OP allowed to use int and assuming it's infinitely large, so that saved more than 125 bytes here. :) (Here the previous 214 bytes version using BigIntegers.)
Explanation:
v->{                        // Method with empty unused parameter & integer return-type
  int r=6,                  //  The range in which to roll, starting at 6
      n=0;                  //  The roll itself (which must be initialized, therefor is 0)
  for(var d=Math.random()*6;//  Roll the Prime Bubble Dice
      d-->0                 //  Loop that many times:
      ;                     //    After every iteration:
       n*=Math.random(),    //     Roll a random dice in the range [0, n)
       r*=++n)              //     Increase `n` by 1 first with `++n`, so the range is [1,n]
                            //     And then multiply `r` by `n` for the new range
    n=r;                    //   Set `n` to `r`
  return n;}                //  After the loop, return `n` as result

Post the solution that doesn't do BigInteger as your competing solution.

@Stackstuck Will await what OP has to say to your comment. Was about to make one myself to confirm. I personally use BigIntegers/BigDecimals for challenges where it's necessary, unless OP explicitly states you can use your native max integer size (which is usually $2^{32}$, so int for both Java and .NET C#).

I'll see if I can find anything on meta about this.

OP says don't worry about integer size limits.  Use the int type.

@Stackstuck Done, and golfed 7 bytes in the process. :)

Ruby, 41 bytes
r=6;rand(2..7).times{r*=$s=rand 1..r};p$s

Try it online!
Explanation
r=6                                 # Set dice number to 6

rand(2..7).times{               }   # Repeat X times, where X=dice roll+1
                 r*=$s=rand 1..r    # Multiply dice number by a dice roll
                                    # Save the most recent dice roll

p$s                                 # Print last dice roll (this is why
                                    #  we did the last step one extra time)

Jelly, 10 bytes
6×X$6X’¤¡X

Try it online!
Explanation
       ¤   | Following as a nilad:
    6X     | - A random number between 1 and 6
      ’    | - Decrease by 1 (call this N)
6          | Now, start with 6
   $    ¡  | Repeat the following N times, as a monad
 ×         | - Multiply by:
  X        |   - A random number between 1 and the current total
         X | Finally, generate a random number between 1 and the output of the above loop

C# (.NET Core), 136 bytes
class A{static void Main(){var r=new System.Random();int i=r.Next(6),j=6;while(i-->0)j*=1+r.Next(j);System.Console.Write(r.Next(j)+1);}}

Try it online!
I'm pretty sure this works, given the assumption of infinite integer length that we're fond of here.  If I have to actually handle the overflow, I'd need to bust out an entirely different class.

It can now give a System.ArgumentOutOfRangeException: 'maxValue' must be greater than zero error. The max result can be $6^{32}$, which is larger than the max size of both int and long, so you'll have to use BigIntegers instead.

@KevinCruijssen yes, that's the whole point of my comment.

Pyth, 14 bytes
uhO=*|Z6GO6hO6

Try it online!
uhO=*|Z6GO6hO6
         O6      Random number in range [0-6)
u                Perform the following the above number of times...
           hO6   ... with starting value G a random number in range [1-6]:
    *   G          Multiply G with...
     |Z6           The value of Z, or 6 if it's the first time through (Z is 0 at program start)
   =  Z            Assign the above back into Z
  O                Random number in range [0-Z)
 h                 Increment
                 Implicit print result of final iteration

Gaia, 13 bytes
:(ṛ×
6₅ṛ(↑ₓ(ṛ

Try it online!

Julia 1.0, 60 bytes
g(b=big(6),r=rand)=(for i in 1:r(0:5) b=b*r(1:b) end;r(1:b))

b=big(6) makes it work with arbitrary sized integers
Try it online!

PHP, 59 bytes
$r=$q=rand(1,$s=6);while($l++<$q)$r=rand(1,$s*=$r);print$r;

expanded:
$r=$q=rand(1,$s=6);
while($l++<$q)$
    r=rand(1,$s*=$r);
print$r;

Not sure if I'm supposed to include the open tag.
On my machine, it crashes if $s*$r is too large, so it doesn't print on $q>=5 sometimes... because the numbers get so big. Not sure of a fix.

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


text:
Finding row wise sum of transpose of hv-convex binary matrix
I'm stuck on a problem involving the Gale-Ryser Theorem. The problem's input gives me the row-wise sum of an hv-convex binary matrix(n*m).
e.g. I get {4,3,2,2,1} in the input. It's the row wise sum of the following matrix:

    1 1 1 1
    1 1 1 0
    1 1 0 0
    1 1 0 0
    1 0 0 0

To solve the problem, I have to find the row-wise sum of it's transpose.
i.e. I need to calculate {5,4,2,1}

1 1 1 1 1
1 1 1 1 0
1 1 0 0 0
1 0 0 0 0

Can it be achieved in less than O(n*m)?

I got the answer here.

This might be more appropriate on cs.stackexchange.com, and you have already posted there. They'll ask you what you have already tried before giving hints to it.

This could probably still be somewhat salvageable as a challenge. Trivial for golfing languages but solutions in "real" languages could be interesting.


text:
Make Plan 9 Cat Turing Complete in as Few Bytes as Possible
Your task is to modify the original Plan 9 cat tool for UNIX, in order to make it a fully turing complete language interpreter. You may make use of ANSI escape codes and the backspace character (\x08) to aid in this.
You must submit:

A modified version of the Plan 9 cat tool
A hexdump of the turing machine that can be run like so: cat turing_machine where turing_machine is the file you wrote.

Your score is the number of bytes you changed in the Plan 9 cat source code (where replacing a character counts as two bytes because you have to remove it and then replace it).
Here is the Plan 9 cat source code, taken from here.
#include <u.h>
#include <libc.h>

void
cat(int f, char *s)
{
    char buf[8192];
    long n;

    while((n=read(f, buf, (long)sizeof buf))>0)
        if(write(1, buf, n)!=n)
            sysfatal("write error copying %s: %r", s);
    if(n < 0)
        sysfatal("error reading %s: %r", s);
}

void
main(int argc, char *argv[])
{
    int f, i;

    argv0 = "cat";
    if(argc == 1)
        cat(0, "<stdin>");
    else for(i=1; i<argc; i++){
        f = open(argv[i], OREAD);
        if(f < 0)
            sysfatal("can't open %s: %r", argv[i]);
        else{
            cat(f, argv[i]);
            close(f);
        }
    }
    exits(0);
}

The headers in the above source are u.h and libc.h. Your code must conform to the C99 standard.

Is the "Turing machine" code in a Turing-complete language of our choice, or an actual Turing machine? What is it supposed to do? I would have thought the idea would be to demonstrate Turing-completeness by being able to run the code of any  file, but the challenge requiring and counting bytes for a specific Turing machine that's submitted makes me think I'm not understanding it.

Yeah, I should probably change that, thanks for pointing it out

I'm still not clear what's going on with the "turing machine" file. For instance, can it be C code that our code executes?

So we are supposed to create an interpreter for a Turing complete language, and the score is how close it is to the plan 9 cat program?

266 256 250 245 149 bytes (probably)
Thanks to @someone for suggesting using a cyclic tag system (originally I was using a modified version of Brainfuck).
Real computers aren't actually Turing-complete, because they have a finite amount of memory, whereas a Turing-machine has an infinite amount of memory. This is an implementation of a cyclic tag system with 9999 bytes of memory (although you could very easily change that), and with an initial word of 1 (I'm not entirely sure if cyclic tag systems with a fixed initial word are Turing-complete, but they probably are). The length of the program must be ≤8192, in this format:
00 (the first byte is ignored)
01 01 02 00 (first rule: 001 (null character to mark end))
02 02 02 01 02 00 (second rule: 11101)
03 (marks end of program)

There is no I/O. The added code should be C99-compliant (provided the input code doesn't use more than 9999 bytes of memory at once), but I'm pretty sure you can't (portably) declare main as void in C99.
#include <u.h>
#include <libc.h>

void
cat(int f, char *s)
{
    char buf[8192],m[9999];
    long n;

    while((n=read(f, buf, (long)sizeof buf))>0){char m[9999],*M=m+9998,*s=m,*e=m+1,*i=buf;*m=2;m[1]=0;do{for(i++;*i;i++){if(*i>2)i=buf+1;if(*s>1){*e++=*i;if(e>M)e=s;}}if(++s>M)s=m;}while(*s);
        /*if(write(1, buf, n)!=n)
            sysfatal("write error copying %s: %r");*/}
    if(n < 0)
        sysfatal("error reading %s: %r", s);
}

void
main(int argc, char *argv[])
{
    int f, i;

    argv0 = "cat";
    if(argc == 1)
        cat(0, "<stdin>");
    else for(i=1; i<argc; i++){
        f = open(argv[i], OREAD);
        if(f < 0)
            sysfatal("can't open %s: %r", argv[i]);
        else{
            cat(f, argv[i]);
            close(f);
        }
    }
    exits(0);
}

Slightly de-golfed, and printing each step:
#include <u.h>
#include <libc.h>

void
cat(int f, char *s)
{
    char buf[8192];
    size_t n;

    while((n=read(f, buf, (long)sizeof buf))>0) {
        char mem[9999];
        *mem=2;mem[1]=0;
        char* mem_end = &mem[9998];
        char*start=mem,*end=mem+1,*i=buf;
        do {
            for (char* p = start; p < end; p++) {
                printf("%d",*p - 1);
            }
            printf("\n");
            for (i++;*i;i++) {
                if(*i>2)i = buf+1;
                if (*start > 1){
                    *end++=*i;
                    if (end > mem_end)
                        end = mem;
                }
            }
            if (++start>mem_end)start=mem;
        } while (*start);
        /*if(write(1, buf, n)!=n)
            sysfatal("write error copying %s: %r");*/
    }
    if(n < 0)
        sysfatal("error reading %s: %r", s);
}

void
main(int argc, char *argv[])
{
    int f, i;

    argv0 = "cat";
    if(argc == 1)
        cat(0, "<stdin>");
    else for(i=1; i<argc; i++){
        f = open(argv[i], OREAD);
        if(f < 0)
            sysfatal("can't open %s: %r", argv[i]);
        else{
            cat(f, argv[i]);
            close(f);
        }
    }
    exits(0);
}

The following Python script converts any cyclic tag system into code which is accepted by this program:
productions =   [[0,0,1],
                 [0],
                 [0,0],
                 [0,1,1,1]]
f = open("turing_machine","w")
f.write("\0") # First byte is ignored
for production in productions:
    for c in production:
        f.write(chr(c+1))
    f.write("\0")
f.write("\3")
f.close()

When you run the output of this program with the de-golfed version, you get:
1
001
01
1
0111
111
110
1000
0000111
000111
00111
0111
111
11001
10010
001000
01000
1000
0000
000
00
0

Do you really need the &&*mem check for ]?

You're right that I shouldn't, but I just took it out and I got a segmentation fault with the hello world program. I'm not sure why...

Does it error with GCC with -g -fsanitize=address? I think you can also use the variable m directly as the memory pointer instead of M. Bitwise cyclic tag also might or might not turn out shorter.

You were right that it was shorter. Also I think I figured out the problem with the Brainfuck version: the memory wasn't initialized to 0 (it was originally, but then I made it slightly shorter by making m local).


text:
Is there are exactly one partition, given length of partition and maximum number?
It is Restricted Integer Partitions, but with maximum number.
Question
Three positive integers are given. First number is number to divide, second number is length of partition, and third number is maximum number. First number is always largest, and bigger than other two.
For example, 5, 2, 3. Then, make partition of 5 which have 2 parts, and maximum number you can use is 3. Note that you don't have to use 3 : maximum number can be 2 or 1.
In this case, there is only one partition : 3, 2.
Partition is unordered : which means 3 + 2 and 2 + 3 is same.
But in case like 7, 3, 3, there are two partition : 3, 3, 1 and 3, 2, 2.
To make it sure, You can use third number as largest number, but you don't have to use it. So 5, 4, 3 is true.
Question is : Is there are more than one partition, given length and maximum number?
Output is True or 1 or whatever you want when there is only one partition, and False or 0 or whatever you want where there are more than one partition, or no partition.
Winning condition
This is code golf, so code with shortest byte wins.
Examples
Input -> Output
7, 6, 2 -> True (2+1+1+1+1+1) : 1 partitions
5, 4, 4 -> True (2+1+1+1) : 1 partitions
5, 4, 3 -> True (2+1+1+1) : 1 partitions
5, 4, 2 -> True (2+1+1+1) : 1 partitions
5, 3, 2 -> True (2+2+1) : 1 partitions
7, 2, 3 -> False no partitions
7, 2, 2 -> False no partitions
7, 2, 1 -> False no partitions
9, 5, 3 -> False (3+3+1+1+1), (3+2+2+1+1), (2+2+2+2+1) : 3 partitions
6, 3, 3 -> False (3+2+1), (2+2+2) : 2 partitions

Are the input number guaranteed to be positive integers?

Ah, I forgot that. Yes.

It would be good for the challenge to have test cases that include subtle cases where a solution might fail. Also, I'd suggest saying that you're talking about unordered partitions, meaning the 2+3 and 3+2 don't count as two different partitions.

@xnor I added some examples, but I couldn't find subtle cases.

How do you get 7, 6, 2 -> True? With dividing 7 into 6 parts, I only see 2+1+1+1+1+1. Also, you say that the first number is always the largest, but it's not with 2, 7, 3.

@xnor because there are only one partition. In 2+1+1+1+1+1, 2 is maximum number. And I mistyped 2, 7, 3. I'll fix it.

shouldn't the second test case be 5, 4, 2?

@attinat You don't have to use third number as largest number : it is largest number that you 'can' use, not you 'must' use. Sorry if it is not clear.

When you say that the first number is the largest, is it always strictly bigger than the other two, or can it be equal?

@xnor It can't be equal. Sorry for unclear question, and I'll fix it.

Currently a rule that fits all your test cases is "the first number is exactly one bigger than the second number", which makes it easy for a solver to mistakenly think an incomplete solution of theirs is right because it passes the test cases.

Doesn't 9, 5, 3 also have (2+2+2+2+1)?

@JonathanAllan My fault. I'll fix it.

Python 2, 38 bytes
lambda n,k,m:m>n-k<2or-1<k*m-n<2+2/m*k

Try it online!
Characterizes the cases where there's only one legal partition.
Consider the partitions of \$n\$ into exactly \$k\$ parts each between \$1\$ and \$m\$ inclusive. There's only two ways to for there to be only one such partition.

The number \$n\$ is close to as small as possible (\$n=k\$ or \$n=k+1)\$ or as large as possible (\$n=mk-1\$ or \$n=mk)\$ for such a partitions. This leave only enough "wiggle room" for only one partition in each case:

\$n=1+1+\cdots +1+1\$.
\$n=2+1+\cdots+1+1\$.
\$n=m+m+\cdots+m+(m-1)\$.
\$n=m+m+\cdots+m+m\$.

We allow only \$m=2\$ maximum, forcing a unique partition made of 1's and 2's. Such a partition requires \$k \leq n \leq 2k\$.

The challenge lets us assume that \$n>k\$, so we can omit the \$n=k\$ case and \$k \leq n\$ check, and, as feersum observed, can let us check \$n=k+1\$ as \$n<k+2\$.  The \$m=1\$ case makes it impossible to make a partition with \$n>k\$, so we make sure it's always rejected. This gives the condition

\$n \in \{ k+1, mk-1, mk\}\$and \$ m>1\$, or \$n \leq 2k \$ and \$m=2\$

n-k==1 can be n-k<2.

@feersum Thanks, edited.

Wolfram Language (Mathematica), 39 38 bytes
-1: first argument > other arguments (no length-1 partitions)
1==Tr[1^IntegerPartitions[#,{#2},#3]]&

Try it online!

Ah, wolfram language. There is always built-in to solve something about math. Nice one.

Jelly, (10?) 11 bytes
Œṗṁ«⁵ɗƑƇL⁼1

A full program which accepts N numberOfParts maximalSizeOfAnyPart as arguments and prints 1 if exactly one solution exists and 0 otherwise.
Try it online!
How?
Œṗṁ«⁵ɗƑƇL⁼1 - Main Link: N, numberOfParts
Œṗ          - integer partitions (of N)
       Ƈ    - keep those (P) for which:
      Ƒ     -   is invariant under:
     ɗ      -     last three links as a dyad - i.e. f(P, numberOfParts):
  ṁ         -       mould (P) like (numberOfParts)
    ⁵       -       3rd argument (maximalSizeOfAnyPart)
   «        -       minimum (vectorises)
        L   - length
          1 - literal one
         ⁼  - equal?
            - implicit print

If we may print 1 if exactly one solution exists and 0 OR nothing otherwise then Œṗṁ«⁵ɗƑƇMỊ is a 10 byte full program.

Minor comment: « is minimum.

Thanks Nick, fixed up the commentary.

05AB1E, 8 bytes
ÅœIù€à@O

Try it online!
Outputs truthy when there’s exactly one partition, falsy otherwise. (All numbers except 1 are falsy in 05AB1E, which makes this convenient).
Åœ                    # integer partitions of the first input
  Iù                  # keep only those with length equal to the second input
    €à                # take the maximum of each one
      @               # test if the third input >= each one
       O              # sum

Jelly, 7 bytes
œċ§ċ⁵=1

Try it online!
A full program taking the arguments in the order maximum part, number of parts, sum (i.e. reversed from original question).
Explanation
œċ      | Combinations with replacement (using maximum part size and number of parts)
   §    | Sum (vectorises)
    ċ⁵  | Count occurrences of desired integer from question
     =1 | Check if equal to 1


text:
Using the smallest number of bytes of code, write a program that produces this image
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the challenge to all programming languages allowed.
Goal:
The goal of this golf is to write a program as short as possible that generates a PNG file which, after converting to bitmap shares the same resolution and pixel color values as the following image (alternate link, SHA256: ab18085a27c560ff03d479c3f32b289fb0a8d8ebb58c3f7081c0b9e1895213b6):

Rules:

The program must work offline, i.e. when the language runtime/interpreter is installed, no internet connectivity is installed to build/run the program,
The program may not rely on any external libraries (only use standard library of your language, as opposed to adding libraries from pip/npm/cargo/maven/whatever repositories),
The program must complete its operation within 60 seconds on a regular desktop computer (i.e. no brute-forcing the results).

What do you mean by "external libraries?"

Is a PNG encoder external? Do we have to output a PNG image, or will a, say, PPM do?

For me, the link to the original challenge times out. Not sure if that's a temporary problem or a broken link

@someone a valid PNG. PNG encoder is not external

@EsolangingFruit I mean restricting oneself to standard library of the used language, as opposed to installing libraries from pip/cargo/npm.

These always end up being full of long strings being base64decoded. Can you tell us more about the image, to help facilitate other approaches?

The secondary task of golfing a PNG encoder seems like it might overshadow the main thrust of the challenge.

@gastropner not that much - if you use zero compression level, there's not that much complexity added.

@d33tah I believe this still fits the Cumbersome IO formats thing from "Things to avoid when writing challenges" extremely well. In particular, a PNG file has CRC checksums that have to be calculated.

Someone want to do this in Piet?

@msh210 I think that would require either writing a PNG encoder in Piet (no sane person could ever do that) or hardcoding a optimized version of the image. I think there are some programs for generating Piet programs.

Do we have a PNG encoder challenge?

@lirtosiast, I think https://codegolf.stackexchange.com/q/27086/194 is the only one, and it's rather more restricted.

Why are external libraries banned again? I thought we allowed them by default as long as it was treated as a separate "language" (e.g. "Ruby + rmagick")

C#, 849 793 771 bytes
using System;using System.Drawing;using System.IO;class P{static void Main(){dynamic x,y,i=new Bitmap(Bitmap.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"),0,312))),d=new Bitmap(1920,1080),g=Graphics.FromImage(d);for(y=0;y<54;y++)for(x=0;x<96;x++)g.FillRectangle(new SolidBrush(i.GetPixel(x,y)),new Rectangle(x*20,y*20,20,20));d.Save("s.png");}}

Tested with the following code:
class P
{
    static void Main()
    {
        Bitmap a = new Bitmap(@"c:\projects\confidence_2019_golf.png");
        Bitmap b = new Bitmap(@"c:\projects\s.png");

        Console.WriteLine(a.Width + ", " + b.Width);
        Console.WriteLine(a.Height + ", " + b.Height);

        for (int y=0; y<a.Height; y++)
        {
            for (int x=0; x<a.Width; x++)
            {
                Color ca = a.GetPixel(x, y);
                Color cb = b.GetPixel(x, y);

                if (ca.R != cb.R || ca.G != cb.G || ca.B != cb.B)
                {
                    Console.WriteLine(x + ", " + y);
                    Console.WriteLine(ca.R + ", " + ca.G + ", " + ca.B);
                    Console.WriteLine(cb.R + ", " + cb.G + ", " + cb.B);
                }
            }
        }
    }
}

Ungolfed:
using System;
using System.Drawing;
using System.IO;
class P
{
    static void Main()
    {
        dynamic x = 0;
        dynamic y = 0;
        dynamic b = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC");
        dynamic i = new Bitmap(Bitmap.FromStream(new MemoryStream(b, 0, 312)));
        dynamic d = new Bitmap(1920, 1080);
        dynamic g = Graphics.FromImage(d);
        for (y = 0; y < 54; y++)
        {
            for (x = 0; x < 96; x++)
            {
                g.FillRectangle(new SolidBrush(i.GetPixel(x, y)), new Rectangle(x * 20, y * 20, 20, 20));
            }
        }
        d.Save(@"c:\projects\s.png");
    }
}

iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC should work for the image as well; produced with zopflipng, assuming I did everything right.

Cool! Thanks @someone

You also most likely do know the length of the array "bytes" in advance; I believe it's 312 or something close.

You do not have to set y and x to 0 in the for loops as they are already 0. Doesn't the Bitmap constructor accept a Stream object directly? You might or might not be able to save bytes by placing the program in the System.Drawing namespace (automatically using System if my brain works right) and referring to MemoryStream directly.

Thanks, I'm moving on to a javascript based solution. C# is just too verbose...

@someone Mind if I use that base64 string? The shortest one that I got was 432 bytes long, iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2CAMAAAAPkWzgAAAAGFBMVEUAAABdAgSMAwajBAeugIHFgYLRgYP///9UI1evAAAA5UlEQVR4Ae2WBYKEQAwERwj9/x9fOpO9dcUhNW6pVSAtSxDkB3yzl7ufE4JC8lNWIghBCABtWVmrPXjNKiElLvjwFwE0WwiXuKZVKQEUcJOmM8/ey92nUytqpSLjlAAX+DuACRQAPwrQBKxaLBS0KrfJwk2afnoHFQx5/g5cACpgVrNR8f4d3MvuD5RL/meqUTYqILe71iWoiijF6PtebgVdJ7JWwUnSwrBwwJ7hc9wjEoJpBZ3io/s4/iWvWSByDnX/EZ176StC8J3p/CWLCHtnzqurFpx5/py0XsEPcUIQgl8Igj+TIw9ZgY4inAAAAABJRU5ErkJggg==

@Embodiment I guess that string is not really copyrighted or anything... You should feel free to use it.

@someone what's the non-slang for zopflipping so I can wikipedia it?

@MagicOctopusUm Zopfli is a deflate, zlib and gzip compression engine by Google. It compresses better than all other deflate compression things I know as of now, but is (tweakably; as much as you want it to be) very slow (when the file being compressed is not < 1KiB). It (at least for me; I install stuff by typing sudo apt install stuff and wondering how does that even work) ships with a tool for optimizing PNG images (as they use deflate as well), zopflipng. Wikipedia link

replace every dynamic with var will save a few bytes, Also Bitmap.FromStream is the same as Image.FromStream

HTML + Javascript, 607 591 527 bytes
Thank you Epicness and Someone.
HTML, 436 bytes
SAVE<canvas id=c width=1920 height=1080

Javascript, 91 bytes
b.href=c.toDataURL((d=c.getContext`2d`).drawImage(a,d.imageSmoothingEnabled=0,0,1920,1080))

JSFiddle

How are you counting bytes? I count 146 for Javascript and 543 for HTML (the total is correct though). I golfed the Javascript a bit; JSFiddle

Thanks, I'm not sure what happened.

Are you sure you want the "SAVE" link at all? I think you can simply alert c.toDataUrl().

Yes, I was not sure about that. alert does not show all the content, perhaps console.log?

For me, a recent version of Firefox infers the image/png thing by itself, allowing you to omit it (that is, leave data:;base64,STRING). I'm not sure about Chrome. Alert clips at P+77/ for me; is it the same for Chrome, if you're using that?

Cool, data:;base64,STRING also works in Chrome and Edge. Chrome clips the alert at 2000 chars. All the duplicate 'A' in the base64 string is bothering me. Replacing AAA with ~ gets it down from 416 to 402 bytes but will need some extra javascript to work...

Ok that didn't really work JSFiddle

I have no idea how does that work but the quotes around the data URL don't seem to be necessary.

i already upvoted but... technically... does this create a png file?

591 bytes.. I stole some of the ideas from this thread and threw a few bytes off the JS myself.

@donbright, It generates a PNG file when you click on the 'SAVE' link  ;-)

@JohanduToit I think the "SAVE" text can be omitted, as the canvas is already part of the link. I was unable to find any further improvements neither to the Javascript nor to the HTML code, so I think we have to either change the approach or the language.

@someone, just out of interests, how much can you get these Images compressed? Perhaps using 1bbp with transparency or to a GIF?

@someone, see my answer below for a different approach.

@JohanduToit , I was, unsurprisingly, able to reduce the images. Something I'd like to note is that I'm not a black box that shrinks your images in size (I simply feed them to zopflipng and similar stuff) and that other image formats can be better for compression. WebP is, AFAIK, supported by Firefox and Chrome, and is better than PNG. FLIF is even better, but supported by, AFAIK, nothing. I was extremely disappointed when the targz archive containing the resulting images didn't fit in a comment, so you can download it at http://s000.tinyupload.com/index.php?file_id=18210440611599235182 .

@someone, I really appreciate your effort and did not mean to offend.

Firefox lets me right-click the canvas to save it, but if that doesn't count, why not set the image src instead of the link href?

Use the base64-encoded webp image UklGRgABAABXRUJQVlA4TPMAAAAvX0ANALXIcSTJkST68N2Xs2p6ZJgUYgEpOVBwcYtMwGKJpBDAL5EUqioEEAAFTf8n4Akeel/aoYdx8E3jdbec+Bj0CQIKAqIiKqjd3hEU1L/CRATRBWhApHdtTIzZysYT0r794RjJEja6QbvdpUT9W1xDMYkxMQYEjWM4HPkrhiZRGjZoojYx0THU87bTZpWN2U6bJGMxF1qbRQ69BMYY48POObP4kX5/5753WXNeKm2SAFRBVRKqWK2CKkjmvG1VVbHY7K+aM7lk5mS1qqlaq2raKuh/9u1jI0BVVQNzzmJ3VRVcNluTcPxlBPR/7f3rMRIA instead of the PNG to save a number of bytes I do not want to calculate.

@someone, Cool, saved 64 bytes.

C# (Visual C# Interactive Compiler), 707 bytes
#r"System.Drawing"
using System.Drawing.Drawing2D;dynamic a=new Bitmap(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAGAAAAA2BAMAAADKYYHhAAAAGFBMVEUAAABdAgSMAwb///+jBAfFgYLRgYOugIE5HrT9AAAA20lEQVR4AWKgHIwCQThAFmVECAsA2qsDk4qBGIzjD7qAn5ngvlvAJJ3AdyscTqAr3PqaQwMgVYATKvQPlED5kQaAng2QBVnoCywBVeFQqKu6im83gcP1GFgVqEMVqiIP25MIzRjlmgSPZNufK/Qj1wC+bSKk2w/gHkDUaFZrEXht+85jcDc6FAHcqgsqvX3fkCxfcFZiaK3xL8EckS0ArfVO8u31C4y+FAQBBgbLAOYE9v8HxgDAgiiPXgk6gPykz8ctOzPIgHl0f8mjB1aDGQuyxeDgx3KB37t6B3NXgUgfIi7ZAAAAAElFTkSuQmCC"))),b=new Bitmap(1920, 1080),c=Graphics.FromImage(b);c.InterpolationMode=(InterpolationMode)5;c.PixelOffsetMode=(PixelOffsetMode)4;c.DrawImage(a,0,0,1920,1080);b.Save("b.png");

Only compiles in the interactive window, saves the result in a file called b.png

C (GCC/MinGW), 1439 1406 1386 1382 1092 807 806 800 789 787 786 777 bytes
-33 -4 -11 -9 bytes thanks to ceilingcat
-6 bytes thanks to someone's idea
Edit: Why even dynamically calculate CRCs when the output is static? Dropping that part really slimmed things down.
Somewhat beefier than other entries, but such is C life.
Assumes sizeof(unsigned int) == 4, i.e. 32-bit integers, and little-endianness.
The earlier RLE scheme is replaced by a slightly more complex one. Most of the image (except the "CONFIDENCE" text) is stored as a series of rectangles. Each rectangle is stored as four characters holding (x1, y1) and (x2 + 1, y2 + 1). We start with the lowest colour in the palette and upon hitting a space character in the image data, we increase the palette index.
I have a feeling further compression could be had by storing colours slightly differently and exploiting the additive nature of the colours of overlapping areas.
The "CONFIDENCE" text is stored as a series of characters holding 6 significant bits, each one of which corresponds to a "pixel" in the text.
#define Y*Q++-31
*o,C,x,i,W=5760,H=1080,Z[]={262749,394124,459939,8487086,8552901,8618449,~0};S(b,D,C,B,A,c)char*b;{for(B*=20;B<D*20;B++)for(x=A*20;x<C*20;)bcopy(Z+c,b+B*W+x++*3,3);}(*X)()=fwrite;main(j){char*p=calloc(W,H),d[]="\0\x81\26~\xe9",*Q="&&<57)V;22?E;9LOI3eI[%o7_1yA 7)<;2275;2?EC9I;I3V;I;LI[3_7_1o7_7eA 72<5;9?;_3e7 C;E?G;I?M;O?W;Y?[;]?GAIEMAOEWAYEaAcE??CA?ECG]EaG]9_;]?_ALEMG ?9C;L9M;_9a;_?aAa;c?=A?EIELG I9L;";for(;*Q;)S(p,Y,Y,Y,Y,C+=*Q<33&&Y);for(X("\x89PNG\r\n\32\n\0\0\0\rIHDR\0\0\a\x80\0\0\48\b\2\0\0\0g\xb1V\24\0_\5VIDAT\b\35",1,43,o=fopen("a.png","wb"));i<240;i++)"FStuybLGitTTJfRAaTuUzjBGiTVTJrRAFSTtybLG"[i/6]-64>>i%6&1&&S(p,C+1,j+1,C=17+i/48,j=26+i/6%8*6+i%6,6);for(;H--;p+=X(p,1,W,o))*d=!H,X(d,1,6,o);X("*vC\6\xc7\xe3\20W\0\0\0\0IEND\256B`\x82",1,20,o);}

this segfaults on my machine.

@donbright some compilers/runtimes require #include<stdio.h> to avoid segfaulting.

is stdio considered an external library? if we can include header files like stdio.h then why cant we include header files like Lode Vandevenne's lodepng.h ?

oh i see, "standard libraries" is acceptable. upvoted!

Is 16777215 -1u>>8? That should save two bytes.

@someone It is! But it's better than that! Since we're only ever using the lower three bytes of each palette entry, we can forgo shifting and just use ~0. Thanks!

Could this benefit from raw string literals (R"delim([any unescaped bytes])delim")? AFAIK they are only in C++, but I think gcc might support them as a extension, or changing this to C++ might even save some bytes anyway.

@someone It definitely would. You could even just paste raw data into a regular string, and gcc will eat it up. I usually hesitate a bit from doing that, since I don't enjoy using a hex editor for programming. It would save loads of bytes, though.

HTML + javascript, 504 bytes - Not competing
I still need to get the colors sorted out.
HTML, 35 bytes
<canvas id=g width=1920 height=1080

Javascript, 469 bytes
d=g.getContext`2d`
d[f='fillRect'](0,0,1920,1080)
d[a='globalAlpha']=.4
d[l='fillStyle']=`#a00`
'//>7|@2G:|;;5;|DB9>|R<D>|d.<:|h:B8'.split`|`.map(x=>x.split``.map(c=>(c[w='charCodeAt']()-40)*20)).map(x=>d[f](...x))
d[l]='#fff'
d[a]=1
q=(h,x,y,p,z)=>{b=atob(h).split``;for(var n in b){for(j=8;j--;)b[n][w]()&1<<j&&d[f](x+(n%p*8+j)*z,y+((n/p)|0)*z,z,z);}}
q('xkTXucgcKU1RiikFIVVXuiocKWVRiiwFxkTRucgc',520,340,6,20)
d[a]=.4
q('xgADKKEEKKEEBgADISEEISEExgAD',600,520,3,40)

JSFiddle

I believe you can replace the ...,y+((n/p)|0)*z... bit with ...,y+~~(n/p)*z, but I haven't really compared the images for equality. I was not offended by the second last your comment, but just noted that you could perform image compression as well as I could.

Without the |0 it calculates a floating point value that blurs the image.

Doesn't ~~x basically cast to integer? I tried to find a color that matches the rectangles. An alpha value of 0.5 and the color #BA0408 produces extremely close, but wrong results, likely caused by the differences between various image editors. I think that is possible to get around that by tweaking these values slightly. Disclaimer: in case you are not aware of any good utilities for getting exact pixel colors from screen I could suggest gpick for Linux or ColorPix for Windows.

I will check that out, thanks. I'm hoping that all the rectangles are using the same color and alpha values.

See Diff results for Chrome vs Firefox


text:
Leading and Suffering Numbers
Introduction:
In Dutch, the words leading and suffering, being 'leiden' and 'lijden' respectively, are pronounced the same way. One is written with a "short ei", and one with a "long ij", as we Dutchman would say, but both 'ei' and 'ij' are pronounced [ɛi].
Challenge:
Given a list of numbers, determine which (if any) are leading, and which (if any) are suffering.
A leading number is:

A positive number
Has at least four digits
Is in the highest 50% of the list in terms of value
Is still in the highest 50% of the list in terms of value, if it's 3rd digit is replaced with its 2nd digit, and it's 2nd digit-position is filled with a 0 (i.e. 1234 would become 1024)

A suffering number is:

A negative number
Has at least four digits
Is in the lowest 50% of the list in terms of value
Is still in the lowest 50% of the list in terms of value, if it's 3rd digit is replaced with its 2nd digit, and it's 2nd digit-position is filled with a 0 (i.e. -4321 would become -4031)

Example:
Input: [5827, 281993, 3918, 3854, -32781, -2739, 37819, 0, 37298, -389]
Output: leading: [5827, 281993, 37819, 37298]; suffering: [-32781, -2739]
Explanation:
If we sort and split the numbers into two halves, it would be:
[[-32781, -2739, -389, 0, 3798], [3854, 3918, 5827, 37819, 281993]]

There are only two negative numbers with at least four digits: [-32781, -2739]. Changing the digits as described above wouldn't change their position, so they are both suffering numbers.
For the largest halve, all the numbers have at least four digits: [3854, 3918, 5827, 37819, 281993]. Changing the digits as described above would change some of their positions however. The 3854 would become 3084, putting it below 3798 which is in the lowest 50%, so 3854 is not a leading number in this list. The same applies to 3918 which would become 3098, also putting it below 3798. The other three numbers are leading, as 5827 which would become 5087, which is still above 3798 and is in fact still at the same index of the sorted list. So [5827, 37819, 281993] are the leading numbers.
Challenge rules:

I/O is flexible. Input-list can be a list of integers, 2D digit lists, list of strings, etc. Output can be a list of lists of integers, two separated lists, two strings, both printed to STDOUT, etc.
When determining if a number is leading/suffering, we only look at its new position of that number if only its digits are changed accordingly, not after we've applied the modifications to all numbers.
We output the original numbers, not the modified ones.
The numbers in the leading and suffering output-lists can be in any order.
If the size of the input-list is odd, the number at the center doesn't belong to either halve.
Numbers are guaranteed to remain unique after its modification. So a list like [0, 1, 1045, 1485] isn't a valid input-list, since 1485 would be equal to 1045 after it's modification.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Test cases:
Input: [5827, 281993, 3918, 3854, -32781, -2739, 37819, 0, 37298, -389]
Output: leading: [5827, 281993, 37819, 37298]; suffering: [-32781, -2739]

Input: [-100, 472, 413, -1782]
Output: leading: []; suffering: [-1782]

Input: [-1234, -1235, -1236, 1234, 1235, 1236]
Output: leading: [1234, 1235, 1236]; suffering: [-1234, -1235, -1236]

Input: [-1919, -1819, -1719, -1619, -1500, -1444, 40, 4444, 18]
Output: leading: [4444]; suffering: []

Input: [-1004, -1111, -1000]
Output: leading: []; suffering: [-1111]

Input: [-1004, -1111, -1010, 1000]
Output: leading: [1000]; suffering: [-1111]

Input: [1000, -1000]
Output: leading: [1000]; suffering: [-1000]

Input: [1000, -5000, 4000]
Output: leading: [4000]; suffering: [-5000]

Judging from the test cases, it seems you mean for the 50% to round down when the list's length is odd. You might want to specify that explicitly.

Suggested test case: [1000, -1000]

@Grimy As for your first comment, the rule "If the size of the input-list is odd, the number at the center doesn't belong to either halve" should cover that, right? And added the suggested test case.

05AB1E, 27 24 23 22 21 bytes
(‚εÅmyεD1è0šāǝ}‹y*₄@Ï

Try it online!

22 bytes based on your current 23-byter

@KevinCruijssen I just edited my answer to another 22 I found independently. Now to see if we can combine those optimizations for a 21...

Probably not. I used the © and ®Åm instead of your ÅmUy and X to save a byte, but you now removed the UX as well by doing the Åm ... ‹y after the map, so it's a similar optimization. I actually like yours better, since it doesn't use any unnecessary variables in that case. :)

Dang, very nice find with 0šāǝ! :D Would have never thought of that!

@KevinCruijssen Thanks! There's also D¦0š2Lǝ, which is the same byte-count as D1è0šāǝ.

Python 2, 119 118 111 107 bytes
lambda a:[[n for n in a if sorted(a)[::d][~len(a)/2]*d<int('0'.join(`n*d`[:2])+`n*d`[3:])>999]for d in-1,1]

Try it online!
Outputs as suffering, leading.

Jelly, 30 bytes
,NµD2ị;0Ʋ2,3¦ḌƊ>ẠɗƇÆṁ;999Ɗ)N2¦

Try it online!
Given the length of Grimy’s 05AB1E answer, I’m sure this can be golfed better, but here it is.

JavaScript (Node.js), 162 bytes
a=>[(g=i=>a.filter(n=>n*i>999&(h=t=>a.reduce((a,c)=>a+(c!=n&i*c<i*t(n)),0)>=a.length/2)(x=>x)&h(m=x=>x<0?-m(-x):x>999?m(x/10)*10+x%10:x-x%100+x/10%10)))(1),g(-1)]

Try it online!
Anonymous function that take an array of numbers as input and outputs a 2-element array as output. The first element in the output array is an array of leading numbers, the second element in the output array is an array of following numbers.
// a: input array of numbers
a=>
  // begin output array
  [
    // define a function g with input i
    // when i is 1, generate leading
    // when i is -1, generate following
    (g=i=>
      // function g returns a subset of a,
      // use filter() to select elements
      a.filter(n=>
        // n must be 4 digits and explicitly
        // positive or negative depending
        // on whether we are calculating
        // leading or following numbers
        n*i>999&
        // function h determines whether
        // the current number is in the
        // larger or smaller half,
        // depending on whether we are
        // calculating the leading or
        // following numbers.
        // argument t defines a
        // transformation that should
        // be applied to th current number
        (h=t=>
          // use reduce() to count the
          // number of numbers greater or
          // less than the transformed
          // current number
          a.reduce((a,c)=>
            // add the current total to...
            a+
            // either 0 or 1 depending on
            // whether the transformed
            // current number is in the
            // opposite group (leading vs
            // following
            (c!=n&i*c<i*t(n)),0)>=
          // are at least half in the
          // opposite group?
          a.length/2)
          // invoke h with the identity
          // transform
          (x=>x)&
          // invoke h again with a
          // transform m that moves the
          // 2nd digit to the 3rd digit and
          // 0's out the 2nd digit.
          // input for m is number x
          h(m=x=>
            // is x negative?
            x<0
              // invoke m with negated input
              // to force it to a positive value
              // and negate the result to
              // convert back to negative
              ?-m(-x)
              // otherwise, does x have 4 or
              // more digits?
              :x>999
                // recursively call m with 1
                // fewer digit, then add digit
                // back to the result
                ?m(x/10)*10+x%10
                // 3 or fewer digits, move
                // the 2nd digit to the 3rd
                // and 0 put the 2nd digit
                :x-x%100+x/10%10
        )
      )
    )
    // invoke g with input 1 for leading
    (1),
    // invoke g with input -1 for following
    g(-1)
  ]


text:
The qvolume of an integer
It is ancient knowledge that every non-negative integer can be rewritten as the sum of four squared integers. For example the number 1 can be expressed as \$0^2+0^2+0^2+1^2\$. Or, in general, for any non-negative integer \$n\$, there exist integers \$a,b,c,d\$ such that
$$n = a^2+b^2+c^2+d^2$$
Joseph-Louis Lagrange proved this in the 1700s and so it is often called Lagrange's Theorem.
This is sometimes discussed in relation to quaternions – a type of number  discovered by William Hamilton in the 1800s, represented as $$w+x\textbf{i}+y\textbf{j}+z\textbf{k}$$ where \$w,x,y,z\$ are real numbers, and \$\textbf{i}, \textbf{j}\$ and \$\textbf{k}\$ are distinct imaginary units that don't multiply commutatively. Specifically, it is discussed in relation to squaring each component of the quaternion $$w^2+x^2+y^2+z^2$$This quantity is sometimes called the norm, or squared norm, or also quadrance. Some modern proofs of Lagrange's Theorem use quaternions.
Rudolf Lipschitz studied quaternions with only integer components, called Lipschitz quaternions. Using quadrance, we can imagine that every Lipschitz quaternion can be thought of having a friend in the integers. For example quaternion \$0+0\textbf{i}+0\textbf{j}+1\textbf{k}\$ can be thought of as associated with the integer \$1=0^2+0^2+0^2+1^2\$. Also, if we go backwards, then every integer can be thought of as having a friend in the Lipschitz quaternions.
But there is an interesting detail of Lagrange's theorem – the summation is not unique. Each integer may have several different sets of four squares that can be summed to create it. For example, the number 1 can be expressed in 4 ways using non-negative integers (let us only consider non-negatives for this challenge):
$$1=0^2+0^2+0^2+1^2$$
$$1=0^2+0^2+1^2+0^2$$
$$1=0^2+1^2+0^2+0^2$$
$$1=1^2+0^2+0^2+0^2$$
The summands are always squares of 0, or 1, but they can be in different positions in the expression.
For this challenge, let us also "sort" our summands lowest to highest, to eliminate duplicates, so that we could consider, for this exercise, that 1 only has one way of being represented as the sum of four squares:
$$1=0^2+0^2+0^2+1^2$$
Another example is the number 42, which can be expressed in four ways (again, only considering non-negative a,b,c,d, and eliminating duplicate component arrangements)
$$42=0^2+1^2+4^2+5^2$$
$$42=1^2+1^2+2^2+6^2$$
$$42=1^2+3^2+4^2+4^2$$
$$42=2^2+2^2+3^2+5^2$$
What if we imagine each of these different ways of expressing an integer as being associated to a specific quaternion? Then we could say the number 42 is associated with these four quaternions:
$$0+1\textbf{i}+4\textbf{j}+5\textbf{k}$$
$$1+1\textbf{i}+2\textbf{j}+6\textbf{k}$$
$$1+3\textbf{i}+4\textbf{j}+4\textbf{k}$$
$$2+2\textbf{i}+3\textbf{j}+5\textbf{k}$$
If we imagine the standard computer graphics interpretation of a quaternion, where \$\textbf{i}\$, \$\textbf{j}\$ and \$\textbf{k}\$ are vectors in three dimensional Euclidean space, and so the \$x\$, \$y\$ and \$z\$ components of the quaternion are 3 dimensional Cartesian coordinates, then we can imagine that each integer, through this thought process, can be associated with a set of 3 dimensional coordinates in space. For example, the number 42 is associated with the following four \$(x,y,z)\$ coordinates: $$(1,4,5),(1,2,6),(3,4,4),(2,3,5)$$
This can be thought of as a point cloud, or a set of points in space. Now, one interesting thing about a set of finite points in space is that you can always draw a minimal bounding box around them – a box that is big enough to fit all the points, but no bigger. If you imagine the box as being an ordinary box aligned with the \$x,y,z\$ axes, it is called an axis-aligned bounding box. The bounding box also has a volume, calculable by determining its width, length, and height, and multiplying them together.
We can then imagine the volume of a bounding box for the points formed by our quaternions. For the integer 1, we have, using the criteria of this exercise, one quaternion whose quadrance is 1, \$0+0\textbf{i}+0\textbf{j}+1\textbf{k}\$. This is a very simple point cloud, it only has one point, so it's bounding box has volume 0. For the integer 42, however, we have four quaternions, and so four points, around which we can draw a bounding box. The minimum point of the box is \$(1,2,4)\$ and the maximum is \$(3,4,6)\$ resulting in a width, length, and height of 2, 2, and 2, giving a volume of 8.
Let's say that for an integer \$n\$, the qvolume is the volume of the axis-aligned bounding box of all the 3D points formed by quaternions that have a quadrance equal to \$n\$, where the components of the quaternion \$w+x\textbf{i}+y\textbf{j}+z\textbf{k}\$ are non-negative and \$w<=x<=y<=z\$.
Create a program or function that, given a single non-negative integer \$n\$, will output \$n\$'s qvolume.
Examples:
input -> output
0 -> 0
1 -> 0
31 -> 4
32 -> 0
42 -> 8
137 -> 96
1729 -> 10032

This is code-golf, smallest number of bytes wins.

what do i need to add? i meant to indicate that smallest number of bytes would win

You forgot the code-golf tag, I helped you add it

This is a nice challenge but it would be even better IMHO if it was a bit less verbose. Also, beware of irrelevant links (I'm not saying that all your links are irrelevant, but only a few of them really bring meaningful information for the challenge, while the other ones are just distracting).

Yes, but why take only i, j, k as 3D space but not 4D space?

A related question which required to output 4 numbers which square sum to the input: https://codegolf.stackexchange.com/questions/28169/four-squares-together

@tsh because Quaternions don't necessarily represent a 4 dimensional Euclidean space. Hamilton discovered them while searching for a way to work with 3 dimensional space. It would be possible to do a 4d version but i was pondering their use in 3d space when i made the question

Is it just a coincidence that the sum of coefficients of deduplicated quaternions is equal to its number? Ie. 42? Or does it just follow from the way quaternions are? Sorry if I am asking the obvious, I have no mathematics background.

To be honest, you don't need quaternions to introduct the problem. If you just want to introduce some interesting (mildly-relevant) fact, just spare one paragraph on it, or maybe two.

Wolfram Language (Mathematica), 67 58 bytes
Volume@BoundingRegion[Rest/@PowersRepresentations[#,4,2]]&

Try it online!
                         ...&   Pure function:
PowersRepresentations[#,4,2]    Get the sorted reprs. of # as sums of 4 2nd powers
Rest/@                         Drop the first coordinate of each
BoundingRegion[...]            Find the bounding region, a Cuboid[] or Point[].
                               By default Mathematica finds an axis-aligned cuboid.
Volume                         Find volume; volume of a Point[] is 0.

wow, i had no idea that something like PowersRepresentations would be a built in in a language. i actually thought about making a challenge to show the different ways to sum an integer as four squares but im glad i did not.

Lol, Mathematica even has a builtin for determining goats in an image, so having a builtin for this really doesn't surprise me. xD

Jelly, 17 bytes
Żœċ4²S⁼ɗƇ⁸ZḊṢ€I§P

Try it online! (pretty slow - make it fast enough for all the test cases with a leading ½)
How?
Żœċ4²S⁼ɗƇ⁸ZḊṢ€I§P - Link: non-negative integer, n    e.g. 27
Ż                 - zero-range                            [0,1,2,...,27]
   4              - literal four                          4
 œċ               - combinations with replacement         [[0,0,0,0],[0,0,0,1],...,[0,0,0,27],[0,0,1,1],[0,0,1,2],...,[27,27,27,27]]
        Ƈ         - filter keep those for which:          e.g.: [0,1,1,5]
       ɗ          -   last three links as a dyad:
    ²             -     square (vectorises)                     [0,1,1,25]
     S            -     sum                                     27
      ⁼  ⁸        -     equal to? chain's left argument, n      1
                  -                                       -> [[0,1,1,5],[0,3,3,3],[1,1,3,4]]
          Z       - transpose                             [[0,0,1],[1,3,1],[1,3,3],[5,3,4]]
           Ḋ      - dequeue                               [[1,3,1],[1,3,3],[5,3,4]]
            Ṣ€    - sort each                             [[1,1,3],[1,3,3],[3,4,5]]
              I   - incremental differences (vectorises)  [[ 0,2 ],[ 2,0 ],[ 1,1 ]]
               §  - sum each                              [2,2,2]
                P - product                               8

Haskell, 132 123 bytes
z=zipWith
(!)=foldr1.z
h n=[0..n]
f n|p<-[[c,b,a]|a<-h n,b<-h a,c<-h b,d<-h c,a^2+b^2+c^2+d^2==n]=product$z(-)(max!p)$min!p

Try it online!
Pretty straightforward solution. Brute force all the possible solutions by iterating over all the values from 0 to n (way overkill but shorter bytecount). I output the point as a list so we can use @Lynn's magic (!) operator. That operator collapses each dimension with the function on the left side so max!p returns a list of size 3 which consists of the maximums along each dimension and min!p does the same for minimum. Then we just find the minimum size in each dimension (by subtracting the min value from the max with z(-)) and multiply them together.
Thanks a lot to @Lynn for taking off 9 bytes with some folding zip magic!

I shaved off a few bytes by forgoing the transposition in favor of some zipWith logic. 123 bytes

Sledgehammer 0.2, 12 bytes
⡌⢎⣟⡊⢘⣚⡏⡨⠍⠁⡇⠨

Use with Mathematica 11.2 and this version of Sledgehammer, which predates the challenge. See edit history for a version that works in version 0.3, which has a GUI and generates a Mathematica expression.
This pushes the input to the stack and calls the sequence of commands
{intLiteral[4], intLiteral[2], call["PowersRepresentations", 3], call["Thread", 1], call["Rest", 1], call["Thread", 1], call["BoundingRegion", 1], call["Volume", 1]}

which is equivalent to evaluating the following Wolfram code derived from my Wolfram Language answer:
Volume[BoundingRegion[Thread@Rest@Thread@PowersRepresentations[#, 4, 2]]]&

Try it online!

does this require mathematica to test it?

@don bright Yes, the repository has instructions. It's a work in progress so not very user-friendly yet. After running setup.wls you can test either with wolframscript or interactive_app.wls.

Is Sledgehammer code just a compressed form of its respective Mathematica?

@Downgoat Yes. I plan to implement a golfing library, but currently it decompresses to plain Mathematica.

Surely you can't use a language that is newer than the challenge even if you claim that it makes it larger? Why not use the older version? If the older doesn't work, I don't see how the bytecount can be compared.

@pipe The older version should work (now that I think of it, the code is exactly the same on one older version), but I'd have to download it and run setup again. (The changes since then have mostly been writing the GUI and refactoring code with no major change in functionality.) Since this answer is shortest it seems important to prove the eligibility, so I'll do that tomorrow morning.

can i plug the output of sledgehammer into the Try It Online wolfram language?

@donbright not anymore, I edited the answer to use an older version of Sledgehammer that executes directly instead of building a WL function.

lets say someone didnt have access to mathematica, how would they test it?

@donbright TIO.run doesn't support the Wolfram Cloud, which you need to run the setup function. I could add the file save.mx that setup generates to the repository and write a version of the app that you can paste into tio.run, but as of now there's no way to test.
I realize there are issues with a language most people cannot test, so I'm willing to delete this answer if it's unsatisfying to the community, until I have a stable version that can be put on TIO.run.

can anyone else run this? i kind of would like to verify it works before giving it the ol' checkmark.

better question... is there some way to rent mathematica for a few hours, for a few dollars?

ok so i can get a trial version of mathematica for free for 30 days... will sledgehammer run on linux?

@donbright Probably, though I didn't test it because I don't have Linux.

Python 2, 138 bytes
q=lambda n,x=0,*t:[t]*(n==0)if t[3:]else q(n-x*x,x,x,*t)+q(n,x+1,*t+(0,)*(x>n))
p=1
for l in zip(*q(input()))[:3]:p*=max(l)-min(l)
print p

Try it online!
Recursively generates the reverse-sorted quaternions with the given norm, then takes the product between the max and min of all possible values in the first three indices.
itertools might have had a shot if it didn't use ridiculously long names like itertools.combinations_with_replacement
Python 2, 161 bytes
from itertools import*
n=input();p=1
for l in zip(*[t[1:]for t in combinations_with_replacement(range(n+1),4)if sum(x*x for x in t)==n]):p*=max(l)-min(l)
print p

Try it online!
This is why itertools is never the answer.

JavaScript (ES6),  148  143 bytes
n=>(r=[[],[],[]]).map(a=>p*=a.length+~a.indexOf(1),(g=(s,k=0,a=[])=>a[3]?s||r.map(r=>r[a.pop()]=p=1):g(s-k*k,k,[...a,++k],k>s||g(s,k,a)))(n))|p

Try it online!
Commented
We initialize an array \$r\$ with 3 empty arrays.
r = [ [], [], [] ]

For each valid value of \$x\$, we will set to \$1\$ the value at \$x+1\$ in the first array. Ditto for \$y\$ and \$z\$ with the 2nd and 3rd arrays respectively.
The dimensions of the bounding box will be deduced from the distance between the first and the last entry set to \$1\$ in these arrays.
Step 1
To fill \$r\$, we use the recursive function \$g\$.
g = (              // g is a recursive function taking:
  s,               // s   = current sum, initially set to the input n
  k = 0,           // k   = next value to be squared
  a = []           // a[] = list of selected values
) =>               //
  a[3] ?           // if we have 4 values in a[]:
    s ||           //   if s is equal to zero (we've found a valid sum of 4 squares):
      r.map(r =>   //     for each array r[] in r[]:
        r[a.pop()] //       pop the last value from a[]
        = p = 1    //       and set the corresponding value in r[] to 1
                   //       (also initialize p to 1 for later use in step 2)
      )            //     end of map()
  :                // else:
    g(             //   do a recursive call:
      s - k * k,   //     subtract k² from s
      k,           //     pass k unchanged
      [...a, ++k], //     increment k and append it to a[]
      k > s ||     //     if k is less than or equal to s:
        g(s, k, a) //       do another recursive call with s and a[] unchanged
    )              //   end of outer recursive call

Step 2
We can now compute the product \$p\$ of the dimensions.
r.map(a =>         // for each array a[] in r[]:
  p *=             //   multiply p by:
    a.length +     //     the length of a[]
    ~a.indexOf(1)  //     minus 1, minus the index of the first 1 in a[]
) | p              // end of map(); return p

C# (Visual C# Interactive Compiler), 229 bytes
a=>{uint b=0,c=~0U,d,e,f=0,g=0,h=0,i=c,j=c,k=c;for(;b*b<=a;b++)for(c=b;c*c<=a;c++)for(d=c;d*d<=a;d++)for(e=d;e*e<=a;e++)if(b*b+c*c+d*d+e*e==a){f=c>f?c:f;g=d>g?d:g;h=e>h?e:h;i=c<i?c:i;j=d<j?d:j;k=e<k?e:k;}return(f-i)*(g-j)*(h-k);}

Try it online!

05AB1E, 18 bytes
Ý4ãʒnOQ}€{ζ¦ε{¥O}P

Try it online!
Port of Jonathan Allan's Jelly answer.

Haskell, 104 bytes
n%i=(-).maximum<*>minimum$[t!!i|t<-mapM(:[0..n])[0..3],sum(map(^2)t)==n,scanr1 max t==t]
f n=n%0*n%1*n%2

Try it online!
Thanks to Delfad0r for -1 byte and Lynn for 3 bytes
To multiply the three dimensions, it turns out shortest to just write the product f n=n%0*n%1*n%2 than to use any sort of loop. Here, n%i is the difference between the min and max of the i'th coordinate values, which are extracted with indexing !!i.
To generate the valid four-tuples, we take lists of four numbers from [0..n] whose squares sum to n and are in decreasing order. We check the reverse-sortedness of t with scanr1 max t==t, which sees if the running maximum of the reverse is itself, as Haskell doesn't have a built-in sort without a costly import. I tried various ways to recursively generate the four-tuples like in my Python answers, but they were all longer than this brute-force generate-and-filter way.

I'm probably missing something, but isn't it shorter to just compute maximum l-minimum l? Try it online!

Sure looks like it works! Feel free to post an answer and claim a bounty.

I am definitely not posting a new answer for such a trivial change, especially considering that before looking at your solution I was stuck at about 120 bytes. Also, I don't think my "golf" is worth a bounty. Sooner or later, I hope I'll manage to outgolf you in a non-trivial way; if that ever happens, I'll gladly accept your bounty :)

Some more small byte saves: mapM(:[0..n]) saves two and (-).maximum<*>minimum saves one. (I'd also feel bad accepting a bounty just for this, ha.) Try it online!

jq, 164 bytes
. as$i|[range(.)]|[combinations(4)|select(map(.*.)|add==$i)|sort]|unique|[transpose[1:][]|sort|[.[:-1],.[1:]]|transpose|map(.[1]-.[0])|add//0]|reduce.[]as$j(1;.*$j)

Try it online!
The pairwise reduction can probably be better. For lower numbers, null is substituted with 0 for consistent output.
Idea from Jonathan Allan's answer.
-1 from ovs.

The long map can be replaced with [transpose[1:][]| ... ] for -1