Language: C

import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;

int count;

void main()
{
    readln();
    int[] list = readln().split.to!(int[]);
    foreach(e; mergeSort(list))
    {
        write(e);
        write(" ");
    }
    writeln("");
    writeln(count);
}

int[] merge(int[] a, int[] b)
{
    int[] res;
    res.reserve(a.length+b.length);
    while(a.length != 0 && b.length != 0)
    {
        if(a.front < b.front)
        {
            res ~= a.front;
            a.popFront();
        }else{
            res ~= b.front;
            b.popFront();
        }
    }
    res ~= a ~ b;
    count+=res.length;
    return res;
}

int[] mergeSort(int[] list)
{
    if(list.length == 0)
        return list;
    if(list.length == 1)
        return list;
    auto mid = list.length / 2;
    auto a = mergeSort(list[0..mid]);
    auto b = mergeSort(list[mid..$]);
    return merge(a, b);
}

sizediff_t minIndex(alias pred="a<b", R) (R list)
    if(isForwardRange!R && !isInfinite!R && is(typeof(binaryFun!pred(list.front, list.front))))
{
    assert(!list.empty);
    typeof(list.front) min = list.front;
    sizediff_t minPos;
    sizediff_t curPos;
    for(list.popFront(); !list.empty; list.popFront())
    {
        curPos++;

        if(binaryFun!pred(list.front, min))
        {
            min = list.front;
            minPos = curPos;
        }
    }
    return minPos;
}



Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
      | ^~~~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
      |           ^
main.c:2:1: error: unknown type name 'import'
    2 | import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;
      | ^~~~~~
main.c:2:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;
      |           ^
main.c: In function 'main':
main.c:8:5: error: implicit declaration of function 'readln' [-Wimplicit-function-declaration]
    8 |     readln();
      |     ^~~~~~
main.c:9:8: error: expected identifier or '(' before '[' token
    9 |     int[] list = readln().split.to!(int[]);
      |        ^
main.c:10:5: error: implicit declaration of function 'foreach' [-Wimplicit-function-declaration]
   10 |     foreach(e; mergeSort(list))
      |     ^~~~~~~
main.c:10:13: error: 'e' undeclared (first use in this function)
   10 |     foreach(e; mergeSort(list))
      |             ^
main.c:10:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:14: error: expected ')' before ';' token
   10 |     foreach(e; mergeSort(list))
      |            ~ ^
      |              )
main.c:10:32: error: expected ';' before '{' token
   10 |     foreach(e; mergeSort(list))
      |                                ^
      |                                ;
   11 |     {
      |     ~                           
main.c:16:5: error: implicit declaration of function 'writeln' [-Wimplicit-function-declaration]
   16 |     writeln(count);
      |     ^~~~~~~
main.c: At top level:
main.c:19:4: error: expected identifier or '(' before '[' token
   19 | int[] merge(int[] a, int[] b)
      |    ^
main.c:39:4: error: expected identifier or '(' before '[' token
   39 | int[] mergeSort(int[] list)
      |    ^
main.c:46:29: error: too many decimal points in number
   46 |     auto a = mergeSort(list[0..mid]);
      |                             ^~~~~~
main.c:51:1: error: unknown type name 'sizediff_t'
   51 | sizediff_t minIndex(alias pred="a<b", R) (R list)
      | ^~~~~~~~~~
main.c:51:21: error: unknown type name 'alias'
   51 | sizediff_t minIndex(alias pred="a<b", R) (R list)
      |                     ^~~~~
main.c:51:39: error: unknown type name 'R'
   51 | sizediff_t minIndex(alias pred="a<b", R) (R list)
      |                                       ^