/in/foo.cc: In function 'void add(int)':
/in/foo.cc:107:36: error: 'g' was not declared in this scope
set<int>::iterator it=s.insert(g->id[x]).first,it2=it;
^
/in/foo.cc:112:5: error: 'it2' was not declared in this scope
it2++;
^~~
/in/foo.cc:123:19: error: 'v' was not declared in this scope
ans-=g->dis(u,v);
^
/in/foo.cc: In function 'void del(int)':
/in/foo.cc:128:34: error: 'g' was not declared in this scope
set<int>::iterator it=s.find(g->id[x]),it2=it;
^
/in/foo.cc:134:5: error: 'it2' was not declared in this scope
it2++;
^~~
/in/foo.cc:147:19: error: 'v' was not declared in this scope
ans+=g->dis(u,v);
^
/in/foo.cc: In function 'int main()':
/in/foo.cc:171:43: error: request for member 'dfn' in 'g', which is of pointer type 'graph*' (maybe you meant to use '->' ?)
else printf("%lld\n",ans+g->dis(g.dfn[*s.begin()],g.dfn[*s.rbegin()]));
^~~
/in/foo.cc:171:61: error: request for member 'dfn' in 'g', which is of pointer type 'graph*' (maybe you meant to use '->' ?)
else printf("%lld\n",ans+g->dis(g.dfn[*s.begin()],g.dfn[*s.rbegin()]));
^~~