Finding the number of inversions in an Array
A few things I've noticed.


You use List to represent the input data. Lists are inefficient (linear) for things like input.size (which you do twice on the same input) and input.slice().
Both countInversions() and splitInversions() are recursive but they're not tail recursive, so that's going to eat up stack space.
splitInversions() sends its passed parameters to mergeSort() which means that every time it calls itself (recurses) it re-sorts already sorted data.
Your calculations return an Int, which is going to be too small for a large data set such as the inversions.txt you've linked to.


But generally I find the whole thing rather too complicated.

Here's an alternative algorithm that is smaller, faster, and more memory efficient.

def countInversions(input :Vector[Int]) :Long = {
  val idxBuf = input.indices.sortBy(input).toBuffer
  input.indices.foldLeft(0L){ case (sum,x) =&gt;
    val idx = idxBuf.indexOf(x)
    idxBuf.remove(idx)  //side effect
    sum + idx
  }
}