Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 200010;
const LL mod = 1e9+7;
struct Link{
    int to,next;
}link[SIZEN << 1];
int head[SIZEN],tot = 0;
int size[SIZEN] = {0};
LL pw[SIZEN] = {0};
void add(int from,int to){
    link[++tot].to = to;
    link[tot].next = head[from];
    head[from] = tot;
}
int N;
LL ans = 0;
LL qpow(LL x,LL len){
    LL ret = 1;
    for(;len;len>>=1){
        if(len & 1)ret = ret * x % mod;
        x = x * x % mod;
    }
    return ret;
}
void dfs(int x,int fa){
    size[x] = 1;
    for(int i = head[x];i;i=link[i].next){
        int p = link[i].to;
        if(p == fa)continue;
        dfs(p,x);
        size[x] += size[p];
    }
    int tmp = N - size[x];
    for(int i = head[x];i;i=link[i].next){
        int p = link[i].to;
        if(p == fa)continue;
        ans = (ans + (pw[tmp] - 1)*(pw[size[p]] - 1)%mod)%mod;
        //printf("%lld,tmp = %d\n",ans,tmp);
        tmp += size[p];
    }   
}
int main(){
    scanf("%d",&N);
    pw[0] = 1;
    for(int i = 1;i <= N;i++)pw[i] = pw[i-1] * 2 % mod;
    for(int i = 1;i < N;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        add(x,y);add(y,x);
    }
    ans = 0;
    dfs(1,0);
    ans = ans * qpow(pw[N],mod-2) % mod;
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:33:5: error: reference to 'size' is ambiguous
   33 |     size[x] = 1;
      |     ^~~~
In file included from /usr/include/c++/14/deque:68,
                 from /usr/include/c++/14/queue:62,
                 from a.cc:4:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~
a.cc:38:9: error: reference to 'size' is ambiguous
   38 |         size[x] += size[p];
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~
a.cc:38:20: error: reference to 'size' is ambiguous
   38 |         size[x] += size[p];
      |                    ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~
a.cc:40:19: error: reference to 'size' is ambiguous
   40 |     int tmp = N - size[x];
      |                   ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~
a.cc:44:40: error: reference to 'size' is ambiguous
   44 |         ans = (ans + (pw[tmp] - 1)*(pw[size[p]] - 1)%mod)%mod;
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~
a.cc:46:16: error: reference to 'size' is ambiguous
   46 |         tmp += size[p];
      |                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:15:5: note:                 'int size [200010]'
   15 | int size[SIZEN] = {0};
      |     ^~~~