func_code_string: #include <bits/stdc++.h>   using namespace std;   bool debug = false;   int n, m, k;   long long ln, lk, lm;   int b[5105], a[5105];   void update(int x) {     for (int i = x; i <= n; i += i & -i) {       b[i]++;     }   }   int query(int x) {     int ret = 0;     for (; x > 0; ret += b[x], x -= x & -x)       ;     return ret;   }   int main() {     scanf( %d , &n);     for (int(i) = 1; (i) <= (int)(n); (i)++) {       scanf( %d , a + i);       a[i]++;     }     int tt = -((1 << 30)), cnt = 0;     pair<int, int> pp;     for (int i = n; i; i--) {       memset(b, 0, sizeof b);       for (int j = i - 1; j; j--) {         if (a[j] > a[i]) {           update(a[j]);           int x = query(a[j]) - 1;           if (x > tt) {             cnt = 1;             tt = x;             pp = {i, j};           } else if (x == tt)             cnt++;         }       }     }     swap(a[pp.first], a[pp.second]);     memset(b, 0, sizeof b);     int num = 0;     for (int(i) = 1; (i) <= (int)(n); (i)++) {       update(a[i]);       num += i - query(a[i]);     }     printf( %d %d n , num, cnt);     return 0;   }   