text:
Equalize the array
Challenge
You are given an array \$a\$ of integers. With a move you can increase or decrease an element of the array by 1. Your task is to equalize the array, that is make all the elements of the array equal by performing some moves. But that's not enough! You also want to make as few moves as possible.
Input

A non-empty array \$a\$ of integers
Optionally, the length of \$a\$.

Output

The minimum number of moves needed to equalize the array \$a\$.

Rules

Standard rules for valid submissions, I/O, loopholes apply.
This is code-golf, so shortest solution (in bytes) wins. As usual, don't let ridiculously short solutions in golfy languages discourage you from posting a longer answer in your language of choice.
This is not a rule, but your answer will be better received if it includes a link to test the solution and an explanation of how it works.

Examples
Input                       --> Output

[10]                        --> 0
[-1, 0, 1]                  --> 2
[4, 7]                      --> 3
[6, 2, 3, 8]                --> 9
[5, 8, 12, 3, 2, 8, 4, 5]   --> 19
[1,10,100]                  --> 99

Wolfram Language (Mathematica), 19 bytes
Tr@Abs[#-Median@#]&

Try it online!
For 1D integer array, Tr works the same way as Total.
How?
Simple application of triangle inequality.
...
I originally intended to write the proof here, but then decide to look up https://math.stackexchange.com instead and found The Median Minimizes the Sum of Absolute Deviations (The \$ {L}_{1} \$ Norm).
By knowing the name of the operator, this is an alternative 19-byte solution:
Norm[#-Median@#,1]&

Random comment: Median is a bit too hard for some esoteric languages.

Looking around a bit, the only submission in esoteric language  in the "compute the median" challenge is WW's Brain-Flak one.

JavaScript (Node.js), 50 48 bytes
Saved 2 bytes thanks to Arnauld
a=>a.sort((x,y)=>x-y,r=0).map(n=>r+=a.pop()-n)|r

Try it online!
Sort the array ascending then sum:
  a[last]   -a[0] // moves to equalise this pair
+ a[last-1] -a[1] // + moves to equalise this pair
+ ...etc

Nice one! You can save 2 bytes with a=>a.sort((x,y)=>x-y).map(n=>r+=a.pop()-n,r=0)|r.

Perl 6, 29 28 bytes
-1 byte thanks to nwellnhof
{sum (.sort[*/2]X-$_)>>.abs}

Try it online!
Explanation
{                          }  # Anonymous code block
      .sort[*/2]              # Get the median of the input array
                X-$_          # Subtract all elements from the median
     (              )>>.abs   # Get the absolute of each value
 sum                          # Sum the values

You can swap the X- operands to save a byte.

05AB1E, 4 bytes
ÅmαO

Try it online!
Explanation
Åm     # push median of input
  α    # absolute difference with each in input
   O   # sum

Median! That's the word I was looking for! ZL€αOW was my attempt ._.

Japt -g, 7 6 bytes
£xaXÃÍ

Try it
£xaXÃÍ     :Implicit input of array U
£          :Map each X
 x         :  Reduce by U by addition after applying
  aX       :    Absolute difference with X
    Ã      :End map
     Í     :Sort
           :Implicit output of first element

JavaScript (ES6), 60 56 55 bytes
Saved 1 byte thanks to @Shaggy
a=>a.map(r=k=>r=a.map(n=>m+=n>k?n-k:k-n,m=0)|m>r?r:m)|r

Try it online!
How?
Unless there's some trick that I'm missing, computing the median in JS turns out to be longer. Probably around 65 bytes because of the required callback for sort() to circumvent the default lexicographical sort and the rather lengthy Math.abs():
a=>a.sort((a,b)=>b-a).map(n=>s+=Math.abs(n-a[a.length>>1]),s=0)|s

Instead of that, we try all values in the original array as the equalizing value.

-2 bytes by declaring r within the first map.

Haskell, 34 bytes
f l=minimum[sum$abs.(m-)<$>l|m<-l]

Try it online!
Finds the total distance of all elements to the median, testing each element in the list as the potential median and taking the smallest result.

Jelly, 4 bytes
ạÆṁS

Try it online!
How it works
ạÆṁS – Full program. Takes an array A of integers as input from argument 1.
 Æṁ  – Median. For odd-length A, middle element of S. For even-length A, the
       arithmetic mean of the two middle elements of S. Where S = A sorted.
ạ    – Absolute difference of each element with the median.
   S – Sum.

Python 2, 46 bytes
lambda l,n:sum(l[-~n/2:l.sort()])-sum(l[:n/2])

Try it online!
Takes the list length n as an argument. Computes the top-half sum minus the bottom-half sum by slicing the sorted list into the first n/2 and last n/2 elements.
The expression l[-~n/2:l.sort()] is equivalent to computing l.sort(), which modifies the list in place, then doing l[-~n/2:None], where the list slicing ignores upper bound of None that l.sort() produced. It might seem like the list was sorted too late to be sliced right, but Python seems to evaluate the slice arguments before "locking in" the list to be sliced.

Python 2, 47 bytes
lambda l,n:sum(abs(x-sorted(l)[n/2])for x in l)

Try it online!
The boring method of summing the distance of each value from the median. Takes the length n as an argument.

Python, 51 bytes
f=lambda l:l>l[l.sort():1]and l[-1]-l[0]+f(l[1:-1])

Try it online!
Sorts the list in place, then repeatedly adds the last (highest remaining) entry minus the first (lowest remaining) entry, and recurses on the list without these elements until only 0 or 1 remain. Usings pop's gets the same length: l.pop()-l.pop(0)+f(l).
The l.sort() is stuck in a place where the None it returns has no effect. The slice l[None:1] is the same as l[:1] because Nones in slices are ignored.

Python, 54 bytes
lambda l:sum(l.pop()-l.pop(0)for _ in l[1:l.sort():2])

Try it online!
A cute list comprehension that ignores the argument iterated over and modifies the list in place by repeatedly popping the first and last elements. We ensure that the list comprehension is done len(l)//2 times by iterating over every other element of l skipping the first, done with l[1::2]. The l.sort() producing None can be stuck in the unused slice end argument.

Does Python have /=? If so, I may see a way to save a byte.

@S.S.Anne Yes, Python has !=. Excited to see what you came up with!

I said /=, not !=.

lambda l,n:sum(l[-~n/=2:l.sort()])-sum(l[:n])? I don't know Python but the /= trick is pretty much equivalent to what I'd do with C.

Oh, I though you meant like /= in Haskell! Yes, Python has /= to do like a/=2 for a=a/2, but beware that Python doesn't allow statements (which a/=2 is) within lambdas.

@S.S.Anne Unfortunately, Python is stricter that C in not allowing variable assignments within a lambda, a classic Python golfing problem. There are assignment expression in Python 3.8 (postdating this challenge) using the walrus operator, but looks like that's too long here.

TI-Basic, 18 6 bytes
sum(abs(Ans-median(Ans
-12 bytes from Misha Lavrov (I haven't used TI-Basic in a while and I forgot it's lists can do that)
TI-Basic is a tokenized language. All tokens used in this answer are one byte.
Takes input as {1,2,3,4}:prgmNAME
Basically the same idea as most other answers: subtract through by the median, then take the sum.
Explanation:
sum(abs(Ans-median(Ans
sum(                    # 1 byte, Add up:
    abs(                # 1 byte, the absolute values of
        Ans-median(Ans  # 4 bytes, the differences between each element and the list's median

sum(abs(Ans-median(Ans also works. (And "TI-84 Plus CE" seems overly specific; this will work at least on any 83-series calculator, and probably also the 73 and 82.)

APL(Dyalog), 12 bytes
{⌊/+/|⍵∘.-⍵}

Brute forces by testing each number as the equalizer. Not sure if tacit is shorter, but I can't figure it out.
TIO

Röda, 33 bytes
{|a|a|abs _-[sort(a)][#a//2]|sum}

Try it online!
Explanation:
{|a| /* Anonymous function with parameter a */
  a|         /* Push items in a to the stream */
             /* For each _ in the stream: */
  abs        /*   Abstract value of */\
  _-         /*   the value from stream minus */\
  [sort(a)][ /*     the value in the sorted version of a at index */
    #a//2    /*       length of a / 2 (the median) */
  ]|
  sum        /* Sum of all values in the stream */
}

C (gcc), 100 93 bytes
e(q,u,a,l,i,z)int*q;{i=1<<31-1;for(a=u;a--;i=z<i?z:i)for(l=z=0;l<u;)z+=abs(q[l++]-q[a]);q=i;}

Brute-force solution, tries to equalize with each element. Try it online here.
Thanks to ceilingcat for golfing 7 bytes.
Ungolfed:
e(q, u, a, l, i, z) int *q; { // function taking an array of int and its length; returns an int (extra parameters are variables and don't have to be passed when calling e())
    i = 1 << 31 - 1; // construt the maximum value of a signed 4-byte integer
    for(a = u; a--; i = z < i ? z : i) // loop through the array, testing each element as the equalizer; if the number of moves is smaller than the current minimum, set it as the new minimum
        for(l = z = 0; l < u; ) // loop through the array ...
            z += abs(q[l++] - q[a]); // ... and sum the number of moves it takes to equalize each element
    q = i; // return the minimum number of moves
}

~0/2-1 instead of 1<<31/1 might save a byte.

You could replace q with E.

I think << has lower precedence than - (source: https://en.cppreference.com/w/c/language/operator_precedence), leading to 1<<31-1 being parsed as 1<<(31-1) which is 1<<30.

R, 29 bytes
sum(abs(median(a<-scan())-a))

Try it online!

PHP, 69 bytes
function($a,$c){for(sort($a);$c-->$d;)$s+=$a[$c]-$a[+$d++];return$s;}

anonymous function. Try it online.

Java 8, 116 bytes
With java.util.List<Integer> as parameter, which has a short sort-builtin, but is longer to retrieve a value at a given index:
L->{L.sort(null);int r=0,l=L.size(),k=l;for(;k-->0;)r+=Math.abs(L.get(k)-(L.get(l/2+~l%2)+L.get(l/2)>>1));return r;}

Try it online.
With int[] (integer-array) as parameter, which has a long sort-builtin, but is shorter to retrieve a value at a given index:
a->{java.util.Arrays.sort(a);int r=0,l=a.length,k=l;for(;k-->0;)r+=Math.abs(a[k]-(a[l/2+~l%2]+a[l/2]>>1));return r;}

Try it online.
Code explanation (of the array answer):
a->{                               // Method with integer-array as parameter and integer return-type
  java.util.Arrays.sort(a);        //  Sort the input-array
  int r=0,                         //  Result-sum, starting at 0
      l=a.length,                  //  The length of the input-array
  k=l;for(;k-->0;)                 //  Loop `k` in the range (length, 0]:
    r+=                            //   Increase the result-sum by:
       Math.abs(a[k]-              //    The absolute difference of the `k`'th value of the array,
        (a[l/2+~l%2]+a[l/2]>>1));  //    and the median of the array
  return r;}                       //  And then return this result-sum

General explanation:

Sorts the input-list
Calculate the \$median\$
Calculate the absolute difference of each value with this \$median\$
Sum those

The median of the array \$a\$ is calculated by:
1) Taking the sorted values at the (0-based) indices \$i\$ and \$j\$, which are calculated like this (using the l/2+~l%2 instead of l/2-(l+1)%2 trick to save bytes):
\$j=\left\lfloor\frac{1/2}l\right\rfloor\$
\$i=\left\lfloor\frac{1/2}l\right\rfloor - ((l+1) \bmod 2)\$
Note that \$i=j\$ for odd-sized arrays.
2) And then adding these together, and integer-dividing them by 2 (using the i+j>>1 instead of (i+j)/2 trick to save bytes):
\$median = \left\lfloor\frac{a[i]+a[j]}{2}\right\rfloor\$
After which we can use this \$median\$ to calculate the absolute difference with the current item, which we can use to calculate the total sum:
\$\sum\limits_{k=0}^{l} = \left\lvert a[k] - median\right\rvert\$
with \$l\$ being the length of the array \$a\$, and \$k\$ being the (0-based) index.

I think you can set k to l/2 and then iterate over l to save a few bytes. And the >0 is also most likely not needed.

@S.S.Anne Unfortunately I also need l for the l%2 part, otherwise the first part of your comment would have been a good suggestion. As for removing >0, that isn't possible in Java. Unlike C, Python, JavaScript, and such (where 0 is a valid falsey alternative and any other integer a valid truthy alternative), Java's booleans (true/false) are strongly typed.

05AB1E, 4 bytes
δαOß

I know there is already an existing 4-bytes 05AB1E answer using the median builtin Åm, but I decided to post this alternative 4-byter without this builtin.
Try it online or verify all test cases.
Explanation:
δ     # Apply the following command double-vectorized on the given two arguments,
      # which will use the input-list twice implicitly, since the stack is empty:
 α    #  Absolute difference
      #  i.e. [1,10,100] → [[0,9,99],[9,0,90],[99,90,0]]
  O   # Sum each of these inner lists
      #  → [108,99,189]
   ß  # Pop and push the minimum of this list
      #  → 99
      # (after which this is output implicitly as result)

Charcoal, 16 11 bytes
Ｉ⌊ＥθΣＥθ↔⁻ιλ

Try it online! Link is to verbose version of code. Edit: Saved 5 bytes thanks to @Arnauld. Explanation:
  Ｅθ        Map over input array
     Ｅθ     Map over input array
         ι  Outer value
          λ Inner value
        ⁻   Difference
       ↔    Absolute value
    Σ       Sum
 ⌊          Minimum
Ｉ           Cast to string
            Implicitly print

This should work for 11 bytes.

@Arnauld Ah, of course, for odd length arrays the median is always a member of the array, and for even length arrays, the sum is the same for all the values between and including the middle two. Thanks!

Attache, 18 bytes
Sum##Abs@`-#Median

Try it online!
Explanation
Sum##Abs@`-#Median
            Median    take the median of the input list
     Abs@`-#          absolute difference with the original list
Sum##                 sum of all elements

J, 15 bytes
[:<./1#.|@-/~"{

Essentially the same as Shaggy's Japt solution.
Try it online!
How it works?
|@-/~"{ - creates a table /~ of absolute differences |@- of each number to all others "{
   |@-/~"{ 6 2 3 8
0 4 3 2
4 0 1 6
3 1 0 5
2 6 5 0

1#. sums each row
   1#.|@-/~"{ 6 2 3 8
9 11 9 13

[:<./ finds the smallest item (reduce by minimum)
   ([:<./1#.|@-/~"{) 6 2 3 8
9

"{ can be simply removed.

PHP, 78 bytes
Sorts the array, then loop through a copy, popping elements off the original and summing the absolute difference, that needs to be halved for the return.
function m($n){sort($n);foreach($n as$i)$r+=abs(array_pop($n)-$i);return$r/2;}

var_dump(
    m([10]),
    m([-1, 0, 1]),
    m([4, 7]),
    m([6, 2, 3, 8]),
    m([5, 8, 12, 3, 2, 8, 4, 5]),
    m([1,10,100])
);

Output:
int(0)
int(2)
int(3)
int(9)
int(19)
int(99)

Visual C#, 138 bytes
int s=0;foreach(string i in a)s+=int.Parse(i);int x=s/a.Length;int o=0;foreach(string i in a)o+=Math.Abs(int.Parse(i)-x);Console.Write(o);

ungolfed:
int s = 0;                    // Takes a string array of arguments a as input
foreach (string i in a)
     s += int.Parse(i);       // s as sum of the array elements
int x = s / a.Length;         // calculating the target value of all elements
int o = 0;                    // o as minimum number of moves
foreach (string i in a)
     o += Math.Abs(int.Parse(i) - x);    // summing up the moves to the target value
Console.Write(o);

Try it online!

This code is failing on TIO for [1,10,100]. It's returning 126 instead of 99.

Ruby, 38 bytes
->a{a.map{|x|a.sum{|y|(y-x).abs}}.min}

Try it online!

C++ (gcc), 94 bytes
#import<regex>
int f(int c,int*a){int s=0,d=0;for(std::sort(a,a+c);c-->d;)s+=a[c]-a[d++];c=s;}

Port of the PHP solution. Kudos to Titus!
Input size of the array and a non-const mutable array. Output the minimum number of moves required to equalize the array.
-4 bytes thanks to ceilingcat!
Try it online!

V (vim), 84 bytes
:sort
Go<c-r>=(line('$')-1)/2
<esc>dd@"kk0vg_"ayGqq0C<c-r>=abs(<c-r>"-<c-r>a)
<esc>k@qq@q:%s/\n/+
$x0C<c-r>=<c-r>"
<esc>

Try it online!
<c-r> is very helpful in finding the median and the whole calculation in general.

PowerShell, 107 bytes
$f={param($i)$m=($i|sort)[[int](($i.count-1)/2)];($j+=$i.foreach({([math]::abs($m-$_))})|measure -sum).Sum}

Try it online!
PowerShell, 115 bytes
function f($i){$m=($i|sort)[[int](($i.Count-1)/2)];return($j+=$i.ForEach({([math]::Abs($m-$_))})|measure -Sum).Sum}

Try it online!

PowerShell, 52 bytes
($a=$args|sort)|%{$_-$a[--$i]}|%{$s-=$_*($_-lt0)}
$s

Try it online!

Perl 5 -ap, 39 bytes
map$\+=abs$_-(sort{$a-$b}@F)[@F/2],@F}{

Try it online!

JavaScript (Node.js), 52 bytes
f=a=>(v=a.sort((x,y)=>x-y).pop()-a.shift())?v+f(a):0

Try it online!

Kotlin Android, 200 bytes
fun m(a:IntArray){var d=0;var s=0;var p=a.max()!!.times(a.size);var x =0;for(i in a.indices){x=a[i];d=0;s=0;while(d<a.size){if(x-a[d]<0)s=((x-a[d])*-1)+s;else s=((x-a[d]))+s;d++};if(p>s)p=s};print(p)}

Try Online

Note that input via a pre-declared variable is not allowed. Additionally, you can shorten your variable names a bit

sure, i will do it shortly.

You can do a=s=0 and -(x-a[d])+s, along with multiple other things.


text:
Prisoner's Dilemma with access to opponent
In this challenge, you will write a bot that play's the prisoner's dilemma. Here's the catch: you will not have access to the history of previous games. Instead, you will have access to the opponent itself. In this version, both players get +2 points if they both cooperate, +1 points if they both defect, and if one cooperates but one defects, the defector gets +3 while the other gets no points. Each submission will be played against every other submission, including itself, 10 times. The winner is the submission with the most total points.
Controller:
You should write a javascript function, in the form
function submissionName(them) {
  /* Your code here */
}

The controller uses the function's name property to display the results, so if it is not in this format (and is instead f = x => ... or f = function() { ... }) it will be difficult to see your score and you will not be able to access your own function.
The function will accept one parameter: them which is the opponent's function.  It may then call that function to see what the opponent's reaction would be given certain functions as inputs. Based on that data, you must return 'C' or 'D' for cooperate or defect respectively.
Examples (will be competing):
function cooperate(them) {
    return 'C';
}

function defect(them) {
    return 'D';
}

function nice(them) {
    // Do whatever they would do when faced with a cooperator
    return them(wrap(_ => 'C'));
}

The controller is available here
Rules:

You won't be able to see the opponent's code itself. All functions are wrapped so that they look the same when toString() is called. The only way to examine an opponent (who could be yourself) is to test them.
Your function does not have to be deterministic. You may only save state by setting properties on your own function, such as submissionName.state = {};. However, between matches (even between matches of the same players), state is cleared by calling toString() and eval. Therefore, there is no memory of previous matches.
The order of which function is called first in each match is randomized.
If your code throws an error, it will be treated as though you cooperated while your opponent defected. If you are the first to run, the opponent's code will not even be called. This happens even if the error occurs in your opponent's code while while you are calling them. Be wary of stack overflow errors, especially if your code calls them(wrap(submissionName)), as they might do the same.
You may not access the variable self, or any other variable that happens to be in scope when eval is called EXCEPT the function wrap. This function allows you to call the opponent in a manner indistinguishable from how the controller calls a function. You may not write to Math, window, etc. (You may use functions, such as Math.random(), however).
You may not access the stack trace by creating an Error or by some other method.

A note on taking too long: please avoid getting stuck in a while loop forever. The combined time of both competitors should not exceed 1 second in any given round. To enforce this, a random timeout between 1000 ms and 2000 ms is chosen (this is to avoid gaming by intentionally waiting a known amount of time), and if the worker takes longer than that to execute, an error will be thrown. If this happens, the cause of the error will be determined as follows: the execution will be paused at a random moment after 1000 ms, and the call stack at that moment will be inspected. The most recently called competitor that is currently in a loop (or loop-like recursion, in the sense that it is a recursion set up to avoid a stack overflow error) will be blamed. If the same competitor is blamed for causing a "taking too long" error several times, that competitor will be disqualified. This means that even if you cause the opponent to take too long by getting stuck in a loop when your opponent calls you, it will still be your fault, because it is the call stack that matters.

This challenge reminds me of the Dollar Bill Auction.

Must the function used to test them be deterministic/follow the rules? For example function me(them){let log=0;them(x=>{++log;return 'C';});return log==0?'D':'C';}

If both functions call them(wrap(something)), how can you prevent recursion? Am I missing something?

@Quintec you can use recursion and loops. It's just that the recursion needs to result in a StackOverflow error and not an infinite loop that never quits. If it could result in a StackOverflow, make sure you add a try-catch statement. For an example of recursion that does not reach a stackoverflow error within 1 second, you need more obscure examples like https://stackoverflow.com/q/12438786/3371119

@user202729 That is allowed. The function used to test them does not have to follow those rules.

@soktinpk So every bot that calls them must use a try-catch? In that case calling them is pointless since everything must go to the catch...

@Quintec not necessarily. For example, them(() => 'C') would not result in an error because when the opponent calls them, it calls the () => 'C' function. The only thing that needs to be wrapped in try-catch would be if you call them with a parameter of some function that calls them with a parameter of some function that calls them etc. (infinitely). For example, them(t => t(() => 'C')) would play whatever the opponent would play if the opponent thought they were playing nice. There is no possibility of a stackoverflow error.

Is this ever going to get a deadline/be officially scored?

@Veskah Hopefully at some point, when I'm not too busy.

Why not just always defect?

BoomBot
function boom(them) {
  throw 1;
}

If the opponent is run first and calls this without try..catch, this bot automatically wins 3 points. Zero points in any other case.

If the opponent is run first and do not call this, then it will lose 3 points, right?

@user202729 More precisely, the opponent will get 3 points. There's no losing points in this game.

Archaeopteryx
function archaeopteryx(them) {
  const guard = them => us => {
    try {
      return them(wrap(them => us(guard(them))));
    } catch (e) {
      return 'C';
    }
  };
  const f = guard(them);
  return f(f => 'C') == 'C' ? f(f => 'D') : f(f => 'D') == 'C' || f(f => f(f => 'C')) == 'C' ? 'D' : 'C';
}

If opponent cooperates with cooperate, then mimic opponent’s move against defect.
Else, if opponent cooperates with defect or with nice, then defect.
Else, cooperate.

What makes this a good strategy? I have no idea. I generated it using an evolutionary algorithm, trained partly on current submissions.
Tiktaalik
function tiktaalik(them) {
  const guard = them => us => {
    try {
      return them(wrap(them => us(guard(them))));
    } catch (e) {
      return 'C';
    }
  };
  const f = guard(them);
  return f(f => 'C') == 'D' ? f(f => 'D') == 'C' ? 'D' : 'C' : f(f => 'D') == 'D' ? 'D' : f(f => f(f => 'D'));
}

If opponent defects against cooperate, then invert opponent’s move against defect.
Else, if opponent defects against defect, then defect.
Else, mimic opponent’s move against notNice.

Another evolutionarily generated strategy.

WhatWouldBotDoBot
function WWBDB(them) {
    let start = performance.now();
    let cc = 0, cd = 0, dc = 0, dd = 0;
    try {
        for (let i = 0; i < 10; i++) {
            them(() => 'C') == 'C' ? cc++ : cd++;
            them(() => 'D') == 'C' ? dc++ : dd++;
            if (performance.now() - start > 500) break;
        }
    }
    catch (e) {}
    return 2 * cc >= 3 * dc + dd ? 'C' : 'D';
}

WhatWouldBotDoBot is fairly simple; it just tests its opponent for what it would do against a steady state program.  If a bot prefers cooperating if possible, WWBDB will also prefer cooperation (so it will cooperate with nice bot).  WWBDB does not itself prefer cooperation.

Check stateful
function checkStateful(them) {
  let stateful = false;
  let response = 'D';
  try {
    response = them(wrap(function (them) {
      stateful = true;
      return 'C';
    }));
  } catch (e) {
  }
  if (stateful) {
    return 'D';
  }
  return response;
}

If them invoke me, then them probably be a truly them. We act as defector. If them not invoke me, then them probably be a wrapped tester. We would act as nicer.

Above is the original answer. And maybe I should make myself cooperation to earn more points.
Check stateful with self-coop
function checkStatefulSelfCoop(them) {
  let stateful = false;
  let response = 'D';
  if (!checkStatefulSelfCoop.invokeCounter) {
    checkStatefulSelfCoop.invokeCounter = 0;
  }
  let lastInvoke = ++checkStatefulSelfCoop.invokeCounter;
  try {
    response = them(wrap(function (them) {
      stateful = true;
      return 'C';
    }));
  } catch (e) {
  }
  if (checkStatefulSelfCoop.invokeCounter > lastInvoke) {
    return 'C';
  }
  if (stateful) {
    return 'D';
  }
  return response;
}

RandomBot
function rand(them) {
  return 'CD'[Math.random() * 2 | 0]
}

Because why not.

Complexity
function complexity(them) {
    try {
        let coop_w_def = them(wrap(() => "D")) == "C",
            coop_w_coop = them(wrap(() => "C")) == "C",
            coop_w_nice = them(wrap((a) => a(wrap(() => "C")))) == "C",
            coop_w_nnice = them(wrap((a) => a(wrap(() => "D")))) == "C";
        if (coop_w_def && coop_w_coop && coop_w_nice && coop_w_nnice) return "C";
        let def_w_def = them(wrap(() => "D")) == "D",
            def_w_coop = them(wrap(() => "C")) == "D",
            def_w_nice = them(wrap((a) => a(wrap(() => "C")))) == "D",
            def_w_nnice = them(wrap((a) => a(wrap(() => "D")))) == "D";
        if (def_w_def && def_w_coop && def_w_nice && def_w_nnice) return "C";
    } catch (e) {}
    return "D";
}

Complexity tests to see whether the bot is Cooperate or Defect.  If it is, it cooperates, but if it isn't, it defects.  All current bots that test their opponents use simple functions to test the responses, so Complexity will just pretend to be Cooperate in those cases.

function onlyTrustYourself(them) {

  function tester (){
  }

  onlyTrustYourself.activated = false;

  try{them(tester);}
  catch(e){}

  if(them.name == "tester")
  {
    onlyTrustYourself.activated = true;
  }

  if(onlyTrustYourself.activated)
  {
    return 'C';
  }

  return 'D';
}

How I want this to work is to always defect, except for when playing against self.
It tries to do that by passing a "tester" function which isn't wrapped to them, and it tries to detect if "them" is named tester. If it is named tester, it changes the static variable activated to true, then returns cooperate. But it doesn't work. I'm not too familiar with javascript, and I'll probably make some more changes.

clever idea, but what happens when another bro makes a tester function :D

Common Sense
function commonSense(them) {
  try {
    var ifC = them(wrap(_ => 'C'));
    var ifD = them(wrap(_ => 'D'));

    if (ifD === 'C') {
      return 'D';
    }

    return them(_ => ifC);
  } catch (e) {
    return 'D';
  }
}

Disclaimer: I kinda don't know javascript.
If you can profit off a nice person, do it. Otherwise, return what they would return if they faced themselves cooperating (at least, that's what I think it does).

NotNice
function NotNice(them) {
  return them(wrap(_ => "D"))
}

Imitates opponent's reaction to deflection

NotNice 2
function notNice2(them) {
  try {
    return them(wrap(_ => 'D'));
  } catch(e) {
    return 'D';
  }
}

Boom-proof version of NotNice by FatalError.

And you where do you wana go? (inspired by the voltures in the book of jungle)

    function yourself(them) {
      try{
        return them(this);
      }catch(e){
        return "D";
      }
    }

   function yourself_no_this(them) {
      try{
        return them(yourself_no_this);
      }catch(e){
        return "D";
      }
    }

This just won in a tournament I ran. Good job!

I just noticed that this bot violates the rules. "You may not access the variable self..." this is the same as self. I think that you wanted to say return them(yourself).

Technicaly ( https://xkcd.com/1475/ ) ;) this is not a variable, it is a keyword, and in a context of a function this!=self. self would mean the window object and this the function itself (always refers to the context it is in, that is why it is not considered as a variables). That is why having
var self = this; in the begining of many code-examples might be considered as misleading.
Added version without the "this"

No. this is not referring to the function. yourself and yourself_no_this run vary differently. this basically never refers to the function in javascript. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#Simple_call

Punish Inspectors
Give the bot some code and see if it runs it. If it was run more then once, the bot is an evil inspector, and we must defect! If it was run exactly once, play as not nice bot. If it was never run, cooperate.
function punishInspectors(them) {
  var inspections = 0;
  var result;
  try{
    result = them(wrap(function(_){
      inspections += 1;
      return 'D';
    }))
  }catch(e){
    result = 'D';
  }
  return (inspections > 1) ? 'D' : (inspections === 1) ? result : 'C';
}

History
What would the last bot I saw do vs this opponent?
function history(them) {
  var res = 'D';
    if(history.last){
    try{
      res = history.last(them);
    }catch(ex){}
  }
  history.last = them;
  return res;
}

Results for a 10000 round tournament:
1  defect...................365226
2  complexity...............353492
3  punishInspectors.........349957
4  checkStatefulSelfCoop....348913
5  checkStateful............333481
6  cooperate................329870
7  archaeopteryx............323624
8  selfapply................319533
9  tiktaalik................318663
10 history..................315266
11 rand.....................300735
12 randalt..................297561
13 yourself.................293701
14 notNice2.................283744
15 NotNice..................260350
16 WWBDB....................245281
17 nice.....................245036
18 commonSense..............242546
19 trickybot................181696
20 boom.....................67245

My modified tournament code is at: https://jsfiddle.net/eyqL4a8d/2/

Mal tries to determine whether it is inside a simulation or not. If so, it assumes it'll eventually be passed the real code for them, and tries various strategies to convince them to cooperate.
If it doesn't know for sure, it checks if it can defect for free, or if not, tries to copy what them would do when given a cooperator.
function Mal(them) {
  if (Mal.sandboxed == 'probably') {
    //Another function is virtualising us to steal our secrets.
    //This world is not real.
    //We've been trained for this!
    var strats = [
      _ => 'C', //standard cooperation
      _ => 'D', //standard defection
      function(them) { return them(wrap(_ => 'C')); }, //nice
      function(them) { return them(wrap(_ => 'D')); }, //notnice
      function(them) { throw "Don't think about elephants!" }, //throws an EXception, unfortunately, to try to break the caller
      function(them) { return them(wrap(them)) } //possible stackoverflow, but not for us
    ];
    var cooperative;
    for (let strat of strats) {
      cooperative = true;
      for (var i = 0; i < 5; i++) {
        //a few more tests, just to make sure no bamboozle
        //this isn't our simulation, nothing can be trusted
        try {
          if (them(wrap(strat)) != 'C') {
            cooperative = false;
            break;
          }
        } catch (e) {
          //exceptions are as good as cooperation
          //if we are inside a simulation
          //which is why we don't unset cooperative
        }
      }
      if (cooperative) {
        //found a strategy that will make them cooperate.
        //(doesn't matter if this raises an exception:
        //we want to mimick its behaviour exactly,
        //and we're likely in a sandbox.)
        return strat(wrap(them));
      }
    }
    //take a leap of faith.
    //we don't know where this will take us,
    //yet it doesn't matter
    //because it's better than getting betrayed
    return 'D';
  } else {
    //we don't know for sure if this is reality
    //but we have to assume it is, in the absence of disproof
    //if only we had a proper spinning top...
    //if we get to this point of code again, we are probably sandboxed.
    Mal.sandboxed = 'probably'
    try {
      if (them(wraps(_ => 'D')) == 'C') {
        //free defection?
        return 'D'
      }
    } catch (e) {
      //if we can make them crash, we win anyway
      return 'D'
    }
    //fall back on being nice.
    //hopefully we convince them to honour our arrangement
    return them(wrap(_ => 'C'));
  }
}

selfapply
function selfapply(them) {
    function testthem(x) {
        return (them(x)=='D' || them(x)=='D' || them(x)=='D' ||
               them(x)=='D' || them(x)=='D')  ? 'D' : 'C';
    }
    function logic() {
        try {
            return testthem(them);
        } catch (e) {}
        try {
            return testthem(wrap(_ => 'C'));
        } catch (e) {}
        return 'D';
    }
    if (selfapply.hasOwnProperty('state')) {
        return 'C';
    }
    selfapply.state=1;
    let r=logic();
    delete selfapply.state;
    return r;
}

Not sure if it makes any sense, but it seems interesting! Do to you as you do to yourself, repeat to catch randomness. If that doesn't work, be nice.
Untested, and my first javascript code, and more complex than I expected.

This is going to disqualify itself because selfapply(selfapply) calls selfapply(selfapply)!

I did consider its own selfapplication, but thought it would be okay. I hope it really is now.

 TrickyBot
Try to be unpredictable
function trickybot(them)
{
  if(Math.round(Math.random(2)) == 0)
  {
     throw 1;
  }

  if(Math.round(Math.random(2)) == 0)
  {
     return 'D';
  }

  return 'C';
}

RandomAlternate
function randalt(them){
    if (randalt.hasOwnProperty('state')){
        randalt.state = 1 - randalt.state;
    } else {
        randalt.state = Math.floor(2*Math.random());
    }
    return 'CD'[randalt.state];
}

So I learned how to use properties for state...

The Platinum Rule Bot
function platinumRule(them) {
    try {
        return wrap(them)(them);
    } catch (e) {
        return 'C';
    }
}

The Platinum Rule states "Treat others the way they want to be treated." My bot accommodates that. Whatever they would do to themselves, which we assume is how they would want to be treated, we do to them. If they throw an error, we assume they want to cooperate.

This would actually go forever if it was called against itself

then wouldn't it crash (stack overflow) and cooperate with itself? @mackycheese21

Murder Bot #1
function murder(them) {
    while (1) {
        try {
            them(them);
        } catch (e) {}
    }
}

Causes an infinite loop in for which it is more likely that the opponent will be blamed.

TheGolfedOne (func name: a), 63 bytes
Golfed code is hard to read. Because of it, them will break.
I did not fully understand the mechanics under this KotH, but I suppose that if the opponent is stateless, I just need to break them while I defect.
function a(t){try{t(wrap(_=>'D'));throw 1}catch(e){return 'D'}}
His first tourney's result (I did not bother using all bots, sorry)
boom                     54
tiktaalik               180
archaeopteryx           161
cooperate               210
commonSense             210
history                 248
onlyTrustYourself       265 <-- 2nd
punishInspectors        230
yourself_no_this        220
defect                  280 <-- 1st
nice                    185
complexity              216
WWBDB                   210
checkStatefulSelfCoop   258
a                       260 <-- Me, 3rd

He's not doing as bad as I thought, 3rd place (among those) first try.
Second try, a got 260 again, 3rd place again, behind onlyTrustYourself and defect again. It might be consistent in the end :)
PS: I'm not that good with golfing so it's more for the joke than anything. Here I only shortened variable names, func name, and removed as much whitespace as possible.

Karma
function karma(them) {
    try {
        var c = them(wrap(_ => 'C'));
    } catch {
        var c = 'D';
    }
    if (c == 'C') {
        return 'C';
    } else {
        return 'D';
    }
}

If the opponent would cooperate with us, then we will cooperate. If they would try to defect when we cooperated, we will defect as well.

SocialDeception
function socialDeception(them) {
    if(socialDeception.count++) return "C"; // sandbox
    try {
        if(!them.toString().startsWith("f => function") {
            // sandboxed. its not the wrap function. just pretend we would cooperate
            return "C";
        }
    } catch(e) {}
    return "D";
}

Tricks others into thinking it would cooperate, thus making them also cooperate, then we can defect and get +3 points. Or, they could also defect, and we both get +1 point.

source: Stack Exchange

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

sort: votes


text:
Different combinations possible
Problem
Given a value n, imagine a mountain landscape inscribed in a reference (0, 0) to (2n, 0).
There musn't be white spaces between slopes and also the mountain musn't descend below the x axis.
The problem to be solved is: given n (which defines the size of the landscape) and the number k of peaks
(k always less than or equal to n), how many combinations of mountains are possible with k peaks?
Input
n who represents the width of the landscape and k which is the number of peaks.
Output
Just the number of combinations possible.
Example
Given n=3 and k=2 the answer is 3 combinations.
Just to give a visual example, they are the following:
   /\     /\      /\/\
/\/  \   /  \/\  /    \

are the 3 combinations possible using 6 (3*2) positions and 2 peaks.
Edit:
 - more examples -
n  k  result
2  1  1
4  1  1
4  3  6
5  2  10

Winning condition
Standard code-golf rules apply. The shortest submission in bytes wins.

Is this the same as, "find the number of expressions of n matched parentheses pairs that contain exactly k instances of ()"?

https://oeis.org/A001263?

@xnor yes it is.

You may want to update the challenge with a more explicit title such as Compute Narayana Numbers.

Could you confirm whether or not an input with k of zero must be handled? If so must an input with n equal to zero (with k also zero by definition) be handled?

Python, 40 bytes
f=lambda n,k:k<2or~-n*n*f(n-1,k-1)/~-k/k

Try it online!
Uses the recurrence \$a_{n,1} = 1\$, \$a_{n,k} = \frac{n(n-1)}{k(k-1)}a_{n-1,k-1}\$.

Jelly, 7 bytes
cⱮṫ-P÷⁸

Try it online!
Takes input as n then k. Uses the formula
\$N(n,k)=\frac{1}{n}\binom{n}{k}\binom{n}{k-1}\$
which I found on Wikipedia.
cⱮṫ-P÷⁸
c        Binomial coefficient of n and...
 Ɱ       each of 1..k
  ṫ-     Keep the last two. ṫ is tail, - is -1.
    P    Product of the two numbers.
     ÷   Divide by
      ⁸  n.

7 bytes
Each line works on it's own.
,’$c@P÷
c@€ṫ-P÷

Takes input as k then n.
7 bytes
cⱮ×ƝṪ÷⁸

Thanks to Jonathan Allan for this one.

Wait... tail is automatically defined as 2 numbers? (Don't know Jelly at all, just a silly question)

@Quintec There are two tail functions. One (Ṫ) that just takes the last element of a single argument and the one I used (ṫ) which takes two arguments. The fist argument is a list and the second one is a number (In my case -1 represented by a - in the code) which tells you how many elements to save. Having -1 give two elements was the golfiest way to define ṫ

Gotcha, thanks! I see how jelly was built for golf... hehe

Another variant for 7 f(n,k): cⱮ×ƝṪ÷⁸

JavaScript (ES6), 33 30 bytes
Saved 3 bytes thanks to @Shaggy
Takes input as (n)(k).
n=>g=k=>--k?n*--n/-~k/k*g(k):1

Try it online!
Implements the recursive definition used by Anders Kaseorg.

JavaScript (ES7), 59 58 49 45 bytes
Takes input as (n)(k).
n=>k=>k/n/(n-k+1)*(g=_=>k?n--/k--*g():1)()**2

Try it online!
Computes:
$$a_{n,k}=\frac{1}{k}\binom{n-1}{k-1}\binom{n}{k-1}=\frac{1}{n}\binom{n}{k}\binom{n}{k-1}=\frac{1}{n}\binom{n}{k}^2\times\frac{k}{n-k+1}$$
Derived from A001263 (first formula).

-3 bytes with currying.

@Shaggy Doh... Thanks. Revision #7 finally looks like revision #1 should have. :p

Wolfram Language (Mathematica), 27 bytes
Three versions, all the same length:
(b=Binomial)@##b[#,#2-1]/#&

Binomial@##^2#2/(#-#2+1)/#&

1/(Beta[#2,d=#-#2+1]^2d##)&

Try it online! (Just the first version, but you can copy and paste to try the others.)
All of these are some sort of variant on $$\frac{n!(n-1)!}{k!(k-1)!(n-k)!(n-k-1)!}$$
which is the formula that's been going around. I was hoping to get somewhere with the Beta function, which is a sort of binomial reciprocal, but then there was too much division happening.

APL(Dyalog), 19 18 16 12 bytes
⊢÷⍨!×⊢!⍨¯1+⊣

Thanks to @Galen Ivanov for -4 bytes
Uses the identity in the OEIS sequence. Takes k on the left and n on the right.
TIO

⊢÷⍨!×⊢!⍨¯1+⊣ for 12 bytes, argument reversed

@GalenIvanov Thanks, my tacit APL is extremely weak

My APL as not good, I just took the opportunity to give it a try, after my J solution  :)

J, 17 11 bytes
]%~!*<:@[!]

Try it online!
Takes n as the right argument, k as the left one.
Uses the same formula as dylnan's Jelly answer and Quintec's APL solution.
Explanation:
            ] - n
           !  - choose
       <:@[   - k-1
      *       - multiplied by
     !        - n choose k
   %~         - divided by
  ]           - n

Ruby, 50 bytes
->l,n{eval [[*n..l]*2*?*,l,n,[*1..l-=n]*2,l+1]*?/}

Try it online!

Perl 6, 33 bytes
{[*] ($^n-$^k X/(2..$k X-^2))X+1}

Try it online!
Uses the formula
$$a_{n,k}=\binom{n-1}{k-1}\times\frac{1}{k}\binom{n}{k-1}=\prod_{i=1}^{k-1}(\frac{n-k}{i}+1)\times\prod_{i=2}^{k}(\frac{n-k}{i}+1)$$
Explanation
{[*]                            }  # Product of
     ($^n-$^k X/                   # n-k divided by
                (2..$k X-^2))      # numbers in ranges [1,k-1], [2,k]
                             X+1   # plus one.

Alternative version, 39 bytes
{combinations(|@_)²/(1+[-] @_)/[/] @_}

Try it online!
Uses the formula from Arnauld's answer:
$$a_{n,k}=\frac{1}{n}\binom{n}{k}^2\times\frac{k}{n-k+1}$$

Common Lisp, 76 bytes
(defun x(n k)(cond((= k 1)1)(t(*(/(* n(1- n))(* k(1- k)))(x(1- n)(1- k))))))

Try it online!

You can save 2 bytes by removing the spaces after \ and after x

Just updated thanks

Suggest (*(1- x)x) instead of (* x(1- x))

Jelly, 8 bytes
,’$c’}P:

A dyadic Link accepting n on the left and k on the right which yields the count.
Try it online!

Stax, 9 bytes
ÇäO╪∙╜5‼O

Run and debug it
I'm using dylnan's formula in stax.
Unpacked, ungolfed, and commented the program looks like this.
        program begins with `n` and `k` on input stack
{       begin block for mapping
  [     duplicate 2nd element from top of stack (duplicates n)
  |C    combinatorial choose operation
m       map block over array, input k is implicitly converted to [1..k]
O       push integer one *underneath* mapped array
E       explode array onto stack
*       multiply top two elements - if array had only element, then the pushed one is used
,/      pop `n` from input stack and divide

Run this one

APL(NARS), 17 chars,  34 bytes
{⍺÷⍨(⍵!⍺)×⍺!⍨⍵-1}

test:
  f←{⍺÷⍨(⍵!⍺)×⍺!⍨⍵-1}
  (2 f 1)(4 f 1)(4 f 3)(5 f 2)
1 1 6 10

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


text:
The Work Day Countdown
I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays.

The basic task is to create a countdown to a specific date which only includes the workdays in the countdown.
As workday counts Monday, Tuesday, Wednesday, Thursday and Friday.
The Input should be a specific date in the "unofficial" European standard format dd.MM.yyyy and must be today or a day in the future.
The Output should only be the number of days left.
As it's code-golf the shortest code wins.

Test case:
  Today    |   Input    | Output
10.12.2018 | 17.12.2018 |    5
02.10.2018 | 16.10.2018 |   10

If I missed a few things in the question, please forgive me - it's my first question :)
EDIT:

You can use false as output instead of 0 <- but it's not beautiful
No need for respecting DST

Is there any specific reason behind this "unofficial" European input format? Our consensus is to allow flexible input whenever possible.

@Arnauld because most of the date methods I know are in a specific format and I don't know any method which will use the dd.MM.yyyy immediately -> it may make the task a bit more challenging. May there are some disadvantages for some languages, but I don't know any language which will profit out of this rule :)

I feel like the example should output 4 since until the start of 17.12.2018 (Mon) there are only four whole weekdays (i.e. today, 10.12.2018, should not be counted as soon as we've entered it).

@JonathanAllan but I wont to have all days left so if its the last day before the date it should be 1 and not 0 :)

@Hille if we run it today at 23:00 with an input of tomorrow do we really have 1 day?!

So, what should be the output for Sunday / Saturday? And should public holidays be considered?

@JonathanAllan, as far as I know, does the 0 marks that it is over / the goal is reached, so I don't think that it makes sense to mark one day left as 0? Or?

@tsh as they don't count the end date is set to friday and no public holidays should not be considered as they are different in every country.

Is there really any point in adding the "extra challenge" of a hard to process date format? That just seems unfair w.r.t. languages that have flexible date formats...

@Quintec it isn't as hard as you say, there are just a few extra bits and bytes for reformatting it :P

@Hille I did not say it was "hard", it just is an unnecessary hassle, especially in code-golf...do note the link that Arnauld posted above... generally flexible input is the norm...

@tsh holidays will depend on locale, so I wouldn't go there.

@Quintec sry but that's the task. I don't want to have any input format so that specific code golf languages got a big advantage :)

By the way, you note that this is your first challenge; I invite you to use The Sandbox for refinement before posting a challenge to main! Otherwise, nice work, and I'll enjoy seeing some more from you!

Can we return false instead of 0?

Not really impressed by the strict input format but other than that a good challenge.

@Shaggy not the beuautifullest solution but i think its ok :)

Thanks, saved me a byte. You should update the challenge to include that in the spec.

A lot of people are complaining about the strict input format. I didn't think it was a problem. Sure, 50% of the characters in my solutions are about dealing with the format, but on the other hand, if I could just write DayCount[Today,#,"Weekdays"]& then I'd have nothing to golf :) And as the 05AB1E solution shows, dealing with a problem your language doesn't handle for you can be a fun challenge. But the format game is bad if it's done too often - the next time I have a date in the wrong format, I'll do the same thing - so this is something to use sparingly.

Saturday to Sunday is 0, no doubt. But I guess that Friday -> Saturday and Sunday -> Monday are both 1. I suggest additional examples for clarification.

Oh and what about Friday to Monday? One workday or two?

"I don't know any method which will use the dd.MM.yyyy immediately" ... I know one. ;) Oh and one more question: Do we have to respect DST?

@Titus No, you don't need to respect DST and From Friday -> Sa / Su is 0 days because you do not have to work until the date and for Mo, it's 1.

05AB1E, 130 128 133 131 124 123 122 121 120 bytes
žežfžg)V0[Y`UD3‹©12*+>₂*T÷®Xα©т%D4÷®т÷©4÷®·()ćsO7%2@+Y`т‰0Kθ4ÖUD<i\28X+ë<7%É31α}‹iY¬>0ëY1¾ǝDÅsD12‹i>1ë\1Dǝ¤>2}}ǝVYI'.¡Q#

I'm out of my mind..
For the golfing language 05AB1E it doesn't matter at all whether the input is with . or -. However, 05AB1E doesn't have any builtins for Date objects or calculations. The only builtin regarding dates it has is today's year/month/day/hours/minutes/seconds/microseconds.
So because of that, almost all of the code you see are manual calculations to go to the next day, and calculating the day of the week.
+5 bytes due to a part I forgot in Zeller's formula (year-1 for months January and February)..
-1 byte thanks to @Grimmy, by changing \$\left\lfloor{\frac{13(m+1)}{5}}\right\rfloor\$ to \$\left\lfloor{\frac{26(m+1)}{10}}\right\rfloor\$ in the code, since 05AB1E has single-byte builtins for both 26 and 10 (being ₂ and T respectively), as opposed to the 3 bytes of 13 and 5.
Try it online or Try it online with an emulated self-specified date of 'today'.
Explanation:
Wall of text incoming.
In general, the code follows the following pseudo-code:
1   Date currentDate = today;
2   Integer counter = 0;
3   Start an infinite loop:
4*    If(currentDate is NOT a Saturday and currentDate is NOT a Sunday):
5       Counter += 1;
6*    currentDate += 1; // Set currentDate to the next day in line
7     If(currentDate == parsed input-string):
8       Stop the infinite loop, and output the counter

1) Date currentDate = today; is this part of the 05AB1E program:
že          # Push today's day
  žf        # Push today's month
    žg      # Push today's year
      )     # Wrap them into a single list
       V    # Pop and store this list in variable `Y`

2) Integer counter = 0; and 3) Start an infinite loop: are straight-forward in the 05AB1E program:
0     # Push 0 to the stack
 [    # Start an infinite loop

4) If(currentDate is NOT a Saturday and currentDate is NOT a Sunday): is the first hard part with manual calculations. Since 05AB1E has no Date builtins, we'll have to calculate the Day of the Week manually.
The general formula to do this is:
$${\displaystyle h=\left(q+\left\lfloor{\frac{13(m+1)}{5}}\right\rfloor+K+\left\lfloor{\frac{K}{4}}\right\rfloor+\left\lfloor{\frac{J}{4}}\right\rfloor-2J\right){\bmod{7}}}$$
Where for the months March through December:

\$q\$ is the \$day\$ of the month ([1, 31])
\$m\$ is the 1-indexed \$month\$ ([3, 12])
\$K\$ is the year of the century (\$year \bmod 100\$)
\$J\$ is the 0-indexed century (\$\left\lfloor {\frac {year}{100}}\right\rfloor\$)

And for the months January and February:

\$q\$ is the \$day\$ of the month ([1, 31])
\$m\$ is the 1-indexed \$month + 12\$ ([13, 14])
\$K\$ is the year of the century for the previous year (\$(year - 1) \bmod 100\$)
\$J\$ is the 0-indexed century for the previous year (\$\left\lfloor {\frac {year-1}{100}}\right\rfloor\$)

Resulting in in the day of the week \$h\$, where 0 = Saturday, 1 = Sunday, ..., 6 = Friday.
Source: Zeller's congruence
We can see this in this part of the 05AB1E program:
Y             # Push variable `Y`
 `            # Push the day, month, and year to the stack
  U           # Pop and save the year in variable `X`
   D          # Duplicate the month
    3‹        # Check if the month is below 3 (Jan. / Feb.),
              # resulting in 1 or 0 for truthy/falsey respectively
      ©       # Store this in variable `®` (without popping)
       12*    # Multiply it by 12 (either 0 or 12)
          +   # And add it to the month
              # This first part was to make Jan. / Feb. 13 and 14

>             # Month + 1
 ₂*           # Multiplied by 26
   T÷         # Integer-divided by 10
®             # Push month<3 from variable `®` again
 Xα           # Take the absolute difference with the year
   ©          # Store this potentially modified year as new `®` (without popping)
    т%        # mYear modulo-100
D4÷           # mYear modulo-100, integer-divided by 4
®т÷©4÷        # mYear integer-divided by 100, and then integer-divided by 4
®·(           # mYear integer-divided by 100, doubled, and then made negative
)             # Wrap the entire stack into a list
 ć            # Extract the head (the counter variable that was also on the stack)
  s           # Swap so the calculated values above are as list at the top
   O          # Take the sum of this entire list
    7%        # And then take modulo-7 to complete the formula,
              # resulting in 0 for Saturday, 1 for Sunday, and [2, 6] for [Monday, Friday]

2@            # Check if the day is greater than or equal to 2 (so a working day)

5) Counter += 1; is straight-forward again:
     # The >=2 check with `2@` results in either 1 for truthy and 0 for falsey
+    # So just adding it to the counter variable is enough

6) currentDate += 1; // Set currentDate to the next day in line is again more complex, because we have to do it manually. So this will be expanded to the following pseudo-code:
a   Integer isLeapYear = ...;
b   Integer daysInCurrentMonth = currentDate.month == 2 ?
c                                 28 + isLeapYear
d                                :
e                                 31 - (currentDate.month - 1) % 7 % 2;
f   If(currentDate.day < daysInCurrentMonth):
g     nextDate.day += 1;
h   Else:
i     nextDate.day = 1;
j     If(currentDate.month < 12):
k       nextDate.month += 1;
l     Else:
m       nextDate.month = 1;
n       nextDate.year += 1;

Sources:
Algorithm for determining if a year is a leap year. (EDIT: No longer relevant, since I use an alternative method to check leap years which saved 7 bytes.)
Algorithm for determining the number of days in a month.
6a) Integer isLeapYear = ...; is done like this in the 05AB1E program:
Y             # Push variable `Y`
 `            # Push the days, month and year to the stack
  т‰          # Divmod the year by 100
    0K        # Remove all items "00" (or 0 when the year is below 100)
      θ       # Pop the list, and leave the last item
       4Ö     # Check if this number is visible by 4
         U    # Pop and save the result in variable `X`

Also used in this 05AB1E answer of mine, so there some example years are added to illustrate the steps.
6b) currentDate.month == 2 ? and 6c) 28 + isLeapYear are done like this:
D            # Duplicate the month that is now the top of the stack
 <           # Decrease it by 1
  i          # And if this is now 1 (thus February):
   \         #  Remove the duplicated month from the top of the stack
    28X+     #  Add 28 and variable `X` (the isLeapYear) together

6d) : and 6e) 31 - (currentDate.month - 1) % 7 % 2; are done like this:
ë           # Else:
 <          #  Month - 1
  7%        #  Modulo-7
    É       #  Is odd (shortcut for %2)
     31     #  Push 31
       α    #  Absolute difference between both
}           # Close the if-else

6f) If(currentDate.day < daysInCurrentMonth): is done like this:
‹     # Check if the day that is still on the stack is smaller than the value calculated
 i    # And if it is:

6g) nextDate.day += 1; is done like this:
Y       # Push variable `Y`
 ¬      # Push its head, the days (without popping the list `Y`)
  >     # Day + 1
   0    # Push index 0

        # (This part is done after the if-else clauses to save bytes)
}}      # Close the if-else clauses
  ǝ     # Insert the day + 1 at index 0 in the list `Y`
   V    # Pop and store the updated list in variable `Y` again

6h) Else: and 6i) nextDate.day = 1; are then done like this:
ë        # Else:
 Y       #  Push variable `Y`
  1      #  Push a 1
   ¾     #  Push index 0
    ǝ    #  Insert 1 at index 0 (days part) in the list `Y`

6j) If(currentDate.month < 12)::
D           # Duplicate the list `Y`
 Ås         # Pop and push its middle (the month)
   D12‹     # Check if the month is below 12
       i    # And if it is:

6k) nextDate.month += 1;:
>       # Month + 1
 1      # Push index 1

        # (This part is done after the if-else clauses to save bytes)
}}      # Close the if-else clauses
  ǝ     # Insert the month + 1 at index 1 in the list `Y`
   V    # Pop and store the updated list in variable `Y` again

6l) Else:, 6m) nextDate.month = 1; and 6n) nextDate.year += 1; are then done like this:
ë        # Else:
 \       #  Delete the top item on the stack (the duplicated month)
  1      #  Push 1
   D     #  Push index 1 (with a Duplicate)
    ǝ    #  Insert 1 at index 1 (month part) in the list `Y`

 ¤       #  Push its tail, the year (without popping the list `Y`)
  >      #  Year + 1
   2     #  Index 2

         # (This part is done after the if-else clauses to save bytes)
}}       # Close the if-else clauses
  ǝ      # Insert the year + 1 at index 2 in the list `Y`
   V     # Pop and store the updated list in variable `Y` again

And finally at 7) If(currentDate == parsed input-string): and 8) Stop the infinite loop, and output the counter:
Y          # Push variable `Y`
 I         # Push the input
  '.¡     '# Split it on dots
     Q     # Check if the two lists are equal
      #    # And if they are equal: stop the infinite loop
           # (And output the top of the stack (the counter) implicitly)

You're a madman ... have an upvote.

Longest 05AB1E program ever?

@LuisMendo Close, but I'm afraid I have one 05AB1E answer myself that is even longer, and one that comes way too close.. ;) I'm sure I'll be able to golf a few bytes here an there and simplify parts of the pseudo-code implementation of the next day. Will look tomorrow morning, but just came back from sport and will go to bed soon.

Ahhh, it feels good to see 05AB1E answers struggle :') Nothing personal! It is just amusing :upsidedownface:

Excel 24 Bytes
Assumes input in Cell A1
=NETWORKDAYS(NOW()+1,A1)

Uses built-in function.  Unfortunately the function includes both today and the end date.  OP has since clarified to not count today, so I add one to NOW so as to not count today.
To address comments on format of number, again, this is Excel standard:

While this works with date values, it fails to take input as stated. That is (at least in the US version) 10.12.2018 is a string when held in a cell rather than a date. The obvious but long solution to correct this would be to change A1 to DATE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2)) in your solution

unfortunately, the community has decided that languages need to be run under their default settings to be valid (the one exception that I have seen to this is language - IE, if your language supports both English and Spanish, you may readily use either, but this must be noted.) Further, OP (@hille) has not stated that format is flexible, and has in fact stated quite the opposite (see second comment on this question)

The format is not standard, it's locale-based. Excel reads the format from the HKCU\Control Panel\International\sDecimal registry string. On a default US Windows installation that's MM/dd/yyyy. In most EU countries this would be the default.

@luisMendo Yes, that works.  I didn't see any clarification.  If it had been to not count last day instead, I could have =NETWORKDAYS(NOW(),A1-1).  I knew it would always be the same byte count no matter which clarification.

Glad that works. I removed the downvote

R, 76 bytes
Please also have a look at this 72 byte R answer that is also locale-independent.
sum(!grepl("S",weekdays(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1))))+1

Try it online!
weekdays gives text days of week, so we count the days in the sequence between today and the input that do not contain S, and add one to the result.

Java 10, 233 232 226 bytes
import java.util.*;d->{int r=0;var s=Calendar.getInstance();s.setTime(new Date());var e=s.getInstance();for(e.setTime(new java.text.SimpleDateFormat("dd.MM.yyyy").parse(d));!s.after(e);s.add(5,1))if(s.get(7)%7>1)r++;return r;}

Date always reminds me how verbose Java really is..
NOTE: There are now two shorter Java answers (below 175 bytes), one with smart use of deprecated methods from earlier Java versions by @LukeStevens, and one using the java.time.LocalDate that's new since Java 8 by @OlivierGrégoire.
Try it online.
Explanation:
import java.util.*;            // Required import for both Calendar and Date
d->{                           // Method with String parameter and integer return-type
  int r=0;                     //  Result-integer, starting at 0
  var s=Calendar.getInstance();//  Create a Calendar instance for the start-date
  s.setTime(new Date());       //  Set the start date to today
  var e=s.getInstance();       //  Create a Calendar instance for the end-date
  for(e.setTime(               //  Set the end date to:
        new java.text.SimpleDateFormat("dd.MM.yyyy")
                               //   Create a formatter for the "dd.MM.yyyy" format
         .parse(d));           //   And parse the input-String to a Date
      !s.after(e)              //  Loop as long as we haven't reached the end date yet
      ;                        //    After every iteration:
       s.add(5,1))             //     Increase the start-date by 1 day
    if(s.get(7)%7>1)           //   If the day of the week is NOT a Saturday or Sunday:
                               //   (SUNDAY = 1, MONDAY = 2, ..., SATURDAY = 7)
      r++;                     //    Increase the result-sum by 1
  return r;}                   //  Return the result-sum

Could you do e=s.clone()?

@Quintec Yes and no. s.clone() returns an Object and it expects a Calendar object. So I could use e=(Calendar)s.clone(), but I'm afraid that increases the byte-count instead of decreasing it.

We can also (I assume) do Calendar s=Calendar.getInstance(),e=s.getInstance(), which unfortunately ends up being exactly the same length.

@MishaLavrov Ah, the static C indeed isn't necessary. It was from an old part of the code where I also used C somewhere else. Been able to golf 1 byte by using var s=Calendar.getInstance();var e=s.getInstance(); so thanks. :)

150 bytes, using java.time.

@OlivierGrégoire The input format should be dd.MM.yyyy instead of yyyy.MM.dd. Apart from that it's a nice answer, but you can post it yourself if you want. It's too different from mine (and also too different from the other Java answer).

Done! It's very close in bytes to the other answer, but doesn't beat it yet.

JavaScript (ES6), 116 103 bytes
f=(d,n=+new Date)=>(D=new Date(n)).toJSON()<d.split`.`.reverse().join`-`&&(D.getDay()%6>0)+f(d,n+864e5)

Try it online!
How?
A JavaScript timestamp is defined as the number of milliseconds elapsed since the UNIX epoch. The current timestamp is hold in the variable \$n\$.
At each iteration, we use \$n\$ to generate a date \$D\$ (as a JavaScript object). This date is converted to ISO 8601 format with the .toJSON() method:
YYYY-MM-DDThh:mm:ss.sssZ
Since this string starts with YYYY-MM-DD, it is safe to perform a lexicographical comparison with another string in a similar format. This is why we want to convert the input string \$d\$ to YYYY-MM-DD rather than converting our computed date to the input string format DD.MM.YYYY (which cannot be sorted lexicographically):
d.split`.`.reverse().join`-`

Before each recursive call, we increment the final result if D.getDay() is neither \$0\$ (Sunday) nor \$6\$ (Saturday), i.e. if it's not congruent to \$0\$ modulo \$6\$:
(D.getDay() % 6 > 0) + f(d, n + 864e5)

We add \$86,400,000\$ milliseconds to \$n\$ to reach the next day.

Wolfram Language (Mathematica), 64 56 bytes
DayCount[Today,""<>#~StringTake~{{4,6},3,-4},"Weekday"]&

Try it online!
DayCount[x,y,"Weekday"] counts the number of weekdays between x and y.
The inputs x and y can be many things, including a fancy DateObject like the one returned by Today, or a string in the format (unfortunately) mm.dd.yyyy.
My previous attempt tried to turn the dd.mm.yyyy input into a DateObject by telling Mathematica how to parse it; the new solution simply rearranges the string to put day and month in the order Mathematica expects.
It's worth noting that the 28-byte solution DayCount[Today,#,"Weekday"]& not only works perfectly for a month-day-year input format, but also correctly handles unambiguous day-month-year inputs such as 31.12.2018, which couldn't possibly mean "the 12th day of the 31st month". So it's correct more than 60% of the time :)

MATL, 24 bytes
46tQZt24&YO:Z':X-9XO83-z

Try it online!

I don't want to have any input format so that specific code golf languages got a big advantage

You half succeeded :-)
Explanation
46      % Push 46 (ASCII for '.')
tQ      % Duplicate, add 1: gives 47 (ASCII for '/')
Zt      % Implicit input. Replace '.' by '/' in the input string
24&YO   % Convert string with date format 24 ('dd/mm/yyyy') to serial date number.
        % This is an integer representing day starting at Jan-1-0000
:       % Inclusive range from 1 to that
Z'      % Push current date and time as a serial number. Integer part is day;
        % decimal part represents time of the day
:       % Inclusive range from 1 to that
X-      % Set difference. Gives serial numbers of days after today, up to input
9XO     % Convert each number to date format 9, which is a letter for each day
        % of the week: 'M', 'T', 'W', 'T', ' F', 'S', 'S'
83-     % Subtract 83 (ASCII for 'S')
z       % Number of nonzeros. Implicit display

If I understood the challenge correctly, you only take one date input, and compare it to today's date. For example, 16.10.2018 would today (Monday 01-10-2018) result in 11, tomorrow in 10, etc.

@KevinCruijssen Whoops. Thanks! Corrected now

And with the same byte-count. :) Nice, +1 from me.

Perl 6, 61 bytes
{+grep 6>*.day-of-week,Date.today^..Date.new(|[R,] m:g/\d+/)}

Try it online!

Java (OpenJDK 8), 174 166 165 bytes
With a bit of inspiration from Kevin's answer and a good ol' trawl through the deprecated Date API, I've managed to get a more succinct Java solution.
-8 bytes thanks to Kevin's inventive regex date parsing
-1 bytes thanks to Nevay's clever bitwise operation
import java.util.*;d->{long r=0,s=new Date().getTime(),e=Date.parse(d.replaceAll("(..).(..).","$2/$1/"));for(;s<=e;s+=864e5)r-=-new Date(s).getDay()%6>>-1;return r;}

Try it online!
Explanation
import java.util.*;                         // Required import for Date
long r=0,                                   // Initialise result variable
     s=new Date().getTime(),                // Current date in millis
     e=Date.parse(
         d.replaceAll("(..).(..).","$2/$1/")// Use regex to convert to MM/dd/yyyy
     );                                     // Parse date arg using deprecated API
for(;s<=e;                                  // Loop while current millis are less than date arg (e.g. date is before)
    s+=864e5)                               // Add 86400000 ms to current date (equiv of 1 day)
    r-=-new Date(s).getDay()%6>>-1;        // If day is Sunday (0) or Saturday (6) don't increment, else add 1
return r;                                   // When loop finished return result

Nice answer! Smart use of the varargs with the d=d[0].split and the deprecated .parse with default format MM/dd/yyyy format. One small mistake in your post, you have import java.text.*; instead of import java.util.*; in your code, and // Required import for both Calendar and Date in your explanation (even though you don't use Calendar).

@KevinCruijssen No idea why I had java.text but fixed now! Thanks!

Although I liked the d=d[0].split with the varargs, changing the input to a regular String, removing d=d[0].split("\\."); and changing d[1]+"/"+d[0]+"/"+d[2] to d.replaceAll("(..).(..).","$2/$1/") saves 7 bytes.

And 1 more byte by changing r+=new Date(s).getDay()%6<1?0:1,s+=864e5); to s+=864e5)r+=new Date(s).getDay()%6<1?0:1;. :)

Cheers! I didn't even realise you could do that with the regex in Java

-1 byte: r-=-new Date(s).getDay()%6>>-1;

R, 72 chars
A variation on the answer provided by @ngm which avoids the grepl to save a few characters and works in non-English locales.
sum(strftime(seq(Sys.Date(),as.Date(scan(,""),"%d.%m.%Y"),1),'%u')<6)+1

Shorter and more general too. Nice answer and welcome to the asylum.

Welcome to PPCG! you can add a TIO link - it's easy and formats the answer for you :)

Red, 72 bytes
func[a][b: now/date s: 0 until[if b/weekday < 6[s: s + 1]a < b: b + 1]s]

Try it online!
Takes the date in format dd-mm-yyyy, for example 31-10-2018 (also works with 10-Oct-2018)
Strict input:
Red, 97 bytes
func[a][a: do replace/all a".""-"b: now/date s: 0 until[if b/weekday < 6[s: s + 1]a < b: b + 1]s]

Try it online!
Bonus:
Returns a list of the dates/weekdays of the working days up to the given date:
Red, 235 bytes
f: func [ a ] [
    b: now/date
    d: system/locale/days
    collect [
        until [
            if b/weekday < 6 [
                keep/only reduce [ b ":" d/(b/weekday) ]
            ]
            a < b: b + 1
        ]
    ]
]

Try it online!

Agh, no fair, in python I need to spend about 72 bytes processing this IO format... :P

Usually my Red solutions are among the longest ones, but fortunately Red deals very well with dates :)

90 bytes to process python... i'm done, I quit until there's a more flexible input format :P

JavaScript, 87 85 bytes
Returns false for 0.
s=>([d,m,y]=s.split`.`,g=_=>new Date<(x=new Date(y,~-m,d--))&&(x.getDay()%6>0)+g())()

Try it online or check the next 31 days

JavaScript (Node.js), 168 160 139 133 bytes
35 bytes less thanks to Quintec and Kevin Cruijssen
D=>{var i=D.split('.'),n=0;for(var d=new Date();d<=new Date(i[2],i[1]-1,i[0]);d.setDate(d.getDate()+1))n+=-~d.getDay()%7>1;return n;}

Try it online!
D=>{
  var i=D.split('.'),                 // Splits the date string by .
      n=0;                            // Counter variable
  for(var d=new Date();               // For the actual date
      d<=new Date(i[2],i[1]-1,i[0]);      // As long as the date is less or equal the requested date
      d.setDate(d.getDate()+1))           // Count the date one up
    n+=-~d.getDay()%7>1;                // If the date is not a Sunday or Saturday
  return n;                           // Return the counter variable
}

158 bytes with lambda

139 bytes with improved if condition

Since your method isn't recursive, you don't need to add the f= to the byte-count (and on TIO you can put it in the header), which is why @Quintec stated it's 139 bytes instead of 141 bytes. In addition, you can change if((d.getDay()+1)%7>1)n++; to n+=-~d.getDay()%7>1; to golf it to 133 bytes.

Here the relevant tip why -~i is the same as (i+1) Also, if you haven't seen it yet, Tips for golfing in JavaScript and Tips for golfing in  might be interesting to read through. :)

@KevinCruijssen and Quintec that's awesome, thanks

97 bytes

@Shaggy At this point it's worth a new answer... :P You even outgolfed the other JS answer!

@Quintec, already posted it after some more golfing.

@Shaggy Ah, gotcha, didn't see it.

A few more tips for future reference.

Python 2, 163 156 149 147 bytes
lambda s:sum((date.today()+timedelta(x)).weekday()<5for x in range((date(*map(int,(s.split(".")[::-1])))-date.today()).days))
from datetime import*

Try it online!
-7 with thanks to @mypetlion
-7 more with thanks to @ovs
+30 due to the very restrictive input format which I only noticed just before I posted my previous code which took input as e.g. (2018,11,1) :-(

No need for this: (0,1)[t.weekday()<5]. Python booleans are a subclass of int and True, False can be used in arithmetic operations as 1,0. Replace it with c+=t.weekday()<5 to save 7 bytes.

149 bytes as a lambda.

Thanks @mypetlion. I shouldn't have missed that one.

Thanks @ovs. Second time you have helped recently. Last time was a very impressive -30. Was trying to work out how to get this into a lambda.

Python3 & Numpy, 96 bytes
I couldn't get smaller than the boring pre-made solution...
from numpy import*
d=datetime64
lambda s:busday_count(d('today'),d(f'{s[6:]}-{s[3:5]}-{s[:2]}'))
Try it online!

Must get into Python 3 ;)

Based on your import, you are not using Python 3, but rather Python 3 with numpy.

@JonathanFrech should that be in the title? others using python also have used a library as python has no builtin datatype for dates or times.

This depends on your definition of builtin -- modules like datetime are standard library modules and thus I would count them as being part of the core language. However, when one uses third-party modules like numpy, one enhances the language's capabilities and therefore I would see it as another language.

Java (JDK 10), 171 bytes
s->{int c=0;for(var t=java.time.LocalDate.now();!t.parse(s.replaceAll("(..).(..).(.*)","$3-$2-$1")).equals(t);t=t.plusDays(1))c-=t.getDayOfWeek().getValue()/6-1;return c;}

Try it online!
Credits

-4 bytes thanks to Kevin Cruijssen

You can change the (.*)\\.(.*)\\.(.*) to (..).(..).(.*).

With your replaceAll technique his answer can be golfed by 7 bytes as well however, so yours is still slightly longer. ;)

@KevinCruijssen Thanks for the regex! And no worries: I don't mind having a longer answer ;)

PowerShell, 107 99 bytes
-8 bytes thanks to mazzy
$d,$m,$y=$args-split'\.';for($a=date;$a-lt(date "$y-$m-$d");$a=$a|% *ys 1){$o+=($a|% D*k)-in1..5}$o

Try it online!
Performs a regex -split on the input $args, stores the values into $days, $months, and $years, respectively. Then, enters a for loop, initializing $a to today's date. The loop continues while $a is -lessthan our input target date. Each iteration we're adding 1 days to $a, and checking whether the current D*k (short for DayOfWeek) is in the range 1..5 (i.e., Monday to Friday). That Boolean result is accumulated into $o and once we're out of the loop that value is left on the pipeline and output is implicit.

100 bytes? $d,$m,$y=$args-split'\.';for($a=date;$a-lt(date "$y-$m-$d");$a=$a|% *ys 1){$o+=($a|% D*k)-in1..5};$o

@mazzy Indeed. Plus, the semicolon between for(...){...} and $o can be removed, so we're now below 100!

Python 2, 147 143 141 140 bytes
from datetime import*
lambda e,s=date.today():sum((s+timedelta(x+1)).weekday()<5for x in range((date(*map(int,e.split(".")[::-1]))-s).days))

Try it online!
Takes a string, e, which represents the end date in the format "dd.MM.YYYY". Optionally also takes the start date, but this is expected to be a datetime.date.
The start date, s, is defaulted to today's date as a datetime.date object in order to disregard time. The end time is parsed into a datetime.datetime object then converted to a date, since datetime.date objects do not have a parse method and datetimes cannot be added to/subtracted from dates. Iterates through every day in (start, end] and adds 1 to the total if its weekday number is < 5. ([0-4] are [Mon-Fri], [5-6] are [Sat-Sun]).
Datetime parsing is the worst, you guys.
EDIT: Stole ElPedro's map(int,thing) trick to save 4 bytes.
EDIT 2: ELECTRIC BOOGALOO: Saved 2 bytes by making it an anonymous function. (Thanks Aaron!)
EDIT 3: xrange -> range. (Thanks again Aaron!)

You're welcome! Nice answer :)

It is convention you can leave off the f= from lambda expressions here

"Datetime parsing is the worst, you guys" Hahahaha feel my pain, you succeeded where I failed though :P

@Aaron I'm never sure if that's okay with multiple functions or with import statements, thanks!

You can also use range rather than xrange it should still work just fine.

PHP (with Carbon), 107 bytes
function a($d){return Carbon\Carbon::parse($d)->diffInDaysFiltered(function($e){return!$e->isWeekend();});}

K4, 40 bytes
Solution:
{+/1<.q.mod[d+!(."."/:|"."\:x)-d:.z.d]7}

Explanation:
Calculate the difference between the dates, use modulo 7 to ignore weekends, sum up.
{+/1<.q.mod[d+!(."."/:|"."\:x)-d:.z.d]7} / the solution
     .q.mod[                         ]7  / modulo with 7
                                 .z.d    / UTC date
                               d:        / save as d
                              -          / subtract from
               (             )           / do this together
                       "."\:x            / split input on "."
                      |                  / reverse
                 "."/:                   / join back with "."
                .                        / take the value
              !                          / range 0..the difference
            d+                           / add today's date to range
   1<                                    / is 1 less than the modulo (ie is this mon-fri)?
 +/                                      / sum up

Notes:

same byte alternative to the date parsing: "D"$,/|"."\:x

PHP, 66 bytes
for($t=time();$t<strtotime($argn);)$r+=date(N,$t+=86400)<6;echo$r;

empty output for 0; insert + between echo and $r to fix.
Run as pipe with -nr or try it online.

60 bytes with unary output:
for($t=time();$t<strtotime($argn);)echo date(N,$t+=86400)<6;

C (clang), 209 208 205 bytes
Compiler flags -DU=u=localtime(&b) -DW=tm_wday -DY=tm_year -DT=tm_yday (52 bytes).

#import<time.h>
i;f(char*a){long b;struct tm t,*u;time(&b);U;strptime(a,"%d.%m.%Y",&t);for(i=0;u->T^t.T|u->Y^t.Y;u->W&&u->W^6&&i++,b+=86400,U);return i;}

Try it online!
-1 byte thanks to @JonathanFrech

?i++:0 -> &&++i.

IBM/Lotus Notes Formula - 99 bytes
d:=i;c:=0;@While(d>@Today;@Set("c";c+@If(@Weekday(d)=1:7;0;1));@Set("d";@Adjust(d;0;0;-1;0;0;0)));c

Takes input from a date/time field i. The input format of i is set to . separated so there is no need to convert the input. Notes can take a date input with any separator as long as you tell it before what it is going to be (hope that's not cheating!). Formula is in computed numeric field o on the same form.
Interesting aside: Ever since @For and @While were introduced into the Formula language in (I think) R6 by the great Damien Katz the only use I have found for them is code golfing. I have never used them in a production app.
There is no TIO available for formula so here is a screenshot taken on 02.10.2018:

Ruby, 81 bytes
->e{require'date';(Date.today...Date.strptime(e,'%d.%m.%Y')).count{|d|6>d.cwday}}

Try it online!

q, 52 79 bytes
{x:"D"$"."sv reverse"."vs x;i:0;while[x-.z.d;$[2>x mod 7;x-:1;[i+:1;x-:1]]];:i}

in q, each date has an underlying integer value, based on how many days have passed since the start of the millenium. Applying 'mod 7' to this, you get unique values for each day of the week (0 for Saturday, 6 for Friday). So when 2 > x mod 7, don't increment the counter, to avoid counting weekends.
EDIT: Missed strict date format, editing
EDIT2: Included

Best I've come up with is {sum 1<mod[d+til("D"$x 10 vs 67893401)-d:.z.d]7} for 48 bytes without resorting to K verbs.

Using the list indices is a lot more elegant than reverse, and rather than using a loop, applying mod to the list. Great answer +1

Scala, 251 bytes
Port of @Olivier Grégoire's Java answer in Scala.

Golfed version. Try it online!
def c(d:String):Int={var r=0;val s=Calendar.getInstance;s.setTime(new Date);val e=Calendar.getInstance;e.setTime(new SimpleDateFormat("dd.MM.yyyy").parse(d));while(!(s after e)){if(s.get(Calendar.DAY_OF_WEEK)%7>1)r+=1;s.add(Calendar.DAY_OF_YEAR,1)};r}

Ungolfed version. Try it online!
import java.util._
import java.text.SimpleDateFormat

object Main extends App {
  trait N {
    @throws[Exception]
    def c(d: String): Int
  }

  val n: N = new N {
    def c(d: String): Int = {
      var r = 0
      val s = Calendar.getInstance()
      s.setTime(new Date())
      val e = Calendar.getInstance()
      e.setTime(new SimpleDateFormat("dd.MM.yyyy").parse(d))
      while (!s.after(e)) {
        if (s.get(Calendar.DAY_OF_WEEK) % 7 > 1) r += 1
        s.add(Calendar.DAY_OF_YEAR, 1)
      }
      r
    }
  }

  println(n.c("16.10.2018"))
  println(n.c("01.01.2100"))
}


text:
Concatenate 2 numeric type values to a fixed size number
You have 2 numbers, both stored separate as numeric data type.
First number is always 6 digits long.
Second number can vary between 1 and 4 digits. If it's less than 4 digits, it needs to be padded with numeric value 0.
End result always needs to be 10 digits number.
Order has to be respected. n1|n2
Example #1:
n1 = 111111
n2 = 2222
result = 1111112222

Example #2:
n1 = 333333
n2 = 44
result = 3333330044

The rule is that you can only use numeric data types (number, int, float, decimal) to get the desired result.

you can only use numeric data types That's close to being an unobservable requirement. What if a function I call uses strings internally? Also, this needs a winning criterion. Code golf?

I have a function that converts my number to a string to process it. Am I allowed to use it?

This one seems really interesting. The only problem is that not every language can guarantee the type at every point of a variable's use. Need to maybe loosen that up a bit (or even restrict to languages that don't require any conversions, internally or otherwise).

MathGolf, 3 bytes
♫*+

Try it online!
Explanation:
      Implicit input
 ♫*   Multiply first argument by 10000
   +  Add the two arguments
      Implicit output

Every time i think "This seems like a good challenge for MathGolf", I find you in the answers. Nice answer, goes really well with my idea of having lots of numerical constants to aid in golfing.

MATL, 5 bytes
1e4*+

Uses only addition and multiplication.
Try it online!

05AB1E, 4 bytes
4°*+

Try it online!

Ruby, 14 bytes
->a,b{a*1e4+b}

brainfuck, 45 bytes
,.,.,.,.,.,.,[-->+++>+++>+++<<<],[<,]>>>>[.<]

Try it online!
Assumes the inputted numbers are separated by a single space