func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int a[105], C[105];   double f[105][105], s1[105][105], s2[105][105], s3[105][105];   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch >  9  || ch <  0 ) {       if (ch ==  - ) f = -1;       ch = getchar();       if (ch == -1) return 0;     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   inline void write(int x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x >= 10) write(x / 10);     putchar(x % 10 +  0 );   }   double ans;   int main() {     n = read(), k = read(), k = min(k, 900);     for (int i = 1; i <= n; i++) a[i] = read();     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) f[i][j] = a[i] > a[j];     for (int i = 1; i <= n; i++) C[i] = C[i - 1] + i;     while (k--) {       for (int j = 1; j <= n; j++) {         for (int i = 1; i <= j - 1; i++) s1[i][j] = s1[i - 1][j] + f[i][j];         for (int i = 1; i <= j - 1; i++) s1[i][j] += s1[i - 1][j];       }       for (int i = n; i >= 1; i--) {         for (int j = n; j >= i + 1; j--) s2[i][j] = s2[i][j + 1] + f[i][j];         for (int j = n; j >= i + 1; j--) s2[i][j] += s2[i][j + 1];       }       for (int j = 0; j <= n - 1; j++) {         for (int i = 1; i <= n - j; i++) s3[i][j] = s3[i - 1][j] + f[i][i + j];         for (int i = 1; i <= n - j; i++) s3[i][j] += s3[i - 1][j];       }       for (int i = 1; i <= n; i++)         for (int j = i + 1; j <= n; j++)           f[i][j] *= C[i - 1] + C[j - i - 1] + C[n - j],               f[i][j] += s1[j - 1][j] - s1[j - i - 1][j] - s1[i - 1][j] +                          s2[i][i + 1] - s2[i][j + 1] - s2[i][n + 2 - j + i] -                          s3[n + i - j][j - i] + s3[n - j][j - i] +                          s3[i - 1][j - i],               f[i][j] = (f[i][j] + i * (n + 1 - j)) / C[n];     }     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) ans += f[i][j];     printf( %.9lf n , ans);     return 0;   }   