text:
Same number letters
Letters of the words want fairness.
They decided to appear same number of times in a sentence equally.
Example:
Priorities

Will become:
Ppprrioooritttieeesss

Each letter appears 3 times, as the most common letter was i, appearing 3 times.
It does not matter where you put the repeated letters, as long as they are next to a similar letter.
I.e.:
Pppriooorritttieeesss is OK (the 'r' letter)
Ppprioororitttieeesss is not OK (the 'r' letter)
Another example:
invoice

Will become:
innvvooiccee

Another example:
Remittance Advice

Will become:
Rrremmmiitttaannncce Adddvvvice

Space, comma, question mark, quotation, etc. are not considered letters for this challenge.  Only need to consider [a-zA-Z].  Just once space is enough, and the order of the letters should remain the same.
The capitalization of letters does not matter, upper and lower case are countes as the same letter.  That is: Pip has 2 'P's and 1 'I', so it will become Piip.
It is case insensitive letters can be in any form, Piip=piip=piiP=PiiP
This is code-golf

Might I suggest using the Sandbox for future challenges to help iron out all the details before posting the question to main

Is " rrreeemmmiiitttaaannncccdddvvv" an acceptable output in the given example (since the order of the distinct letters (as defined as a-z) is still maintained)? (My Jelly answer currently relies on this interpretation being OK.)

@JonathanAllan Hmm, although I leave the choice to OP, I highly doubt it. Not only are the non-letter characters (the space) gone, but you've also put all characters next to each other instead of keeping it at the same place. Your output makes the challenge different and easier (imho).

If @JonathanAllan's output is not acceptable, then I suggest rephrasing it as inserting letters into the string to avoid trouble over order and such

@KevinCruijssen the space is at the left - it is not a letter hence does not need to adhere to "and the order of the letters should remain the same"

@JonathanAllan Ah, didn't notice the space, my bad. I completely understand the reasoning you provided in your Jelly answer and based on that it's indeed a valid output, but I would rather see the phrasing changed, then allowing your output, since it would completely change the challenge itself.

@JonathanAllan my bad, i should said insert letters so the structure of the word remain the same (if you remove the inserted letters the word go back to its original status) means only piip (all cases upper and lower) are ok but ppii not ok

Thanks, I deleted my answer. I think you want to specify that the output must contain the input as a subsequence. Either way you should always clarify specification in the post when need be (in addition to replying to a comment) so that others do not need to read comments to decipher the challenge.

The input can be all in lowercase?

05AB1E, 16 bytes
lDáÙSÐ¹ls¢Zα>×.;

Try it online!
Explanation
l                  # convert input to lowercase
 D                 # duplicate
  á                # keep only letters
   Ù               # remove duplicates
    S              # split to list of chars
     Ð             # triplicate
      ¹ls¢         # count the occurrences of each letter in lowercase input
          Zα       # absolute valuue with max occurrence
            >      # increment
             ×     # repeat each unique char that many times
              .;   # replace the first occurrence of the char in lowercase input with this

R, 106 bytes
function(s){for(A in L<-LETTERS)s=sub(A,strrep(A,max(x<-+s-+Map(gsub,L,'',s,T))-x[A]--1),s,T);s}
"+"=nchar

Try it online!
Base R approach :

stealing some ideas from @J.Doe R+stringr approach, I saved 26 bytes !
another 5 bytes saved using @J.Doe suggestion to abuse R + operator

I'm impressed you got to 111 with base-R!

@J.Doe : After publishing my original 137 bytes solution, I slightly changed my approach inspired by yours, and I basically converged to your solution, just with stringr removed :D

106 bytes with operator abuse. Base-R wins!

@J.Doe: awesome !

J, 33 56 46 bytes
t=:~:tolower
(#~1+t*~:(*>./-])t*1#.e.)@toupper

Try it online!
Couldn't find a way to avoid using ~:tolower twice.
How it works
t=:~:tolower    Auxiliary function: isupper
     tolower    Is lowercase version of itself...
   ~:           different from itself?

(#~1+t*~:(*>./-])t*1#.e.)@toupper    Main function
                          toupper    Convert to uppercase
                      e.     Build 2D array by comparing to itself
                   1#.       Row-wise sum; Count occurrences
                 t*     A) Filter by isupper (needed for finding max count)
           >./-]        Compute max of A) minus each element of A)
       ~:          Nub sieve; 1 if first occurrence, 0 otherwise
          *        Filter first occurrences only
     t*       Filter by isupper again, to ban non-alphabets from duplicating
   1+         Add one to preserve given chars
 #~           Duplicate

R + stringr, 108 bytes
I am not very good at stringr. Returns a mixture of lower and upper case since the question says it doesn't matter.
function(x){for(l in L<-letters)x=sub(l,strrep(l,max(s<-stringr::str_count(tolower(x),L))-s[L==l]+1),x,T);x}

Try it online!
Explanation
function(x){
for(l in letters){ # Iterate through builtin vector "a", "b", "c"...
   # Generate a 26-long integer vector for how many a's, b's, c's in lower case string
  s = stringr::str_count(tolower(x),letters)
    # Take the max of this
  m = max(s)
    # Repeat the letter in the iteration enough times to make the word 'fair'
  new.l = strrep(l,m-s[letters==l]+1)
    # Substitute the first instance only of the letter in the string for the repeated letter
    # This is case insensitive (the T at the end)
    # Notice we calculate the max letter frequency each loop
    # This is inefficient but doesn't change the answer and avoids bytes
  x=sub(l,new.l,x,T);
  }
x # Return the substituted string
}

JavaScript (ES6), 112 bytes
s=>(m=g=F=>s.replace(/[a-z]/gi,c=>F(c.toLowerCase())))(c=>g[c]=c+c.repeat(m-g[c]),g(c=>m=(n=g[c]=-~g[c])<m?m:n))

Try it online!
Commented
s => (                       // s = input string
  m =                        // m = max. number of occurrences of the same letter
  g = F =>                   // g = helper function taking a callback function F
    s.replace(               //     (also used to store the # of occurrences of each letter)
      /[a-z]/gi,             //   for each letter c in s:
      c => F(                //     invoke F():
        c.toLowerCase()      //       with c.toLowerCase()
      )                      //     end of call to F()
    )                        //   end of replace()
)(c =>                       // invoke g() (second pass):
  g[c] =                     //   update g[c] to a non-numeric value
    c +                      //   append c once, unconditionally
    c.repeat(m - g[c]),      //   and append c as many times as required to reach m
                             //   (any subsequent iteration with the same letter will
                             //   lead to c.repeat(m - g[c]) --> c.repeat(NaN) --> '')
  g(c =>                     //   invoke g() (first pass):
    m = (n = g[c] = -~g[c])  //     increment g[c], save the result in n
      < m ? m : n            //     and update m to max(m, n)
  )                          //   end of first pass
)                            // end of second pass

My JS skills suck, so I'm a bit confused about this part: o[l] = // updates o[l] to a non-numeric value. If I understand correctly, o is an integer-array in the F and g functions, but changes to a string-array holding one or more times the character c at the part I mentioned earlier? Also, I guess the values of o are undefined by default, since you are using o[l]=-~o[l] instead of ++o[l]?

@KevinCruijssen We want each letter to be padded to the maximum number of occurrences only once. By updating o[l] to a letter, any subsequent iteration with the same letter will lead to m - o[l] --> NaN (integer minus letter) and l.repeat(NaN) == ''. (About the last point: yes, that's correct.)

Ah ok, thanks for the explanation! :)

(and I should have said string rather than letter)

Perl 6, 82 bytes
-3 bytes thanks to nwellnhof
->\a{a.=lc.=subst($_,$_ x a.comb(/<:L>/).Bag.values.max+1-a.comb($_))for 'a'..'z'}

Try it online!
Takes a mutable string and modifies it in place.
Explanation:
->\a{        # Anonymous code block that takes a mutable string            }
 a.=lc;  # Lowercase
                                                               for 'a'..'z'  # For each letter
 .=subst(                                                    )  # Substitute
          $_,   #The first occurrence of the letter with
             $_ x  #The letter repeated
                  a.comb(/<:L>/).Bag.values.max    # The count of the most common letter
                                                 +1  # Plus 1
                                                   -a.comb($_)  # Minus the count of that letter already in the string

You can chain the .= operator like a.=lc.=subst(...). I'm not sure whether changing the case of an existing letter is allowed though. Also <:L> instead of <:Ll>.

@nwellnhof Yeah, the asker says that the output is case insensitive

Java 11, 190 176 162 bytes
s->{s=s.toUpperCase();char m=2,i=64,a[]=new char[127];for(int c:s.getBytes())m-=m+~++a[c]>>-1;for(;++i<91;)s=s.replaceFirst(i+"",repeat((i+""),m-a[i]));return s;}

-14 bytes thanks to @Nevay.
Output is in full uppercase.
Try it online. (NOTE: String.repeat(int) is emulated as repeat(String,int) for the same byte-count, because Java 11 isn't on TIO yet.)
Explanation:
s->{                      // Method with String as both parameter and return-type
  s=s.toUpperCase();      //  Convert the input-String to full uppercase
  char m=2,               //  Max occurrence (+1), starting at 2
       i=64,              //  Index integer, starting at 64 ('A'-1)
       a[]=new char[127]; //  Create a count-array of size 127 (printable ASCII chars)
  for(int c:s.getBytes()) //  Loop over the characters of the String as integers
    m-=m+~++a[c]>>-1;     //   Increase the occurrence-counter of the char by 1 first
                          //   And if it's larger than the max-2, increase the max by 1
  for(;++i<91;)           //  Loop `i` in the range ['A', 'Z']
    s=s.replaceFirst(i+"",//   Replace the first char `i` in the string with:
       (i+"").repeat(     //   That same character repeated
        m-a[i]));         //   The max(+1) minus its array-occurrence amount of times
  return s;}              //  Then return the now modified String as result

Can you use var for a byte?

@Quintec Instead of the char you mean? Unfortunately no. var can only be used for single fields. So instead of char m=1,i=127,a[]=new char[i]; it would be var m=1;var i=127;var a=new char[i];. Here a useful tip of what you can and cannot do with Java 10's var. (I could replace the int in the loop with var, but the byte-count would remain the same.)

Gotcha, thanks. Still have no idea how Java 9/10/11 work, haha, I’ll stick to 8 ;p

@Quintec Java 9 I also don't really get, since it's mainly focussed on that REPL. Java 10 is mostly the same as Java 8, except for the var. And Java 11 barely has any changes at all codegolf related, except for the String.repeat method that I've used loads of times already. It also has the new String.stripLeading or String.stripTrailing, which act like trim but only the leading/trailing whitespaces, and String.isBlank() which is the same as String.trim().isEmpty() (empty or whitespace only).

@Quintec You kinda remind me of myself. ;) When I started I primarily used Java 7 and didn't really understand those lambdas and such. Later I changed to Java 8 after I understood it, and even made this test TIO from someone else once, and now I just continue with the latest versions. :)

-14 bytes: s->{s=s.toUpperCase();char m=2,i=91,a[]=new char[127];for(int c:s.getBytes())m-=m+~++a[c]>>-1;for(;i-->65;)s=s.replaceFirst(i+"",repeat((i+""),m-a[i]));return s;}

@Nevay It's been a while since I heard anything from you. I see your bitwise magic is still as strong as ever! :) Thanks for the -14 bytes.

K4, 35 bytes
Solution:
{x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}

Examples:
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"Priorities"
"PPPrrioooritttieeesss"
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"invoice"
"innvvooiccee"
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"Remittance Notice"
"RRRemmmiittaaanncce Noootice"

Explanation:
Might be golfable with a different approach, will keep thinking
{x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x} / the solution
{                                 } / lambda taking implicit argument x
                                _x  / lowercase input
                               =    / group
                           " "_     / drop space from keys
                         g:         / save as g
                       #'           / take each
               (      )             / do this together
                  #:'g              / count occurances in each group
                |/                  / take the maximum
             ,/                     / flatten with
        (&^x)                       / indices where input is null (ie " ")
      o:                            / save as o
     <                              / indices to sort o ascending
   o@                               / apply these to o
 x@                                 / apply these indices to original input

Charcoal, 33 32 bytes
⭆↧θ⁺§θκ×ι∧№βι∧⁼κ⌕↧θι⁻⌈Ｅβ№↧θλ№↧θι

Try it online! Link is to verbose version of code. Explanation:
  θ                                 Input string
 ↧                                  Lower case
⭆                                   Map over characters and join
      κ                             Current index
     θ                              Input string
    §                               Original character
   ⁺                                Concatenate with
        ι                           Lowercased character
       ×                            Repeated
            ι                       Lowercased character
           β                        Lowercase alphabet
          №                         Count
         ∧                          Logical And
                   ι                Lowercased character
                  θ                 Input string
                 ↧                  Lower case
                ⌕                   Find
               κ                    Current index
              ⁼                     Equals
             ∧                      Logical And
                       β            Lowercase alphabet
                      Ｅ             Map over characters
                           λ        Current character
                          θ         Input string
                         ↧          Lower case
                        №           Count
                     ⌈              Maximum
                    ⁻               Minus
                               ι    Lowercased character
                              θ     Input string
                             ↧      Lower case
                            №       Count
                                    Implicitly print

Japt -h, 27 bytes
-3 bytes from @ETHproductions
;v
ñ oC ó¥ ú £=iXÎpXèS)UbXg

Trying to explain
;v                          Convert implicit input to lowercase
ñ oC ó¥ ú £=iXÎpXèS)UbXg      Main function. Implicit lowercase input => "priorities"
ñ                           Sort => "eiiioprrst"
 oC                         Remove non alphabetical chars
   ó¥                       Split on different letters => ["e","iii","o","p","rr","s","t"]
     ú                      Right-pad each to the length of the longest with space => ["e  ","iii","o  ","p  ","rr ","s  ","t  "]
       £                    For each X in this array:
             XèS              Count the number of spaces in X
          XÎ                  Get the first character in X
            p   )             Repeat it (number of spaces) times
                              example the mapped value "e  " will become "ee"
         i                    Insert this into U at
                 UbXg           the first index of (first character in X) in U
        =                     Set U to the result

Try it online!

Hope you don't mind, I expanded part of the explanation (that one line that was explaining what about 10 chars did at once :P) The ú trick is genius, btw :-)

@ETHproductions I appreciate it. Im not too good at English so thanks

Unfortunately, it seems to fail when there's non-letters involved (they should not be changed). A simple fix would be to insert an ñ oC ó¥, though it requires adding back in the ;...

Wait ... since when did ñ work on strings?! @ETHproductions, please tell me that's a recent addition and I haven't been overlooking it all this time!

@Shaggy Apparently it was 2.5 months ago--but don't worry, even I'd forgotten it existed until this answer ;-)

Husk, 15 bytes
ḟ§Ë#f√MṘO´πL¹m_

Try it online!
Brute force, so very slow.
Explanation
ḟ§Ë#f√MṘO´πL¹m_  Implicit input, say s = "To do"
             m_  Convert to lowercase: t = "to do"
           L¹    Length of s: 5
         ´π      All length-5 combinations of [1..5]:
                   [[1,1,1,1,1], [1,1,1,1,2], [2,1,1,1,1], ..., [5,5,5,5,5]]
        O        Sort them lexicographically:
                   [[1,1,1,1,1], [1,1,1,1,2], [1,1,1,1,3], ..., [5,5,5,5,5]]
      MṘ         For each, replicate letters of t that many times:
                   ["to do", "to doo", "to dooo", ..., "tttttooooo     dddddooooo"]
ḟ                Find the first string that satisfies this:
                   Example argument: x = "tto ddo"
    f√             Letters of x: "ttoddo"
  Ë                They have equal
 § #               number of occurrences in x: true (all have 2).

could not get results at all

@asmgx The program is just really slow. It seems to time out on TIO for inputs of length 8 and longer, because it kills the computation after 1 minute. The offline interpreter should give a result if you wait long enough (probably several hours for length-10 inputs).

Ruby, 89 bytes
->s{1while(a=s.scan /\w/).map(&g=->x{s.scan(/#{x}/i).size}).uniq[1]&&s[a.min_by &g]*=2;s}

Try it online!
I tried different approaches, but what really saves a lot of bytes is adding one character at a time.
How:
->s{
    1while                             # 1 is a nop to the while
    (a=s.scan /\w/)                    # For all the letters in the string
    .map(&g=->x{s.scan(/#{x}/i).size}) # Count occurrences ignoring case.
    .uniq[1]                           # Break out of loop if all equals
    &&s[a.min_by &g]*=2                # Otherwise duplicate the letter
                                       #  with the lowest count
    ;s}                                # Return the string

Powershell 6, 123 bytes
It uses a char range 'a'..'z'. See script for previous Powershell below.
param($s)for(;'a'..'z'|%{
if($d=($s-replace"[^$_]").Length-$n){if($d-gt0){1}else{$s=$s-replace"^(.*$_)","`$1$_"}}}){$n++}$s

Explained test script:
$f = {

param($s)                               # a parameter string
for(;                                   # loop while exists at least one letter...
'a'..'z'|%{                             # for each letter
    $d=($s-replace"[^$_]").Length-$n    # let $d is a difference between a number of current letter and current $n
    if($d-gt0){                         # if the difference > 0
        1                               # then return a object to increase $n on next iteration
    }
    if($d-lt0){                         # if the differenct < 0
        $s=$s-replace"^(.*$_)","`$1$_"  # append the current letter after a last instance of the letter. Use "^(.*?$_)" regexp to append it after a first instance of the letter.
    }
}){
    $n++                                # increment $n if exists at least one letter number of witch greather then $n
}                                       # and make next iteration of the 'for'.

$s                                      # return modified string if all letters in the string occur the same number of times

}

@(
    ,('Priorities', 'Ppprrioooritttieeesss', 'PPPriooorritttieeesss')
    ,('invoice', 'innvvooiccee')
    ,('Remittance Advice', 'Rrremmmiitttaannncce Adddvvvice', 'RRRemmmitttannnce Aadddvvviicce')
) | % {
    $s,$e = $_
    $r = &$f $s
    "$($r-in$e): $r"
}

Output:
True: Pppriooorritttieeesss
True: innvvooiccee
True: Rrremmmitttannnce Aadddvvviicce

Powershell 5.1-, 133 bytes
param($s)for(;97..122|%{$_=[char]$_
if($d=($s-replace"[^$_]").Length-$n){if($d-gt0){1}else{$s=$s-replace"^(.*$_)","`$1$_"}}}){$n++}$s

Red, 252 bytes
func[s][a: charset[#"a"-#"z"#"A"-#"Z"]t: parse s[collect[any[keep a | skip]]]m: copy
#()foreach c t[c: form c either n: m/:c[m/:c: n + 1][m/:c: 1]]d: last sort extract next
to-block m 2 foreach c s[prin c: form c if n: m/:c[loop d - n[prin c]m/:c: d]]]

Try it online!
Ridiculously long solution...
Explanation:
f: func [ s ] [
    a: charset [ #"a" - #"z" #"A" - #"Z" ]   ; letters
    t: parse s [                             ; parse the string
        collect [ any [ keep a | skip ] ]    ; and keep only the letters
    ]
    m: copy #()                              ; initialize a map
    foreach c t [                            ; for each character in t
        c: form c                            ; the character as a string
        either n: select m c [ m/:c: n + 1 ] ; increase the count if already in map
                             [ m/:c: 1 ]     ; otherwise create a map entry with count 1
    ]
    d: last sort extract next to-block m 2   ; convert the map to a block; extract only the
                                             ; numbers and take the last of the sorted block
    foreach c s [                            ; for each character in the input
        c: form c                            ; the character as a string
        prin c                               ; print it (with no space nor newline)
        if n: select m c [                   ; if c is a key in the map
            loop d - n [ prin c ]            ; print the character again up to d times
            m/:c: d                          ; set the count to max (flag it as used)
        ]
    ]
]

Perl 6, 77 70 bytes
{s:i|$($!.min(*{*}).key)|$/$/|until [==] ($!=.lc.comb(/<:L>/).Bag){*}}

Try it online!
Taking G B's approach of inserting a character until all characters appear the same number of times. Receives a string that is modified in-place.
If underscores can be treated like letters, the regex can become /\w/, saving two bytes.
Explanation
{
                    .lc.comb(/<:L>/).Bag          # Create Bag of letter/count pairs
                ($!=                    )         # Store temporarily in $!
 ... until [==]                          .values  # Until all counts are equal
 s:i|                      |    |                 # Replace (ignoring case)
     $($!.min(*.value).key)                       # letter with minimum count
                            $/$/                  # with itself doubled
}

@JoKing It seems that your improvement is based on the old version before I discovered the {*} trick.

So that"s like a shortcut for .value(s) is it? Neat, I may have to update some of my old solutions

JavaScript (Node.js), 140 137 bytes
x=>[...x=x.toLowerCase()].map(F=c=>(F[c]=-~F[c],F[c]>w?w=F[c]:w,c),w=0).map(c=>x=x.replace(c,c.repeat(c>'`'&c<'{'?w-F[c]+1:1),F[c]=w))&&x

Try it online!
+33 bytes from my first solution for those never-ending additional constraints. JS sucks at case-insensitive string manipulations you know.
-3 bytes back Thanks @Arnauld.
Explanation
x =>                                     // The function.
  [...x = x.toLowerCase()].map(f = c => (// - Iterate among each character...
                                         // - Additional constraint 2
    f[c] = -~f[c],                       //   - Add one to the character counter
    f[c] > w ? w = f[c] : w,             //   - Update the maximum count if necessary
    c                                    //   - Return back the character for the use in
                                         //     the next map function
  ), w = 0)                              // - The counters
  .map(c =>                              // - Iterate again...
    x = x.replace(                       //   - Repeat the first appearance of
      c,                                 //   - Each character
      c.repeat(                          //   - Needed number times
        c > '`' & c < '{'                //   - Additional constraint 1
        ? w - f[c] + 1                   //   - If this is letter, repeat
        : 1                              //   - If not, stay as is
      ),                                 //   - That should've been clearly stated
      f[c] = w                           //   - And set the counter so that no further
                                         //     replacements are done on this character
    )                                    //   - (w - f[c] + 1 = 1 in further iterations)
  ) && x                                 // - Return the result

Solutions needs to be able to handle mixed-case inputs.

@Shaggy I think the challenge has been edited after your comment. It seems like the case of the output doesn't matter.

On the other hand, functions must be reusable, which is not the case here.

@Arnauld Oh I sometimes see you using fs as temporary storage so I thought that's okay

map() callback functions are safe to use for storage, because they're defined in a local scope. Using the main function -- which is globally defined -- is more hazardous. Here, you can use the callback of the first map(), which brings you back to 137 bytes.

@Arnauld Oh thanks that's what I see most of the time!

C (clang), 246 223 220 210 208 193 188 bytes
Compiler flag -DF=;for(i=0;b[i];i++ -DB=b[i] (29 bytes)
Added mixed case support.

f(char*c){char m,i,s,*b,a[255]={0};s=asprintf(&b,c)F)B=tolower(B),a[B]++F,a[B]>a[m]?m=B:0)F)a[B]^a[m]?b=realloc(b,s+i),bcopy(&B,b+i+1,s),a[B]++:(m=B);puts(b);}

Try it online!

Pyth, 31 30 bytes
JeSm/Qd=r0QVQ=tQ=+k*N-J/+kQN)k

Try it here
Explanation
JeSm/Qd=r0QVQ=tQ=+k*N-J/+kQN)k
       =r0Q                        Convert input to lowercase.
JeSm/Qd                            Find the count of the most common character.
           VQ               )      For each character in the input...
             =tQ                   ... remove that character from the input...
                =+k*N-J/+kQN       ... append copies to k until we have enough.
                             k     Output.

C (GCC) - 175 Bytes
f(char*s){int c[999]={0},i=0,m=0,k,L;while((L=s[i++])&&(k=++c[L<97?L+32:L]))m=k>m?k:m;i=0;while(L=s[i++])for(L=L<97&&L>64?L+32:L,putchar(L);isalpha(L)&&++c[L]<=m;)putchar(L);}

Ungolfed
f(char *s) {
  int c[999]={0},i=0,m=0,k,L;                      // Array used like a dictionary, temp vars
  while((L=s[i++])&&(k=++c[L<97?L+32:L]))          // store letter counts
    m=k>m?k:m;                                     // calculate max occurance
  i=0;                                             // reset string index
  while(L=s[i++])                                  // iterate string
    for(L=L<97&&L>64?L+32:L,putchar(L);isalpha(L)&&++c[L]<=m;) // set character L to lowercase if in alphabet, print always once, repeat if in alphabet
      putchar(L);                                  // print character
}

Try it online!

155 bytes

Python 2, 97 117 bytes
s=input().upper()
S=''
for c in s:S+=c+c*(max(map(s.count,map(chr,range(65,91))))-(S+s).count(c))*('@'<c<'[')
print S

Try it online!

@JoKing Fixed,.

Kotlin Android, 413 bytes
var l: List<Char> = w.toList().distinct();val h = HashMap<Char, Int>();var x='m';var n=0;for(z in l.indices){var c=0;for (i in 0.rangeTo(w.length-1)){if(l[z]==(w[i]))c++};h.put(l[z],c);if(n<c){n=c}};for(entry in h){h.replace(entry.key,n-entry.value)};var v=ArrayList<Char>();for(i  in 0.rangeTo(w.length-1)){if(h.containsKey(w[i])){for(p in 0.rangeTo(h.get(w[i])!!)){v.add(w[i])};h.remove(w[i])}else{v.add(w[i])}}

Try online
Explanation
step 1 --> Select list of distinct chars.
step 2 --> Get count of every char in string and select max char frequency.
step 3 --> get difference in frequency of chars with respect to max char frequency
step 4 --> place chars with respect to positions in string.
Happy Solving !

C# (Visual C# Interactive Compiler), 145 bytes
x=>x.ToLower().Select((a,b)=>x.IndexOf(a)==b&char.IsLetter(a)?a+new String(a,x.GroupBy(d=>x.Count(e=>e==d)).Max(d=>d.Key)-x.Count(d=>d==a)):a+"")

Try it online!

PHP, 185 173 170 bytes
function($s){$m=max($a=count_chars($s=strtolower($s),1));foreach(str_split($s)as$c)$o.=str_repeat($c,($b=$a[$d=ord($c)])!=($a[$d]=$m)&&$d>96&&$d<123?$m-$b+1:1);return$o;}

Try it online!
Ungolfed (and un-ternaried and un-optimized).
function f($s) {
    $s = strtolower( $s );
    $a = count_chars( $s, 1 );
    $m = max( $a );
    foreach( str_split( $s ) as $c ) {
        if ( $c < 'a' or $c > 'z') {           // is non a-z
            $n = 1;
        } elseif ( $a[ord($c)] == $m ) {    // already has max number
            $n = 1;
        } else {
            $n = $m - $a[ord($c)] + 1;       // add this many chars
        }
        $o .= str_repeat( $c, $n );
        $a[ord($c)] = $m;                   // has reached the max
    }
    return $o;
}

source: Stack Exchange

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

sort: votes


text:
Making a Mountain out of a Molehill
You are given a string of terrain, with molehills and mountains:
                        /\
                       /  \
              _/\__   /    \
          ___/     \_/      \_
____/\___/                    \___

Your job is to replace every molehill in the string with an equivalent mountain centered in the same column. The rest of the string must be unaffected. This may require additional lines at the beginning of the string.
A molehill consists of adjacent columns where the terrain goes up, immediately followed by adjacent columns where the terrain goes down. The shortest side must be exactly one column wide.
These are all molehills:
_____/\______

   /\________
__/

________/\
          \__

\           /
 \         /
  \       /
   \     /
    \/\_/

These are not molehills:
    /\
___/  \______

      ___
_____/   \___

____  _______
    \/

A mountain is like a molehill, but the shortest side is four lines high instead of one.
Examples
                  /\
                 /  \
           ->   /    \
____/\____    _/      \_

                       /\
                      /  \
                     /    \
           __ ->    /      \__
_     /\__/      __/
 \___/

                         /\
                        /  \
               ->      /    \
  /\                /\/      \
_/  \__/\_____    _/          \_

_                _    _                _
 \              /      \      /\      /
  \            /        \    /  \    /
   \          /          \  /    \  /
    \        /     ->     \/      \/
     \      /
      \    /
       \/\/

                             /\      /\
                            /  \    /  \
                           /    \  /    \
_                     -> _/      \/      \
 \                                        \
  \                                        \
   \/\______/\_______                       \_

                        /\                           /\       /\
                       /  \               /\        /  \     /  \
              _/\__   /    \       ->    /  \      /    \   /    \
          ___/     \_/      \_          /    \  __/      \_/      \_
____/\___/                    \___    _/      \/                    \___

Additional Rules

Standard loopholes are forbidden.
Input and output can be in any reasonable format.
You may assume the presence or absence of trailing whitespace in the input string.
There will always be enough space in the sides of the string as well as between molehills for any mountains you might need.
If replacing the molehills with mountains creates additional molehills, you do not need to turn those molehills into mountains.
The terrain cannot go both up and down in the same column. If this happens, the terrain does not move.
If a particular column does not become part of a mountain, its height must remain unchanged.

This is code-golf, so the shortest answer in bytes wins.

This is a nice challenge!

I think the second-last example should end with four \ and four _ and not seven \ and one _.

@ngm then the second molehill wouldn't be a mountain.

The challenge isn't quite well-defined then - we have to infer rules from the examples. You could turn the final molehill into a mountain with four or more \ and enough _ to end up with the same number of characters. The rule the rest of the string must be unaffected is not really defined.

Is your intention that the first and last characters must not change vertical position and also that as few characters as possible should be changed? This seems to be what the examples suggest, especially if the second last one is the only correct answer.

@ngm That's correct. Also, "the rest of the string must be unaffected" just means "don't change it where you don't need to".

It would be a good idea to edit the challenge specification to clarify these points.

Boy, that rule that ngm is inferring is pretty incomprehensible to me. Tempted to vote for 'Not clear what you are asking'.

In addition, the last rule "the terrain cannot go both up and down in the same column" - what does that mean? Surely "the terrain" is only one of three characters /, \, _, so how could it possibly go up and down at the same time?

@ChasBrown Surely "the terrain" is only one of three characters /, \, _, so how could it possibly go up and down at the same time? That's exactly what the rule means. It's supposed to clarify what happens when the terrain tries to do that, like in example 2.

Your new rule If a particular column does not become part of a mountain, its height must remain unchanged is not consistent with your 4th example. The trailing 4 characters vary in height in the output; but are all the same height in the input. Thus at least some of them have had their height changed. Also, still do not understand what the cannot go both up and down rule means. If you mean 'for any column not part of mountain-making, that column cannot be going down in the input and up in the output', well, that is happening in your third example.

And, to be clear, I like this challenge! Just trying to help you communicate what seems to be your requirements! Apologies if my comments are coming across otherwise.

@ChasBrown Which example? The last 4 characters don't move in the fourth example. As for the "cannot go both up and down" rule, that's not what it means. In the second example, the second column would have to turn into a / to preserve the height of the mountain, but it would have to stay as a \ to preserve the height of the terrain to the left. This is where that rule comes in; it means that this sort of conflict becomes a _.

Python 2, 509 495 480 bytes
def f(S):
 B='\\';F='/';s=''.join(map(max,*S.split('\n')));t=list(re.sub(r'..((./\\[^\\])|([^/]/\\.))..',r'////\\\\\\\\',s));C=s.count;D=t.count;d=C(F)-D(F)+D(B)-C(B);m=[{'_':F,B:'_'},{'_':B,F:'_'}][d<0];d=abs(d);i=1
 while d:
	if s[i]!=t[i]:i+=7
	elif t[i]in m:d-=1;t[i]=m[t[i]]
	i+=1
 return'\n'.join(u for u in map(''.join,zip(*[u.ljust(2*len(S))for u in reduce(lambda (a,p),c:(a+[' '*[p,p-1][c==B]+c],p+[[0,-1][c==B],1][c==F]),t,([],len(t)))[0]]))[::-1]if u.strip())
import re

Try it online!
Still not clear what the actual rules are; but here are the additional constraints that are enforced above and beyond the rule that molehills shall be turned into mountains:

The first and last terrain characters of the output must be _, just as they must be for valid inputs.
The vertical difference between the first _ and the last _ must be maintained between the input and output.
After substitutions from turning molehills into mountains, some other characters might need to be changed in order to maintain said vertical difference; but the characters changed must not be any of the characters that are part of mountains that were created from molehills.
And when accomplishing these changes, the number of additional characters changed must be minimal.

Ungolfed Algorithm:
def f(s):
    s = ''.join(map(max,*s.split('\n'))) # flatten into a single line
    t = re.sub(r'..((./\\[^\\])|([^/]/\\.))..',r'////\\\\\\\\',s) # replace molehills with mountains
    d = s.count('/')-t.count('/')+t.count('\\')-s.count('\\') # are the two strings equally balanced?
    m=[{'_':'/','\\':'_'},{'_':'\\','/':'_'}][d<0] # make an appropriate mapping...
    d=abs(d);i=1 # skip over leading '_'...
    while d: # while still unbalanced...
        if s[i]!=t[i]:i+=7 # skip over any created mountains (7+1==8)
        elif t[i] in m:d-=1;t = t[:i]+m[t[i]]+t[i+1:] # if can replace, do replace
        i += 1 # next char
    t = reduce(lambda (a,p),c:(a+[' '*[p,p-1][c=='\\']+c],p+[[0,-1][c=='\\'],1][c=='/']),t,([],len(t)))[0]  # pad spaces at left side
    t = map(''.join,zip(*[u.ljust(max(map(len,t))) for u in t])) # rotate
    return '\n'.join(u for u in t[::-1] if u.strip()) # reverse and join into lines.
import re

Red, 855, 845 833 bytes
func[s][r: split s"^/"c: charset"\_/"m: copy #()repeat n l: length? r[parse r/:n[any[i:
c(put m 1 + offset? r/:n i reduce[first i n])| skip]]]m: extract next sort/skip to-block m
2 2 e: copy[]parse b: rejoin collect[foreach c m[keep c/1]][any[c:["/\_"|"/\/"](alter
e 1 + offset? b c)| c:["_/\"|"\/\"](alter e 2 + offset? b c)| skip]]y: 0 foreach a e[q: p:
d: -3 + min m/(a - 4)/2 m/(a + 5)/2 if d < y[y: d]j: i: a until[m/:i/1: #"/"m/:i/2: p k: i
- 2 if all[k > 0 #"_"= m/:k/1 p = m/:k/2][m/(k + 1)/1: #"_"m/(k + 1)/2: p break]i: i - 1
m/:i/2 < p: p + 1]j: j + 1 until[m/:j/1: #"\"m/:j/2: q k: i + 2 if all[#"_"= m/:k/1
p = m/:k/2][m/(k - 1)/1: #"_"m/(k - 1)/2: p break]j: j + 1 m/:j/2 < q: q + 1]]y: y - 1 q:
collect[loop l - y[k: copy""keep pad k p: length? m]]repeat n p[w: m/1/2 - y
q/:w/:n: m/1/1 m: next m]foreach d q[print d]]

Try it online!
Far, far away from a golfy solution...
It passes the test cases but most probably would fail on some other, more strange pattern.
More readable:
f: func [ s ] [
    r: split s "^/"
    c: charset "\_/"
    m: copy #()
    repeat n l: length? r[
        parse r/:n[ any [ i: c(put m 1 + offset? r/:n i reduce[ first i n ])
        | skip]]
    ]
    m: sort/skip to-block m 2
    m: extract next m 2
    b: rejoin collect [ foreach c m [ keep c/1 ] ]
    e: copy []
    parse b [ any [ c: [ "/\_" | "/\/" ]
                (alter e 1 + offset? b c)
            | c: [ "_/\" | "\/\" ]
                (alter e 2 + offset? b c)
            | skip
        ]
    ]
    y: 0
    foreach a e [
        q: p: d: -3 + min m/(a - 4)/2 m/(a + 5)/2
        if d < y [ y: d ]
        j: i: a
        until [
            m/:i/1: #"/"
            m/:i/2: p
            k: i - 2
            if all [ k > 0
                     #"_" = m/:k/1
                     p = m/:k/2
            ] [
                m/(k + 1)/1: #"_"
                m/(k + 1)/2: p
                break
            ]
            i: i - 1
            p: p + 1
            m/:i/2 < p
        ]
        j: j + 1
        until[
            m/:j/1: #"\"
            m/:j/2: q
            k: i + 2
            if all [ #"_" = m/:k/1
                     p = m/:k/2
            ] [
                m/(k - 1)/1: #"_"
                m/(k - 1)/2: p
                break
            ]
            j: j + 1
            q: q + 1
            m/:j/2 < q
        ]
    ]
    y: y - 1
    q: collect [
        loop l - y [
            k: copy ""
            keep pad k p: length? m
        ]
    ]
    repeat n p [ w: m/1/2 - y
                 q/:w/:n: m/1/1
                 m: next m ]
    foreach d q [ print d ]
]

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


text:
Modified Boggle-able Code and Output: CnR Edition (Cops)

This is the Cops' thread. Robbers' thread is here.

Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) Also, same cell can't be used more than once in a word.
The following is an example board:
I L A W
B N G E
I U A O
A S R L

On this board, BINGO, ORANGE and WEARS are valid words, but SURGE and RUSSIA are not:

SURGE : There's no adjacent pair on the board having RG.
RUSSIA : S cannot be used twice.

Modified Boggle is a modified version of Boggle, with the following rules:

The board size is m-by-n, where m and n can be any positive integer.
Each cell can contain any one byte between 0 and 255 inclusive.
A cell can be used more than once, but not twice in a row.

Using the example board above, in addition to BINGO, ORANGE and WEARS, LANGUAGE becomes a valid string (since G is used twice, but not twice in a row) but RUSSIA is still not (due to SS pair).
Here is another example using a code fragment. The string from itertools import*\n can be found on the following board, but not from itertoosl import* or from itertools import *:
f   i   ' ' s
r   t   m   l
e   o   o   p
\n  *   t   r

Note that you need two o's in order to match the oo sequence.

Cop's challenge
Write a full program in your language of choice that satisfies the following rules:

The program should print something which is consistent over multiple runs.
The program should finish in roughly 5 seconds.
The program may not take any input.
Both the program and the output should be at least 2 bytes.
Anything related to hash functions, PRNGs, or cryptography is not allowed.

Then, lay out your program and output into two separate modified-boggle boards. Each board can be a non-square. Note that 1-by-N and 2-by-N boards can pose special challenges to both the cop and the robber. If you want some cells on a board unusable (to add more restriction), you can pick some useless bytes and fill the holes with them.
For example, if you want a 2x2 grid with horizontal/vertical movements only, you can do this instead:
a b
c d
-----------
X a X
c X b
X d X

In your submission, specify the language you used, the lengths of the source code and the output, and the two boggle boards. Note that shorter code and/or longer output is allowed for robbers, so you can choose to give some room for the byte counts (i.e. specify longer code and/or shorter output than your actual solution).
If your board contains some unprintable characters, you can specify the board as byte values instead.
After a week a cop is posted, it can be marked safe by the poster if it isn't cracked until then. The cop is still open for robbers until it's actually marked safe. A safe cop can't be cracked, and the poster should reveal the intended solution.
You'll want to obfuscate the boards as much as possible, as the robber's challenge is to crack your submission by finding the code and its output on the boards. If you want to cram a long code into a small board, answers to the original Modified Boggle challenge may give some insights.
Scoring for cops
Since it's hard to say whether a larger or smaller board is harder to crack, each safe cop submission counts as a score of 1. The user with the greatest score wins. It's encouraged to participate with different languages and creative approaches.
Cop example & formatting
# Japt, code 9 bytes, output 20 bytes

Code board: 2 rows, 2 columns

    `l
    íÏ

As byte values:

    96  108
    237 207

Output board: 3 rows, 3 columns

    175
    120
    643

Modified Boggle verification script
All of the scripts below have an example input with it.
Script for character string(code/output) & boggle. This does not support multi-line string. The input format is

a single line of string (either code or output), followed by
the raw boggle board.

Script for character string with byte-value boggle. Use this if the target string is printable but has one or more newlines in it. The input format is

the number of lines for the string,
raw string (possibly multi-line), then
the boggle board as byte values.

Script for byte-value string & boggle. Use this if the target string contains one or more unprintable characters. The input format is

a single line of string (either code or output) as byte values, followed by
the boggle board as byte values.

Just to make sure, both the output and input bytes can be reused, but can't be used twice in a row, right?

@maxb You're right, except that it's code, not input (the code cannot take input at all).

My mistake, I meant the code. Is there any limit on output length?

@maxb No limits, but note that your program should terminate in 5 seconds.

I've been trying to come up with a non-trivial output for brainfuck using only []+., but I think it might be impossible. Anyone care to try?

@JoKing That means using only one cell, then when exiting ] the memory is always zero. The only thing complicated is nested loops, and I don't think using it makes sense. The only thing "non-trivial" would be an arithmetic progression modulo 256.

There can be unused characters in your boggle boards, right?

@Quintec If you want some cells on a board unusable (to add more restriction), you can pick some useless bytes and fill the holes with them. so yes

JavaScript (Node.js), code 53 bytes, output 41 bytes, cracked by Arnauld
Code Board: 3 rows by 6 columns:
cog(n)
lsn1()
e.+<<;

Output Board: 4 rows by 6 columns:
481534
270906
602148
53829n

Hint: the code only works on V8 JS engines, version 6.7 or later
Mine was console.log(1n+1n+1n<<(1n+1n+1n+1n<<1n+1n+1n+1n+1n)); with the semicolon (don't ask why) and the output is yes, 3 * 2**128 with an trailing n marking the number as a BigInt literal.

If this doesn't start with console.log, I will be so impressed

Single number alone can't be printed as 41 digits. There should be a way to cast to a string, but... console is not available except at start, no assignment, no string literal, no brackets (thus no array literal nor indexing). I even checked Node globals and console's properties, but nothing fits there.

Cracked

JavaScript, 1443 bytes code, 3 bytes output, cracked in moments by @ShieruAsakoto
Code board, 3 rows by 4 columns
!![+
+[]]
+]()

Output board, 1 row by 2 columns
aN

Kinda obvious what the output is. It'll be the code that's fun to crack. Forgot to mention that it was intended to be a full program (and kinda implied that it wasn't; see paragraph below). For the real challenge, see my other answer.
I don't think this is Node.js, but my knowledge in this area is zero. What I can say is that it runs in my console in both Edge and Chrome.

What the JSF**k! lmao, and I bet the output is NaN

@ShieruAsakoto You had a valid crack. I'll revert this to its original state, and you can undelete your answer. I'll resubmit with clarification.

done reverting ;) https://codegolf.stackexchange.com/a/173396/71546

JavaScript (Node.js), code 88 bytes, output 2 bytes, cracked by Arnauld with a 27-byte
Code Board: 7 rows by 9 columns:
e.i--)=%5
lc;,2s*17
fosn8407%
gnr785138
s(;527067
=);s%1419
4n,i=1832

Output Board: 1 rows by 2 columns:
0n

The output is obvious, but the code is not. ;)
My original answer was an LL-test of M127, which was
for(s=4n,i=125;i;s%=170141183460469231731687303715884105727n,i--)s=s*s-2n;console.log(s)

Arnauld's answer utilized the semicolons to bridge a shorter crack, and I didn't expect (or realize) the s%=s part at all:
s=4n;s%=s;7n;console.log(s)

Oh by the way my 3 posts have absolutely nothing to do with hash functions, PRNGs or cryptography. I swear these three are only about number manipulations.
there are unused bytes in code board

Cracked

Python 3, code 56 bytes, output 69 bytes, SAFE
Code Board: 4 rows by 10 columns:
  print(1,
b; f,)*l(1
 =lamb+a,)
ese d:(-1)

Output Board: 7 rows by 7 columns:
1466900
3427430
1304212
9653895
0511633
5680228
4437679

Much difficult one than my first challenge ;)
Expected Code and Output:

Code:
l=lambda a,b:(a+b)*l(a-1,a*b)if a else b;print(l(11,11))

Output:
421827435070654423113161304555505960246647934329322186026783332352000

I love how you can’t form lambda xD

You can, reusing a letter is allowed, just not twice directly in a row. (I think I have the form of this one down, but it's very tweakable, and that output could be anything… I found a 56 byte program with 69 byte output, but it's not on the Boggle board.)

OK, I just realized output is allowed to be longer which changes things. But I still don't see a way to "trick" it (I bet there's some way to output 10^lots, though.)

I bet it should look like l=lambda a,b:+l(a-1,a*b)if a else b;print(l(11,1))... But I cannot find one.

JavaScript, 1443 bytes code, 3 bytes output, cracked by @Bubbler
A full program.
Code board, 3 rows by 4 columns
!![+
+[]]
+]()

Output board, 1 row by 2 columns
aN

Kinda obvious what the output is. It'll be the code that's fun to crack.
I don't think this is Node.js, but my knowledge in this area is zero. What I can say is that it runs in both Edge and Chrome. By "full program" I mean that it runs when placed between <script> and </script> in an HTML file.

Correctly cracked this time :)

Isn't this identical to your other JS post?

@Shaggy The first one was missing the full program mention, and was cracked as REPL instead.

MathGolf, code 42 bytes, output 22 bytes
Code Board: 3 rows by 7 columns
 r5 qÄ
~←▲↔▼→~
 Äq 5r

Output Board: 3 rows by 6 columns:
421
402
135

This is quite a bit longer, but I'll give a small hint: The code board is supposed to resemble a bowtie, and you might need to "tie" it multiple times.

MathGolf, code 7 bytes, output 12 bytes
Just a first easy challenge, if you want to get into MathGolf!
Code Board: 2 rows by 4 columns
╒Æ■r
îm4~

Output Board: 2 rows by 3 columns
140
412

Jelly, 17 byte code, 19 byte output
The general method shouldn't be too hard to pick out.
Code board
»V
”;
“;

Output board
Krgwn
Ubots
RAbbt

J (REPL), code 9 bytes, output 10000 bytes
Code board: 3 rows, 3 columns
epi
j.r
oI5

Output board: 3 rows, 2 columns, as byte values
10  10
48  49
32  255

In essence, \n\n / 01 / <space><don't use>.
Intended solution gives 20008-byte output.


text:
Modified Boggle-able Code and Output: CnR Edition (Robbers)

This is the Robbers' thread. Cops' thread is here.

Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) Also, same cell can't be used more than once in a word.
The following is an example board:
I L A W
B N G E
I U A O
A S R L

On this board, BINGO, ORANGE and WEARS are valid words, but SURGE and RUSSIA are not:

SURGE : There's no adjacent pair on the board having RG.
RUSSIA : S cannot be used twice.

Modified Boggle is a modified version of Boggle, with the following rules:

The board size is m-by-n, where m and n can be any positive integer.
Each cell can contain any one byte between 0 and 255 inclusive.
A cell can be used more than once, but not twice in a row.

Using the example board above, in addition to BINGO, ORANGE and WEARS, LANGUAGE becomes a valid string (since G is used twice, but not twice in a row) but RUSSIA is still not (due to SS pair).
Here is another example using a code fragment. The string from itertools import*\n can be found on the following board, but not from itertoosl import* or from itertools import *:
f   i   ' ' s
r   t   m   l
e   o   o   p
\n  *   t   r

Note that you need two o's in order to match the oo sequence.

Robber's challenge
Pick a cop's submission which isn't yet cracked or marked safe. In the given language, find a full program that fits in the code board which outputs some string that fits in the output board. The program's length should be equal or less than given, and the output's should be equal or greater.
Scoring for robbers
Each successful crack counts as a score of 1. The user with the greatest score wins.
Robber example & formatting
# Japt, code 8 bytes, output 21 bytes, [Bubbler](link-to-cops-post)

    `líÏ`íÏl

    [Try it online!](link-to-tio)

    The output is `112624120720504040320`.

Modified Boggle verification script
All of the scripts below have an example input with it.
Script for character string(code/output) & boggle. This does not support multi-line string. The input format is

a single line of string (either code or output), followed by
the raw boggle board.

Script for character string with byte-value boggle. Use this if the target string is printable but has one or more newlines in it. The input format is

the number of lines for the string,
raw string (possibly multi-line), then
the boggle board as byte values.

Script for byte-value string & boggle. Use this if the target string contains one or more unprintable characters. The input format is

a single line of string (either code or output) as byte values, followed by
the boggle board as byte values.

JavaScript, code 1342 bytes, output 3 bytes, Scrooble
[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]][[[]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][!+[]+!+[]+!+[]]+[!![]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][+!+[]+[+![]]]+[[]+[][[]]][+![]][+!+[]]+[[]+![]][+![]][!+[]+!+[]+!+[]]+[[]+!![]][+![]][+![]]+[[]+!![]][+![]][+!+[]]+[[]+!![]][+![]][!+[]+!+[]]+[[]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][!+[]+!+[]+!+[]]+[[]+!![]][+![]][+![]]+[!![]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][+!+[]+[+![]]]+[[]+!![]][+![]][+!+[]]]([[]+[![]]][+![]][+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+!![]][+![]][!+[]+!+[]+!+[]]+[[]+!![]][+![]][+!+[]]+[[]+!![]][+![]][+![]]+[[][[]]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][!+[]+!+[]+[!+[]+!+[]]]+[+[![]]]+[[+![]]+![]+[][[[]+![]][+![]][+![]]+[[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]+[[]+![]][+![]][!+[]+!+[]]]][+![]][!+[]+!+[]+[+![]]])()

Try it online! and Verify the code boggle online!
Outgolfing by 101 bytes :)
The point is that we can avoid most of the parens by using brackets instead (at the cost of a few bytes), and we just need two pairs of parens to do the function call.
For example, ([]+true)[1] is equivalent to [[]+true][0][1], and !+[]+!+[]+[]+(!+[]+!+[]) (the code to generate "22") is equal to !+[]+!+[]+[!+[]+!+[]].
Since alert is not available in Node, the TIO link shows the generated function instead.
How it works
False = ![]                         // false
f = [[]+![]][+![]][+![]]            // 'f'
a = [[]+![]][+![]][+!+[]]           // 'a'
l = [[]+![]][+![]][!+[]+!+[]]       // 'l'
s = [[]+![]][+![]][!+[]+!+[]+!+[]]  // 's'
True = !![]                         // true
t = [[]+!![]][+![]][+![]]           // 't'
r = [[]+!![]][+![]][+!+[]]          // 'r'
u = [[]+!![]][+![]][!+[]+!+[]]      // 'u'
e = [[]+!![]][+![]][!+[]+!+[]+!+[]] // 'e'
Undefined = [][[]]                  // undefined
n = [[]+[][[]]][+![]][+!+[]]        // 'n'
i = [[]+[][[]]][+![]][!+[]+!+[]+!+[]+!+[]+!+[]]  // 'i'
fill = [][f+i+l+l]                  // Array.prototype.fill
c = [[]+fill][+![]][!+[]+!+[]+!+[]] // 'c'
o = [!![]+fill][+![]][+!+[]+[+![]]] // 'o'
open = [[][[]]+fill][+![]][!+[]+!+[]+[!+[]+!+[]]]  // '('
close = [[+![]]+![]+fill][+![]][!+[]+!+[]+[+![]]]  // ')'
func = fill[c+o+n+s+t+r+u+c+t+o+r]  // Function
code = func(a+l+e+r+t+open+[+[![]]]+close)  // 'Function("alert("+NaN+")")'

Have some fun comparing this to the original JSFxxk conversion table.

Nice! I was really hoping the weird parentheses would keep it alive for a bit longer. Three improvements I can see right away in yours over mine are [][[]] instead of [][+[]] for undefined and ![]+!+[]+.. instead of +!+[]+!+[]+.. for the numbers, and coercing strings to integers, especially for c and o.

JavaScript (Node.js), 27 bytes, output = 2 bytes, Shieru Asakoto
s=4n;s%=s;7n;console.log(s)

Try it online!
or Verify the code boggle

Wow that's awesome. I thought I've blocked out most of routes to go.

Javascript (REPL), code 1443 bytes, output 3 bytes, https://codegolf.stackexchange.com/a/173395
+[+[![]]+[]+[]+[]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]+[[]]]

Outputs NaN. There are quite a lot of ways to pad once you know how NaN can represent in JSFuck.

@Scrooble lol That'll be some job to expand it to full program

JavaScript (Node.js), 53 bytes, output = 41 bytes, Shieru Asakoto
console.log(1n+1n+1n<<(1n<<1n+1n<<1n+1n<<1n<<1n<<1n))

Try it online! or Verify the code boggle or Verify the output boggle
This computes:
$$3\times2^{1\times4\times4\times2\times2\times2}=\\3\times2^{128}=\\1020847100762815390390123822295304634368$$
Which can also be done in 49 bytes:
console.log(1n+1n+1n<<(1n<<1n+1n+1n+1n+1n+1n+1n))

Try it online! or Verify the code boggle


text:
Supreme Sum String
Supreme Sum String
Given an input string, return the word with the highest sum of each of its unicode characters.
Rules

The input should be seperated by whitespace
The value of each word is based on the sum of each character in the word's UTF-16 code
The output should be the first word with the highest value (in case of duplicate sums)

Examples
Input: "a b c d e"
Output: "e"

Input: "hello world"
Output: "world"

Input: "this is a test"
Output: "test"

Input: "àà as a test"
Output: "àà"

Input "α ää"
Output: "α"

Input: " 隣隣隣"
Output: "隣隣隣"

Input: "      "
Output: ""

This is code golf, so the shortest answer wins! Good luck :)

Will there always be at least one space (at least 2 words)?

If there's only one word just output the single word, since it's the max

This would have been more interesting with ASCII instead of Unicode, because more languages could have participated. Requiring Unicode support doesn't seem to add anything to the challenge

I mostly used Unicode because it has emojis lol

Since many of the current answers seem to use the sum of UTF-8 or UTF-32 code units, you should add some additional test cases. For example "α ää" yields different results with UTF-8 (383 < 718) and UTF-16 (945 > 456).

" 隣隣隣" could be used to weed out answers that simply add codepoints (UTF-32). Also, do you really mean to sum UTF-16 code units (16-bit numbers) or something else?

I mean the number given by Javascript's charCodeAt function, which is a UTF-16 code according to the documentation. That's what I used when I was testing how feasible the challenge was. I'll add the other test cases though!

When you say separated by whitespace... is input separated by newline allowed?

Yeah, newlines area allowed. Tabs too!

Can we take input as an array/list of words?

It cannot be an array, it has to be a string of words with any whitespace characters in between

Husk, 5 bytes
←→kΣw

Try it online!
First time using key-by. Pretty fitting here.
Explanation
←→kΣw
      w split into words
    k   key on
     Σ  sum of codepoints
 →     take the last(maximum) key
←      return the first in the group

Usurping a 2 year old winner, great work! I know it's short, but would you mind providing a breakdown of what each character does?

Perl 6, 34 bytes
*.words.max(*.encode('utf16').sum)

Try it online!

05AB1E, 8 bytes
ð¡RΣÇO}θ

Try it online!
Explanation
ð¡          # split input on spaces
  R         # reverse the resulting list
   Σ  }     # sort by
    ÇO      # sum of character codes
       θ    # take the last

Wow, I'm always amazed by the answers made in dedicated golfing languages!

Why do you need to reverse the resulting list? It's gonna get sorted anyways right? Or does the R actually reverse the list after it's sorted?

@FireCubez For test case àà as a test the àà and test have the same largest unicode sum. So without the reverse test would be output instead of àà. Btw, Emigna, use # to save a byte. ;) EDIT: Never mind. I see it doesn't wrap the input in a list for single word inputs.. That's unfortunate.

R, 77 69 59 58 56 44 bytes
A group effort now.
'^'=mapply
sort(-sum^utf8ToInt^scan(,""))[1]

Try it online!
Convert to code points, sum each word, negate, (stably) sort, return first element.
Technically the return value is a "named vector" whose value is the sum and name is the winning word, but this seems to follow the rules. If you want to return the winning word as a string, you'd have to spend 7 more bytes and wrap the above in names().

Is there a reason there's spaces in front of the word? When I run it on"      " it prints out "      " (with a bunch of spaces in front of it)

@GammaGames the output is what is called a "named vector" in R. In this case the value is the sum of the code points of the winning word, and the name is printed along with it, which in this case is the winning word itself. The name is right-aligned to the number below it.

Oh, neat! It looks like it does follow the rules, so I'll allow it. Cool entry!

sort(-sapply(...)) is shorter by 3 bytes.

oh and you can apply scan() twice instead of el(strsplit()) to make this 69 bytes

Map for 64bytes, I am sure it can be improved further.tio

oh, and the double scan can be shortened to scan(,"",t=scan(,"")) for -1 byte. Try it online!

@JayCe mapply does the unlist for free.

Newline is white space (I think) so one scan should be sufficient. Checking with OP.

With some rebinding of ^ I've got your amazing answer down to 56 bytes

JavaScript (ES6), 81 bytes
s=>s.split` `.map(m=s=>m=[...s].map(c=>t+=c.charCodeAt(),t=0)&&t<=m?m:(r=s,t))&&r

Try it online!

That's way better than the code I came up with when I was writing the challenge, mine was ~200 chars long!

72 bytes

@guest271314 doesn't work for the second last test case and some extreme cases like f(" 龘龘龘龘龘")

@ShieruAsakoto Appears to return correct result here https://tio.run/##y0osSyxOLsosKNHNy09J/Z9mC0Qa8TrZtsW2dtF6enrFsXrF@UUlGhqJOkmatnaJNkmaQCper7ggJ7MkQSEBRTZbI1HTJlsDqCTaIPZ/cn5ecX5Oql5OfrpGmobSh/m9axTeL98IQUqamgoIoK@voJSqxIWmIyM1JydfoTy/KCcFWTlIMUQQXUNJRmaxAhAlKpSkFpfA9YA0gAXQ1R9ecHiBQiKGeogOkCSGjg/zJzUofJg/cTeQWLIQSCxrBxJTt7/f0a8A9uCH@X3NYINARoBklIBS/wE ? What is expected result for " 龘龘龘龘龘"?

Oh nvm 隣(\uf9f1) was the one in CJK Compatibility Ideograph block instead lol. Thought it was 隣(\u96a3), the one in CJK Unified Ideograph block.

Apparently 龘龘龘龘龘 would be the expected result I'd say.

@ShieruAsakoto The sum of "龘龘龘龘龘" is 204280 and the sum of "" is 55357, correct?

@guest271314 the sum of  should he 112191 because of utf-16 encoding

jq, 61 43 57 37 characters
(57 39 53 33 characters code + 4 characters command line options)
./" "|reverse|max_by(explode|add)

Sample run:
bash-4.4$ jq -Rr './" "|reverse|max_by(explode|add)' <<< 'àà as a test'
àà

Try it online!

PowerShell, 74 52 bytes
(-split$args|sort{$r=0;$_|% t*y|%{$r+=$_};$r}-u)[-1]

Try it online!
Thanks to mazzy for a whopping -22 bytes.
-splits the input $args on whitespace, pipes that into sort with a particular sorting mechanism {...} and the -unique flag.
Here we're taking the current word $_, changing it toCharArray, then for each letter we're adding it into our $result. That turns the string into a number based on its UTF-16 representation.
For once, PowerShell having all strings be UTF-16 in the background is a life-saver!
We then encapsulate those results in (...) to transform them into an array and take the last [-1] one, i.e., the largest result that's the closest to the start of the sentence. This works because of the -unique flag, i.e., if there's a later element that has the same value, it's discarded. That word is left on the pipeline and output is implicit.

it's smart. Thanks. 2 moments: why not sort -u instead a reverse? can be enough + to convert in the number? (-split$args|sort{($_|% t*y|%{+$_})-join"+"|iex} -u)[-1]

more golf: (-split$args|sort{$r=0;$_|% t*y|%{$r+=$_};$r}-u)[-1] :)

@mazzy Yes, thanks!

Pyth, 8 7 bytes
eosCMNc

Test suite
I know there's already a Pyth answer but I feel like this uses a pretty different approach and also it's waaaay shorter
Explanation:
eosCMNc  | Full code
eosCMNcQ | with implicit variables added
---------+------------------------------------
e        | The last element of
      cQ | the input chopped at whitespace
 o       | sorted by
  s      | the sum of
   CMN   | the Unicode value of each character

Wow, that's really precise! Thanks for the explanation!

Python 3, 55 52 bytes
lambda s:max(s.split(),key=lambda w:sum(map(ord,w)))

Try it online!

-3 bytes thanks to Gigaflop for pointing out that no argument is needed in the split method.

You can save 3 bytes by passing no args to split(), as it splits on any group of whitespace.

Jelly, 7 bytes
ḲOS$ÐṀḢ

Try it online!
ḲOS$ÐṀḢ
Ḳ        Split input on spaces
    ÐṀ   Give words that have maximum of:
   $       Monad:
 O           ord(each character)
  S          sum
      Ḣ  First word that gives the max ord-sum.

If the spec is relaxed to input being allowed as a list of words then O§MḢị

@JonathanAllan Where did OP say that was allowed?

didn't just if...

@JonathanAllan Ah, gotcha.

If you can take a list of words, each on their own line, that would be valid too. I don't know Jelly so I don't know if the 'whitespace' flexibility helps much

@GammaGames It would help if I could take a list of strings, e.g. ["abc", "def"]. But at this point there are a lot of answers so I don't recommend adding new methods of input

That's why I haven't added it, though I do see why it would have been nice

As of now, you have the lowest answer! Congrats!

Japt -h, 8 bytes
@Emigna approach
¸w ñ_¬xc

Try it online!

Another Approach
Japt -g, 8 bytes
¸ñ@-X¬xc

Try it online!

Identical to what I was about to post. The need for the reversal annoys me; would've preferred if we could output any of the words in the case of a tie.

@Shaggy if that was possible, I have a 6 bytes answer for it

Same 6-byter I started with before spotting that requirement in the spec.

I'm sorry! Originally when I sandboxed the challenge I figured it could output any of the answers, but I changed it after a little feedback so it was more consistent

MATLAB, 57 bytes
s=strsplit(input('','s'));[Y I]=max(cellfun(@sum,s));s(I)

In my MATLAB R2016a all tests arepassed, except that emojis are not rendered properly. But characters are returned correctly

Java (JDK), 117 97 84 bytes
-13 bytes thanks @Nevay. Apparently I didn't know I can also use var in Java.
s->{var b="";for(var a:s.split(" "))b=a.chars().sum()>b.chars().sum()?a:b;return b;}

Try it online!

-13 bytes: s->{var b="";for(var a:s.split(" "))b=a.chars().sum()>b.chars().sum()?a:b;return b;}

Ruby, 45 characters
->s{s.split.max_by{|w|w.codepoints.reduce:+}}

Sample run:
irb(main):001:0> ->s{s.split.max_by{|w|w.codepoints.reduce:+}}['àà as a test']
=> "àà"

Try it online!
Ruby 2.4, 40 characters
->s{s.split.max_by{|w|w.codepoints.sum}}

(Untested.)

26 bytes

I'm sorry @Jordan, but I think that is not what the challenge asks for. “The value of each word is based on the sum of each character in the word's UTF-16 code” (the challenge) vs. “The result is simply the sum of the binary value of each byte in str modulo 2**n - 1.” (String#sum doc). This test case explains better.

Ah, that makes sense.

Pyth, 33 bytes
FHmCdmcd)Kczd aYu+GHmCdH0)@KxYeSY

Try it online!
There is almost certainly a better way to do this, but I spent too much on it so this will do.
FH  #For every array of letters in
  mCd   #the array of arrays of letters [['w', 'o', 'r', 'l', 'd'], ['h', 'e', 'l', 'l', 'o']]
     mcd)   #wrap that in another array [[hello"], ["world"]]
         Kczd   #split input(z) on spaces ["hello", "world"] and assign it to K for later
              aY     #append to list Y... " " silences the prints from the for loop.
                u+GH    #reduce the list of numbers by summing them
                    mCdH    #convert each letter in the array to its int counterpart
                        0)    #the zero for the accumulator and close for loop
                          @K    #get by index the word from K
                            xY   #find the index in Y of that number
                              eSY   #sort Y, get the last (largest) number

I would have passed a reduce into another map instead of using the for loop, but I couldn't get that to work.

Oh boy, a pyth answer! Thanks for the explanation, nice entry!

Charcoal, 20 bytes
≔⪪Ｓ θ≔ＥθΣＥι℅λη§θ⌕η⌈η

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

Split the input string on spaces and assign to q.
≔ＥθΣＥι℅λη

Calculate the sum of the ordinals of the characters in each word and assign to h.
§θ⌕η⌈η

Find the index of the highest sum and print the word at that index.

Powershell, 66 bytes
Straightforward. See AdmBorkBork's answer to found a smart using of Powershell.
-split$args|%{$s=0
$_|% t*y|%{$s+=$_}
if($s-gt$x){$w=$_;$x=$s}}
$w

Note! To correct work with unicode, save your script file with UTF-16 or UTF8 with BOM encoding.
Test script:
$f = {

-split$args|%{$s=0         # split argument strings by whitespaces, for each word
$_|% t*y|%{$s+=$_}         # let $s is sum of unicode char code
if($s-gt$x){$w=$_;$x=$s}}  # if $s greater then previous one, store word and sum to variables
$w                         # return word from stored variable

}

@(
    ,("a b c d e", "e")

    ,("hello world", "world")

    ,("this is a test", "test")

    ,("àà as a test", "àà")

    ,("α ää", "α")

    ,(" 隣隣隣", "隣隣隣")

    ,("      ", "")
) | % {
    $s,$e=$_
    $r=&$f $s
    "$($r-eq$e): $r"
}

Output:
True: e
True: world
True: test
True: àà
True: α
True: 隣隣隣
True:


text:
Stagger, stack, sum
Inspired by this Stack Overflow question.
The challenge
Input
An array of square matrices containing non-negative integers.
Output
A square matrix built from the input matrices as follows.
Let \$N \times N\$ be the size of each input matrix, and \$P\$ the number of input matrices.
For clarity, consider the following example input matrices (\$N=2\$, \$P=3\$):
 3   5
 4  10

 6   8
12  11

 2   0
 9   1

Start with the first input matrix.
Shift the second input matrix N−1 steps down and N−1 steps right, so that its upper-left entry coincides with the lower-right entry of the previous one.
Imagine the second, shifted matrix as if it were stacked on top of the first. Sum the two values at the coincident entry. Write the other values, and fill the remaining entries with 0 to get a \$(2N-1)\times(2N-1)\$ matrix. With the example input, the result so far is
 3   5   0
 4  16   8
 0  12  11

For each remaining input matrix, stagger it so that its upper-left coincides with the lower-right of the accumulated result matrix so far. In the example, including the third input matrix gives
 3   5   0   0
 4  16   8   0
 0  12  13   0
 0   0   9   1

The ouput is the \$((N−1)P+1)\times((N−1)P+1)\$ matrix obtained after including the last input matrix.

Additional rules and clarifications

\$N\$ and \$P\$ are positive integers.
You can optionally take \$N\$ and \$P\$ as additional inputs.
Input and output can be taken by any reasonable means. Their format is flexible as usual.
Programs or functions are allowed, in any programming language. Standard loopholes are forbidden.
Shortest code in bytes wins.

Test cases:
In each case, input matrices are shown first, then the output.

\$N=2\$, \$P=3\$:
 3   5
 4  10

 6   8
12  11

 2   0
 9   1

 3   5   0   0
 4  16   8   0
 0  12  13   0
 0   0   9   1

\$N=2\$, \$P=1\$:
 3   5
 4  10

 3   5
 4  10

\$N=1\$, \$P=4\$:
 4

 7

23

 5

39

\$N=3\$, \$P=2\$:
11  11   8
 6   8  12
11   0   4

 4   1  13
 9  19  11
13   4   2

11  11   8   0   0
 6   8  12   0   0
11   0   8   1  13
 0   0   9  19  11
 0   0  13   4   2

\$N=2\$, \$P=4\$:
14  13
10   0

13  20
21   3

 9  22
 0   8

17   3
19  16

14  13   0   0   0
10  13  20   0   0
 0  21  12  22   0
 0   0   0  25   3
 0   0   0  19  16

How long is your MATL solution for this?

@Giuseppe I haven’t tried it in MATL. For the test cases  I used the MATLAB code from my answer in the linked  question

Jelly, 15 12 bytes
⁹ṖŻ€ƒZƲ⁺+µ@/

Try it online!
How it works
⁹ṖŻ€ƒZƲ⁺+µ@/  Main link. Argument: A (array of matrices)

         µ    Begin a monadic chain.
          @/  Reduce A by the previous chain, with swapped arguments.
                Dyadic chain. Arguments: M, N (matrices)
      Ʋ           Combine the links to the left into a monadic chain with arg. M.
⁹                 Set the return value to N.
 Ṗ                Pop; remove its last row.
     Z            Zip; yield M transposed.
    ƒ             Fold popped N, using the link to the left as folding function and
                  transposed M as initial value.
  Ż€                Prepend a zero to each row of the left argument.
                    The right argument is ignored.
       ⁺        Duplicate the chain created by Ʋ.
        +       Add M to the result.

R, 88 81 bytes
function(A,N,P,o=0*diag(P*(N-1)+1)){for(i in 1:P)o[x,x]=o[x<-1:N+i-1,x]+A[[i]];o}

Try it online!
Takes a list of matrices, A, N, and P.
Builds the requisite matrix of zeros o and adds elementwise the contents of A to the appropriate submatrices in o.

JavaScript (ES6), 102 bytes
Takes input as (n,p,a).
(n,p,a)=>[...Array(--n*p+1)].map((_,y,r)=>r.map((_,x)=>a.map((a,i)=>s+=(a[y-i*n]||0)[x-i*n]|0,s=0)|s))

Try it online!
How?
Redimensioning matrices filled with a default constant (\$0\$ in that case) is neither very easy nor very short in JS, so we just build a square matrix with the correct width \$w\$ right away:
$$w=(n-1)\times p+1$$
For each cell at \$(x,y)\$, we compute:
$$s_{x,y}=\sum_{i=0}^{p-1}{a_i(x-i\times (n-1),y-i\times (n-1))}$$
where undefined cells are replaced with zeros.

Python 2, 124 bytes
def f(m,N,P):w=~-N*P+1;a=[w*[0]for _ in' '*w];g=0;exec"x=g/N/N*~-N;a[x+g/N%N][x+g%N]+=m[x][g/N%N][g%N];g+=1;"*P*N*N;return a

Try it online!

Jelly, 12 bytes
Z€Ż€’}¡"Jµ⁺S

Try it online!
Z€Ż€’}¡"Jµ⁺S
         µ    Everything before this as a monad.
          ⁺   Do it twice
Z€            Zip €ach of the matrices
        J     1..P
       "      Pair the matrices with their corresponding integer in [1..P] then apply the
              following dyad:
  Ż€            Prepend 0 to each of the rows
      ¡         Repeat this:
    ’}          (right argument - 1) number of times
              Doing everything before µ twice adds the appropriate number of rows and
              columns to each matrix. Finally:
           S  Sum the matrices.

12 bytes
J’0ẋ;Ɱ"Z€µ⁺S

If extra zeroes were allowed ZŻ€‘ɼ¡)⁺S is a cool 9 byte solution. TIO.

Jelly, 20 bytes
µ;€0Zð⁺0ṁ+ṚU$}ṚU+⁸µ/

Try it online!
Bah, Jelly has an attitude today...

Pip, 37 bytes
{i:0{Y#i-1aM:0RLyAL_i+:yZG#@aALa}Mai}

A function that takes a list of lists of lists. Try it online!

Python 2, 124 bytes
def f(A,N,P):M=N-1;R=G(M*P+1);return[[sum(A[k][i-k*M][j-k*M]for k in G(P)if j<N+k*M>i>=k*M<=j)for j in R]for i in R]
G=range

Try it online!

Charcoal, 52 bytes
≦⊖θＥ⊕×θηＥ⊕×θηΣＥＥη×θξ∧¬∨∨‹ιν›ι⁺θν∨‹λν›λ⁺θν§§§ζξ⁻ιν⁻λν

Try it online! Link is to verbose version of code and includes two bytes for somewhat usable formatting. I started off with a version that padded all the arrays and then summed them but I was able to golf this version to be shorter instead. Explanation:
≦⊖θ

Decrement the input value \$N\$.
Ｅ⊕×θηＥ⊕×θη

Compute the size of the result \$(N-1)P+1\$ and map over the implicit range twice thus producing a result matrix which is implcitly printed.
ΣＥＥη×θξ

Map over the implicit range over the input value \$P\$ and multiply each element by \$N-1\$. Then, map over the resulting range and sum the final result.
∧¬∨∨‹ιν›ι⁺θν∨‹λν›λ⁺θν

Check that neither of the indices are out of range.
§§§ζξ⁻ιν⁻λν

Offset into the original input to fetch the desired value.