func_code_string: #include <bits/stdc++.h>   int b[1010];   double dp[1010][1010];   int main() {     int n, m, i, j, x, y;     double ans = 0;     scanf( %d%d , &n, &m);     for (i = 0; i < n; i++) scanf( %d , &b[i]);     for (i = 0; i < n; i++) {       for (j = 0; j < n; j++) {         if (b[i] > b[j])           dp[i][j] = 1;         else           dp[i][j] = 0;       }     }     while (m--) {       scanf( %d%d , &x, &y);       x--;       y--;       dp[x][y] = dp[y][x] = 0.5;       for (i = 0; i < n; i++) {         if (x == i || y == i) continue;         dp[x][i] = (dp[x][i] + dp[y][i]) * 0.5;         dp[y][i] = dp[x][i];         dp[i][x] = 1 - dp[x][i];         dp[i][y] = dp[i][x];       }     }     for (i = 0; i < n; i++) {       for (j = i + 1; j < n; j++) {         ans += dp[i][j];       }     }     printf( %.10f n , ans);     return 0;   }   