func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int n, i, j, t, ans, arr[3009], crr[3009][3009];   int main() {     scanf( %lld , &t);     while (t--) {       scanf( %lld , &n);       ans = 0;       for (i = 1; i <= n; i++) scanf( %lld , &arr[i]);       for (i = n; i >= 1; i--) {         for (j = i - 1; j >= 1; j--) {           ans += crr[arr[i]][arr[j]];         }         for (j = i + 1; j <= n; j++) {           crr[arr[j]][arr[i]]++;         }       }       printf( %lld n , ans);       for (i = 1; i <= n; i++) {         for (j = 1; j <= n; j++) crr[i][j] = 0;       }     }     return 0;   }   