#include<cstdio>#include<iostream>#include<cstring>#include<math.h>#include<map>#include<algorithm>#include<string>#include<set>#include<vector>typedeflonglong LL;
const LL N = 200000 + 5;
#define INF 10000000#define min(a , b) ((a) < (b) ? (a) : (b))#define lowbit(x) x&-xusingnamespacestd;
typedeflonglong ll;
constint maxn = int(2e5) + 7;
ll k[maxn], sum[maxn], dmg;
LL a[maxn], ans;
vector<int>v[N];
void dfs(int t) {
a[t] = 1;
if (v[t].size() != 2)ans = 0;
for (int i = 0; i < v[t].size(); i++) {
if (!a[v[t][i]])dfs(v[t][i]);
}
}
int main() {//Test five
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
memset(a, 0, sizeof(a));
int s, e;
for (int i = 0; i < m; i++) {
cin >> s >> e;
v[s].push_back(e);
v[e].push_back(s);
}
int t = 0;
for (int i = 0; i < n; i++) {
if (!a[i]) {
ans = 1;
dfs(i);
if (ans)t++;
}
}
cout << t << endl;
}
Wellcome to my csdn, Thank you !This is CoderForces 479 div3.Wellcome to my csdn, Thank you !This is CoderForces 479 div3.The first one “Wrong Subtraction”The second one “Two-gram”The third ...