func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 5000 << 2;   int times[5001], cnt[5001], n, a[5001];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , a + i);     for (int i = n - 1; i >= 0; i--) {       memset(cnt, 0, sizeof(cnt));       int res = a[i];       times[res]++;       cnt[res]++;       for (int j = i - 1; j >= 0; j--) {         cnt[a[j]]++;         if (cnt[a[j]] > cnt[res] || cnt[a[j]] == cnt[res] && a[j] < res)           res = a[j];         times[res]++;       }     }     for (int i = 1; i <= n; i++) printf( %d%c , times[i], (i < n ?     :   n ));     return 0;   }   