Language: C++

#include <cstdio>
#include <iostream>
#define ll long long 
#include <cstring>
#include <algorithm>
using namespace std;
inline void read(ll &k)
{
	ll f=1,c=getchar();k=0;
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();
	k*=f;
}
const int maxn=100000*2+100;
bool is=1;
int col[maxn];
ll n,m,u,tot=0,vv,a[maxn],b[maxn],last[maxn],to[maxn],next[maxn];
void dfs(int now)
{
//	cout <<now<<endl;
	for (ll i=last[now];i;i=next[i])
	{
		if (!col[to[i]])col[to[i]]=3-col[now],dfs(to[i]);
		else if (col[to[i]]==col[now])is=0;
	}
}
int main()
{
	read(n);read(m);
	for (register int i=1;i<=m;i++)
	{
		read(u);read(vv);
		next[++tot]=last[u];
		last[u]=tot;
		to[tot]=vv;
		next[++tot]=last[vv];
		last[vv]=tot;
		to[tot]=u;
	}
	col[1]=1;
	dfs(1);
	ll b=0;
//	for (int i=1;i<=n;i++)cout << col[i]<<" ";cout <<endl;
	for (register int i=1;i<=n;i++)
	if (col[i]==2)b++;
//	cout << (int)is<<endl;
	if (is)printf("%lld\n",b*(n-b)-m);else printf("%lld\n",n*(n-1)/2-m);
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:21:33: error: reference to 'next' is ambiguous
   21 |         for (ll i=last[now];i;i=next[i])
      |                                 ^~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:17:55: note:                 'long long int next [200100]'
   17 | ll n,m,u,tot=0,vv,a[maxn],b[maxn],last[maxn],to[maxn],next[maxn];
      |                                                       ^~~~
a.cc: In function 'int main()':
a.cc:30:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         for (register int i=1;i<=m;i++)
      |                           ^
a.cc:33:17: error: reference to 'next' is ambiguous
   33 |                 next[++tot]=last[u];
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:17:55: note:                 'long long int next [200100]'
   17 | ll n,m,u,tot=0,vv,a[maxn],b[maxn],last[maxn],to[maxn],next[maxn];
      |                                                       ^~~~
a.cc:36:17: error: reference to 'next' is ambiguous
   36 |                 next[++tot]=last[vv];
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:17:55: note:                 'long long int next [200100]'
   17 | ll n,m,u,tot=0,vv,a[maxn],b[maxn],last[maxn],to[maxn],next[maxn];
      |                                                       ^~~~
a.cc:44:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   44 |         for (register int i=1;i<=n;i++)
      |                           ^