This documentation is automatically generated by online-judge-tools/verification-helper
// verification-helper: PROBLEM https://yukicoder.me/problems/4918
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#include "../../io/tuple.cpp"
#include "../../tools/chminmax.cpp"
#undef call_from_test
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
auto [as, bs]=read_tuple<int, int>(m);
vector G(n,vector(n,n));
for(int i=0;i<n;i++) G[i][i]=0;
for(int i=0;i<m;i++){
as[i]--;bs[i]--;
G[as[i]][bs[i]]=1;
G[bs[i]][as[i]]=1;
}
for(int k=0;k<n;k++)
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
chmin(G[i][j],G[i][k]+G[k][j]);
int ans=0;
for(int i=0;i<n;i++)
for(int j=0;j<i;j++)
for(int k=0;k<j;k++)
if(G[i][j]!=2 and G[i][k]!=2 and G[j][k]!=2) ans++;
cout<<ans<<endl;
return 0;
}
#line 1 "test/yukicoder/4918.test.cpp"
// verification-helper: PROBLEM https://yukicoder.me/problems/4918
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#line 1 "io/tuple.cpp"
#line 3 "io/tuple.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
template<typename TV, const int N> void read_tuple_impl(TV&) {}
template<typename TV, const int N, typename Head, typename... Tail>
void read_tuple_impl(TV& ts) {
get<N>(ts).emplace_back(*(istream_iterator<Head>(cin)));
read_tuple_impl<TV, N+1, Tail...>(ts);
}
template<typename... Ts> decltype(auto) read_tuple(size_t n) {
tuple<vector<Ts>...> ts;
for(size_t i=0;i<n;i++) read_tuple_impl<decltype(ts), 0, Ts...>(ts);
return ts;
}
//END CUT HERE
#ifndef call_from_test
signed main(){
return 0;
}
#endif
#line 1 "tools/chminmax.cpp"
#line 3 "tools/chminmax.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//END CUT HERE
#ifndef call_from_test
signed main(){
return 0;
}
#endif
#line 9 "test/yukicoder/4918.test.cpp"
#undef call_from_test
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
auto [as, bs]=read_tuple<int, int>(m);
vector G(n,vector(n,n));
for(int i=0;i<n;i++) G[i][i]=0;
for(int i=0;i<m;i++){
as[i]--;bs[i]--;
G[as[i]][bs[i]]=1;
G[bs[i]][as[i]]=1;
}
for(int k=0;k<n;k++)
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
chmin(G[i][j],G[i][k]+G[k][j]);
int ans=0;
for(int i=0;i<n;i++)
for(int j=0;j<i;j++)
for(int k=0;k<j;k++)
if(G[i][j]!=2 and G[i][k]!=2 and G[j][k]!=2) ans++;
cout<<ans<<endl;
return 0;
}