func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 15;   const int LL = 1e9 + 15;   const int SSS = 1e6 + 15;   int dx[10] = {0, 1, -1, 1, -1, 2, -2, 2, -2};   int dy[10] = {0, 2, 2, -1, -1, 1, 1, -1, -1};   int n, ii, a[5010], ans[5010], mx, st[5010];   int main() {     cin >> n;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       mx = 0;       ii = 0;       for (int j = 1; j <= n; ++j) st[j] = 0;       for (int j = i; j >= 1; --j) {         ++st[a[j]];         if (st[a[j]] > mx || (st[a[j]] == mx && ii > a[j])) {           mx = st[a[j]];           ii = a[j];         }         ++ans[ii];       }     }     for (int i = 1; i <= n; ++i) printf( %d  , ans[i]);     return 0;   }   