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3 9
9 10
 10 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
 3 0
 6 6
1 2
2 3
3 1
4 5
5 6
6 4
 10 0
 9 15
1 2
2 3
3 1
1 4
4 5
5 1
1 6
6 7
7 1
1 8
8 9
9 1
2 9
7 4
2 8
 4 0
 1 0

1
 0
 43
 0
 8
 0
 84
 82
 63
 166666166667000000
 21
 30
 292
 64
 36
 0
 84
 284
 1
 37
 1
 4
 59
 50
 1
 2
 120
 28
 4
 0

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <climits>
//#include <ext/hash_map>


using namespace std;
using namespace __gnu_cxx;



#define REP(i,n) for(int i = 0; i < int(n); ++i)
#define REPV(i, n) for (int i = (n) - 1; (int)i >= 0; --i)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)

#define FE(i,t) for (__typeof((t).begin())i=(t).begin();i!=(t).end();++i)
#define FEV(i,t) for (__typeof((t).rbegin())i=(t).rbegin();i!=(t).rend();++i)

#define two(x) (1LL << (x))
#define ALL(a) (a).begin(), (a).end()


#define pb push_back
#define ST first
#define ND second
#define MP(x,y) make_pair(x, y)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

template<class T> void checkmin(T &a, T b){if (b<a)a=b;}
template<class T> void checkmax(T &a, T b){if (b>a)a=b;}
template<class T> void out(T t[], int n){REP(i, n)cout<<t[i]<<" "; cout<<endl;}
template<class T> void out(vector<T> t, int n=-1){for (int i=0; i<(n==-1?t.size():n); ++i) cout<<t[i]<<" "; cout<<endl;}
inline int count_bit(int n){return (n==0)?0:1+count_bit(n&(n-1));}
inline int low_bit(int n){return (n^n-1)&n;}
inline int ctz(int n){return (n==0?-1:ctz(n>>1)+1);}
int toInt(string s){int a; istringstream(s)>>a; return a;}
string toStr(int a){ostringstream os; os<<a; return os.str();}

const int maxn=1e6+10;
vi e[maxn];
vector<pii> el;


int main(){
    int n,m;
    cin>>n>>m;

    REP(i,m){
        int a, b; 
        scanf(" %d%d",&a,&b); --a; --b;
        el.pb(MP(a,b));
        e[a].pb(b);
        e[b].pb(a);
    }
    REP(i,n) sort(ALL(e[i]));

    ll res=1ll*n*(n-1)*(n-2)/6;
    int cnt1=0, cnt2=0;

    REP(i,m){
        int a=el[i].ST, b=el[i].ND;
        if (e[a].size()>e[b].size()) swap(a,b);
        int ntr=0;
        int na=e[a].size(), nb=e[b].size();
        REP(j,na){
            int u=e[a][j];
            if (u==b) continue;
            ll h=0;

            int T=0,H=e[b].size()-1;
            int best=0;
            while(T<=H){
                int M=T+H>>1;
                if (e[b][M]<=u) best=M,T=M+1;
                else H=M-1;
            }
            if (e[b][best]==u) ++ntr;
        }
        cnt1+=n-2-(na+nb-2-ntr);
        cnt2+=na+nb-2-2*ntr;
    }
    res-=cnt1+cnt2/2;
    cout<<res<<endl;
    return 0;
}

