func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const double pi = 4 * atan(1);   const int inf = 0x3f3f3f3f;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const int MOD = 1e9 + 7;   int nCase = 0;   int dcmp(double x) {     if (fabs(x) < eps) return 0;     return x < 0 ? -1 : 1;   }   template <class T>   inline bool read(T &n) {     T x = 0, tmp = 1;     char c = getchar();     while ((c <  0  || c >  9 ) && c !=  -  && c != EOF) c = getchar();     if (c == EOF) return false;     if (c ==  - ) c = getchar(), tmp = -1;     while (c >=  0  && c <=  9 ) x *= 10, x += (c -  0 ), c = getchar();     n = x * tmp;     return true;   }   template <class T>   inline void write(T n) {     if (n < 0) {       putchar( - );       n = -n;     }     int len = 0, data[20];     while (n) {       data[len++] = n % 10;       n /= 10;     }     if (!len) data[len++] = 0;     while (len--) putchar(data[len] + 48);   }   long long QMOD(long long x, long long k) {     long long res = 1LL;     while (k) {       if (k & 1) res = res * x % MOD;       k >>= 1;       x = x * x % MOD;     }     return res;   }   int n;   priority_queue<pair<int, int> > q;   map<int, int> mp;   vector<pair<pair<int, int>, int> > v;   inline bool check(int mid) {     priority_queue<pair<int, int> > que = q;     int cnt = 0;     v.clear();     while (que.size() > 2 && cnt < mid) {       pair<int, int> f1 = que.top();       que.pop();       pair<int, int> f2 = que.top();       que.pop();       pair<int, int> f3 = que.top();       que.pop();       int a = f1.second;       int b = f2.second;       int c = f3.second;       if (a < b) swap(a, b);       if (a < c) swap(a, c);       if (b < c) swap(b, c);       v.push_back(pair<pair<int, int>, int>(pair<int, int>(a, b), c));       ++cnt;       if (--f1.first > 0) que.push(f1);       if (--f2.first > 0) que.push(f2);       if (--f3.first > 0) que.push(f3);     }     return cnt >= mid;   }   int main(int argc, const char *argv[]) {     scanf( %d , &n);     for (int i = 1, x; i <= n; ++i) {       read(x);       mp[x]++;     }     map<int, int>::iterator it;     for (it = mp.begin(); it != mp.end(); ++it) {       q.push(pair<int, int>(it->second, it->first));     }     int l = 0, r = n / 3;     int ans = 0;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(mid) == true) {         l = mid + 1;         ans = mid;       } else         r = mid - 1;     }     printf( %d n , ans);     if (ans > 0) {       for (int i = 0; i < ans; ++i)         printf( %d %d %d n , v[i].first.first, v[i].first.second, v[i].second);     }     return 0;   }   