Language: C++

#include<bits/stdc++.h>
#include<vector>
#define N 105
#define M 205
#define PAIR pair<int,int>
#define LL long long
using namespace std;
const int mo=1e9+7;
int head[N],len,next[N],num[N],ce,cd;
int n,m,k,f[N],C[M][M],pw[N],ans,dfn[N],low[N],clk,cut[N],st[N],top,vis[N],xyk;
int gcd(int x,int y){ return x ? gcd(y%x,x) : y;}
LL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;}
int cir(int n)
{
	int i,ans=0;
	for(i=1;i<=n;i++)
		ans=(ans+pw[gcd(i,n)])%mo;
	ans=(1LL*ans*fpm(n,mo-2))%mo;
	return ans;
}
void calc(int e)
{
	int x,y;
	if(top==1) ans=(1LL*ans*k)%mo,top=0;
	else{
		cd=ce=0,++xyk;
		while(top){
			x=num[st[top]^0];
			y=num[st[top]^1];
			ce++;
			if(vis[x]!=xyk) cd++,vis[x]=xyk;
			if(vis[y]!=xyk) cd++,vis[y]=xyk;
			if(st[top--]==e) break;
		  }
		if(cd==ce) ans=(1LL*ans*cir(cd))%mo;
		else ans=(1LL*ans*C[ce+k-1][k-1])%mo;
	  }
}
void tarjan(int t,int fa)
{
	int i;
	dfn[t]=low[t]=++clk,cut[t]=0;
	for(i=head[t];i;i=next[i]){
		if(num[i]==fa) continue;
		if(!dfn[num[i]]){
			st[++top]=i;
			tarjan(num[i],t),low[t]=min(low[t],low[num[i]]);
			if(low[num[i]]>=dfn[t]) cut[t]=1,calc(i);
		  }
		else{
			low[t]=min(low[t],dfn[num[i]]);
			if(dfn[num[i]]<dfn[t]) st[++top]=i;
		  }
	  }
}
int main()
{
	int i,j,x,y; ans=len=1;
	scanf("%d %d %d",&n,&m,&k);
	for(i=1;i<=m;i++){
		scanf("%d %d",&x,&y);
		num[++len]=y,next[len]=head[x],head[x]=len;
		num[++len]=x,next[len]=head[y],head[y]=len;
	  }
	C[0][0]=pw[0]=1;
	for(i=1;i<M;i++){
		C[i][0]=C[i][i]=1;
		for(j=1;j<i;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
	  }
	for(i=1;i<=m;i++) pw[i]=(1LL*pw[i-1]*k)%mo;
	for(i=1;i<=n;i++)
		if(!dfn[i])
			tarjan(i,0),top=0;
	cout<<ans;
	return 0;
}


Compiler output:
a.cc: In function 'void tarjan(int, int)':
a.cc:43:27: error: reference to 'next' is ambiguous
   43 |         for(i=head[t];i;i=next[i]){
      |                           ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/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:9:17: note:                 'int next [105]'
    9 | int head[N],len,next[N],num[N],ce,cd;
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:62:30: error: reference to 'next' is ambiguous
   62 |                 num[++len]=y,next[len]=head[x],head[x]=len;
      |                              ^~~~
/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:9:17: note:                 'int next [105]'
    9 | int head[N],len,next[N],num[N],ce,cd;
      |                 ^~~~
a.cc:63:30: error: reference to 'next' is ambiguous
   63 |                 num[++len]=x,next[len]=head[y],head[y]=len;
      |                              ^~~~
/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:9:17: note:                 'int next [105]'
    9 | int head[N],len,next[N],num[N],ce,cd;
      |                 ^~~~