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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<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<sstream>
#include<string>
using namespace std;

#define TR(it , c) for(__typeof((c).end())it = (c).begin(); it != (c).end();it++)
#define FOR(i , a , b) for(__typeof(b)i = a; i<b;i++)
#define FORE(i , a , b) for(__typeof(b)i = a; i<=b;i++)
#define FORI(i , a , b) for(__typeof(b)i = a; i>b;i--)
#define FOREI(i , a , b) for(__typeof(b)i = a; i>=b;i--)
#define x first
#define y second
#define MAX 1000000
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<double , double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vii;
typedef vector<pdd> vdd;
typedef set<int> si;
typedef set<double> sd;
typedef set<pii> sii;
typedef set<pdd> sdd;

int n , m;
int in1,in2;
int ans;
//int degree[MAX+5];
si edge[MAX+5];
si tmpoo[MAX+5];

ll nC1(ll p){   return p;  }
ll nC2(ll p){
    if(p<1) return 0;
    return p*(p-1)/2;
}
ll nC3(ll p){   return p*(p-1)*(p-2)/6; }

ll remove1(int p , int q)
{
    ll re = 999999999;
    /*cout << p << ":";
    TR(it , tmpoo[p])   cout <<*it << " ";
    cout << endl;*/
    if(tmpoo[p].find(q) == tmpoo[p].end())
    {
        //printf("CANT FOUND << %d\n",q);
        re = nC1(n-2)-tmpoo[p].size();
        tmpoo[p].insert(q);
    }

    /*cout << q << ":";
    TR(it , tmpoo[q])   cout <<*it << " ";
    cout << endl;*/
    if(tmpoo[q].find(p) == tmpoo[q].end())
    {
        //printf("CANT FOUND << %d\n",p);
        re = min(re , nC1(n-2)-tmpoo[q].size());
        tmpoo[q].insert(p);
    }
    //cout << "RETURN:" <<re<< endl;
    if(re == 999999999) return 0;
    return re;
}

ll cal(int i)
{
    ll re = 0;
    if(edge[i].size() == 0)    return 0;
    else if(edge[i].size() == 1)
        return remove1(i,*edge[i].begin());
    TR(it , edge[i])
        re += remove1(i , *it);
    for(si::iterator it = edge[i].begin(); it != edge[i].end();it++)
    {
        si::iterator it2 = (it);
        it2++;
        for(; it2 != edge[i].end();it2++)
        {
            if(edge[*it].find(*it2) != edge[*it].end())
                re -= 1;
        }
    }
    return re;
}
int main()
{
    scanf("%d%d",&n,&m);
    ans = nC3(n);
    FOR(i,0,m)
    {
        scanf("%d%d",&in1,&in2);
        in1--;
        in2--;
        edge[min(in1,in2)].insert(max(in1,in2));
    }
    FOR(i,0,n)
    {
        //cout <<"ANSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS:"<< ans << endl ;
        ans -= cal(i);
    }
    /*FOR(i,0,n)
    {
        cout << i << ": ";
        TR(it , tmpoo[i])
            cout <<*it << " ";
        cout << endl;
    }*/
    cout << ans << endl;
    return 0;
}
