Program O_farebnych_trojuholnikoch; var N,M,P,i,j,x,y:longint; { c[i] je pocet cervenych useciek vychadzajucich z bodky cislo i} c:array[1..10000] of longint; farba:string; begin readln(N,M); for i:=1 to N do c[i]:=0; for i:=1 to M do begin readln(x,y); inc(c[x]); inc(c[y]); end; P:=0; for i:=1 to N do P:=P + c[i]*(N-1-c[i]); writeln( (N*(N-1)*(N-2) div 6) - (P div 2) ); end.