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;
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: In function 'void _R(T&)':
a.cc:19:35: error: 'cin' was not declared in this scope
   19 | 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:20:19: error: 'scanf' was not declared in this scope
   20 | void _R(int &x) { scanf("%d", &x); }
      |                   ^~~~~
a.cc: At global scope:
a.cc:21:6: error: variable or field '_R' declared void
   21 | void _R(LL &x) { scanf("%lld", &x); }
      |      ^~
a.cc:21:9: error: 'LL' was not declared in this scope; did you mean 'ALL'?
   21 | void _R(LL &x) { scanf("%lld", &x); }
      |         ^~
      |         ALL
a.cc:21:13: error: 'x' was not declared in this scope
   21 | void _R(LL &x) { scanf("%lld", &x); }
      |             ^
a.cc: In function 'void _R(double&)':
a.cc:22:22: error: 'scanf' was not declared in this scope
   22 | void _R(double &x) { scanf("%lf", &x); }
      |                      ^~~~~
a.cc: In function 'void _R(char&)':
a.cc:23:20: error: 'scanf' was not declared in this scope
   23 | void _R(char &x) { scanf(" %c", &x); }
      |                    ^~~~~
a.cc: In function 'void _R(char*)':
a.cc:24:20: error: 'scanf' was not declared in this scope
   24 | void _R(char *x) { scanf("%s", x); }
      |                    ^~~~~
a.cc: In function 'void _W(const T&)':
a.cc:27:41: error: 'cout' was not declared in this scope
   27 | template<class T> void _W(const T &x) { cout << x; }
      |                                         ^~~~
a.cc:27: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:28:25: error: 'printf' was not declared in this scope
   28 | 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: At global scope:
a.cc:29:15: error: 'LL' does not name a type; did you mean 'ALL'?
   29 | void _W(const LL &x) { printf("%lld", x); }
      |               ^~
      |               ALL
a.cc:29:6: error: redefinition of 'void _W(const int&)'
   29 | void _W(const LL &x) { printf("%lld", x); }
      |      ^~
a.cc:28:6: note: 'void _W(const int&)' previously defined here
   28 | void _W(const int &x) { printf("%d", x); }
      |      ^~
a.cc: In function 'void _W(const int&)':
a.cc:29:24: error: 'printf' was not declared in this scope
   29 | void _W(const LL &x) { printf("%lld", x); }
      |                        ^~~~~~
a.cc:29: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:30:28: error: 'printf' was not declared in this scope
   30 | void _W(const double &x) { printf("%.16f", x); }
      |                            ^~~~~~
a.cc:30: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:31:26: error: 'putchar' was not declared in this scope; did you mean 'char'?
   31 | void _W(const char &x) { putchar(x); }
      |                          ^~~~~~~
      |                          char
a.cc: In function 'void _W(const char*)':
a.cc:32:26: error: 'printf' was not declared in this scope
   32 | void _W(const char *x) { printf("%s", x); }
      |                          ^~~~~~
a.cc:32:26: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: At global scope:
a.cc:33:41: error: 'pair' does not name a type
   33 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                         ^~~~
a.cc:33:45: error: expected ',' or '...' before '<' token
   33 | 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:33:59: error: 'x' was not declared in this scope
   33 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                                           ^
a.cc:33:65: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   33 | template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
      |                                                                 ^~~~~~~
a.cc:33: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:34:33: error: 'vector' does not name a type
   34 | 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:34:39: error: expected ',' or '...' before '<' token
   34 | 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:34:63: error: 'x' was not declared in this scope
   34 | 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:34:119: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   34 | 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:36:84: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   36 | template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
      |                                                                                    ^~~~~~~
a.cc: At global scope:
a.cc:43:6: error: variable or field 'ADD' declared void
   43 | void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
      |      ^~~
a.cc:43:10: error: 'LL' was not declared in this scope; did you mean 'ALL'?
   43 | void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
      |          ^~
      |          ALL
a.cc:43:14: error: 'x' was not declared in this scope
   43 | void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
      |              ^
a.cc:43:16: error: 'LL' was not declared in this scope; did you mean 'ALL'?
   43 | void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
      |                ^~
      |                ALL
a.cc: In function 'int main()':
a.cc:52:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |     sort(a,a+N);
      |     ^~~~
      |     short
a.cc: In instantiation of 'void W(const T&, const U& ...) [with T = int; U = {}]':
a.cc:61:6:   required from here
   61 |     W(an);
      |     ~^~~~
a.cc:36:91: error: 'putchar' was not declared in this scope; did you mean 'char'?
   36 | template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
      |                                                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                    char