/in/foo.cc:6:1: error: expected initializer before 'long'
long long ans=0;
^~~~
/in/foo.cc: In function 'void init()':
/in/foo.cc:27:3: error: 'ans' was not declared in this scope
ans+=a[i].w;
^~~
/in/foo.cc:31:3: error: 'cnt' was not declared in this scope
cnt[i]=1;f[i]=i;
^~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:47:4: error: 'ans' was not declared in this scope
ans+=(cnt[s]*cnt[t]-1)*(a[i].w+1) ;
^~~
/in/foo.cc:47:10: error: 'cnt' was not declared in this scope
ans+=(cnt[s]*cnt[t]-1)*(a[i].w+1) ;
^~~
/in/foo.cc:52:10: error: 'ans' was not declared in this scope
cout<<ans<<endl;
^~~