Language: C++

#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int a[SIZE];
int main(){
    int N; R(N);
    REP(i,N){
        R(a[i]);
    }
    sort(a,a+N);
    int an=0;
    REPP(i,1,N){
        int it=0;
        REPP(j,i+1,N){
            while(it<i&&a[it]+a[i]<=a[j])it++;
            an+=i-it;
        }
    }
    W(an);
    return 0;
}

Compiler output:
a.cc:22:9: error: 'pair' does not name a type
   22 | typedef pair<int,int> PII;
      |         ^~~~
a.cc:23:9: error: 'vector' does not name a type
   23 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:24:9: error: 'vector' does not name a type
   24 | typedef vector<LL> VL;
      |         ^~~~~~
a.cc:25:9: error: 'vector' does not name a type
   25 | typedef vector<PII> VPII;
      |         ^~~~~~
a.cc:26:9: error: 'pair' does not name a type
   26 | typedef pair<LL,LL> PLL;
      |         ^~~~
a.cc:27:9: error: 'vector' does not name a type
   27 | typedef vector<PLL> VPLL;
      |         ^~~~~~
a.cc: In function 'void _R(T&)':
a.cc:28:35: error: 'cin' was not declared in this scope
   28 | template<class T> void _R(T &x) { cin >> x; }
      |                                   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define SZ(X) ((int)(X).size())
a.cc: In function 'void _R(int&)':
a.cc:29:19: error: 'scanf' was not declared in this scope
   29 | void _R(int &x) { scanf("%d", &x); }
      |                   ^~~~~
a.cc: In function 'void _R(LL&)':
a.cc:30:18: error: 'scanf' was not declared in this scope
   30 | void _R(LL &x) { scanf("%lld", &x); }
      |                  ^~~~~
a.cc: In function 'void _R(double&)':
a.cc:31:22: error: 'scanf' was not declared in this scope
   31 | void _R(double &x) { scanf("%lf", &x); }
      |                      ^~~~~
a.cc: In function 'void _R(char&)':
a.cc:32:20: error: 'scanf' was not declared in this scope
   32 | void _R(char &x) { scanf(" %c", &x); }
      |                    ^~~~~
a.cc: In function 'void _R(char*)':
a.cc:33:20: error: 'scanf' was not declared in this scope
   33 | void _R(char *x) { scanf("%s", x); }
      |                    ^~~~~
a.cc: In function 'void _W(const T&)':
a.cc:36:41: error: 'cout' was not declared in this scope
   36 | template<class T> void _W(const T &x) { cout << x; }
      |                                         ^~~~
a.cc:36:41: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'void _W(const int&)':
a.cc:37:25: error: 'printf' was not declared in this scope
   37 | void _W(const int &x) { printf("%d", x); }
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define SZ(X) ((int)(X).size())
a.cc: In function 'void _W(const LL&)':
a.cc:38:24: error: 'printf' was not declared in this scope
   38 | void _W(const LL &x) { printf("%lld", x); }
      |                        ^~~~~~
a.cc:38:24: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'void _W(const double&)':
a.cc:39:28: error: 'printf' was not declared in this scope
   39 | void _W(const double &x) { printf("%.16f", x); }
      |                            ^~~~~~
a.cc:39:28: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'void _W(const char&)':
a.cc:40:26: error: 'putchar' was not declared in this scope; did you mean 'char'?
   40 | void _W(const char &x) { putchar(x); }
      |                          ^~~~~~~
      |                          char
a.cc: In function 'void _W(const char*)':
a.cc:41:26: error: 'printf' was not declared in this scope
   41 | void _W(const char *x) { printf("%s", x); }
      |                          ^~~~~~
a.cc:41:26: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: At global scope:
a.cc:42:41: error: 'pair' does not name a type
   42 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                         ^~~~
a.cc:42:45: error: expected ',' or '...' before '<' token
   42 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                             ^
a.cc: In function 'void _W(int)':
a.cc:42:59: error: 'x' was not declared in this scope
   42 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                                           ^
a.cc:42:65: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   42 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                                                 ^~~~~~~
a.cc:42:65: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: At global scope:
a.cc:43:33: error: 'vector' does not name a type
   43 | template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
      |                                 ^~~~~~
a.cc:43:39: error: expected ',' or '...' before '<' token
   43 | template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
      |                                       ^
a.cc: In function 'void _W(int)':
a.cc:43:63: error: 'x' was not declared in this scope
   43 | template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
      |                                                               ^
a.cc:43:119: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   43 | template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
      |                                                                                                                       ^~~~~~~
a.cc: In function 'void W(const T&, const U& ...)':
a.cc:45:84: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   45 | template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
      |                                                                                    ^~~~~~~
a.cc: In function 'int main()':
a.cc:61:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   61 |     sort(a,a+N);
      |     ^~~~
      |     short
a.cc: In instantiation of 'void W(const T&, const U& ...) [with T = int; U = {}]':
a.cc:70:6:   required from here
   70 |     W(an);
      |     ~^~~~
a.cc:45:91: error: 'putchar' was not declared in this scope; did you mean 'char'?
   45 | template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
      |                                                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                    char