#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <algorithm>

using namespace std;

struct A { int x; };

inline bool lessX( const A &u, const A &v ) { return u.x < v.x; }

struct ALess {
  inline bool operator() ( const A &u, const A &v ) { return u.x < v.x; }
};

inline bool operator < ( const A &u, const A &v ) { return u.x < v.x; }

const int n = 1e6;
A a[n];

void gen() {
  for (int i = 0; i < n; i++)
    a[i].x = i * i * i;
}

int main() {
  double start;

  printf("n = %d\n", n);

  gen();
  start = clock();
  sort(a, a + n, lessX);
  printf("%.2f [%d..%d] less function\n", (clock() - start) / CLOCKS_PER_SEC, a[0].x, a[n - 1].x);

  gen();
  start = clock();
  sort(a, a + n, ALess());
  printf("%.2f [%d..%d] struct with operator ()\n", (clock() - start) / CLOCKS_PER_SEC, a[0].x, a[n - 1].x);

  gen();
  start = clock();
  sort(a, a + n);
  printf("%.2f [%d..%d] struct with operator <\n", (clock() - start) / CLOCKS_PER_SEC, a[0].x, a[n - 1].x);

  return 0;
}