#include using namespace std; #define F first #define S second #define R cin>> #define Z class #define ll long long #define ln cout<<'\n' #define in(a) insert(a) #define pb(a) push_back(a) #define pd(a) printf("%.10f\n",a) #define mem(a) memset(a,0,sizeof(a)) #define all(c) (c).begin(),(c).end() #define iter(c) __typeof((c).begin()) #define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--) #define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++) #define rep(i,n) REP(i,0,n) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) templatevoid pr(A a){cout<void pr(A a,B b){cout<void pr(A a,B b,C c){cout<void pr(A a,B b,C c,D d){cout<void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<=0&&x=0&&y P; ll e[200001],r[200001]; void init(){rep(i,200001)e[i]=i,r[i]=0;} int find(int x){return (e[x]==x)?x:(e[x]=find(e[x]));} void unite(int x,int y) { x=find(x),y=find(y); if(x==y)return; if(r[x] v[100001]; ll c[100001],nn; int solve(int i,int p) { if(v[i].size()==1&&v[i][0].F==p) { v[i][0].S=nn-c[i]; return c[i]; } int q=0,k=-1; for(int j=0; j=0;i--){ if(par[a][i]!=par[b][i]) a=par[a][i],b=par[b][i]; } return par[a][0]; } void init2() { memset(par,0,sizeof(par));mem(u); rep(i,n)if(!u[i])dfs(i,-1,0); for(int i=0; i<18; i++)for(int j=0; j> n >> m >> T; vector

g; rep(i,m) { ll x,y; cin >> x >> y; x--,y--; v[x].pb(P(y,-1)); v[y].pb(P(x,-1)); unite(x,y); } rep(i,T) { ll x,y; cin >> x >> y; x--,y--; if(!same(x,y)) { c[x]++; c[y]++; } else g.pb(P(x,y)); } ll ans=0; rep(i,n) { if(!u[i]) { P p=dfs(i); nn=p.F; p.S-=nn; solve(i,-1); M=MAXL; calc(i,-1,p.S); ans+=M; } } init2(); rep(i,g.size()) ans+=D(g[i].F,g[i].S); pr(ans); } int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}