output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include<bits/stdc++.h> using namespace std; int main() { int n,k,count=0; cin>>n>>k; map<int,int> mp; for(int i=1;i<=k;i++ ) { int d; cin>>d; for(int j=1;j<=d;j++) { int x; cin>>x; mp[x]++; } } for(int i=1;i<=n;i++) if(mp[i]==0) count++; cout<<count; }
### Prompt Please create a solution in cpp to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,count=0; cin>>n>>k; map<int,int> mp; for(int i=1;i<=k;i++ ) { int d; cin>>d; for(int j=1;j<=d;j++) { int x; cin>>x; mp[x]++; } } for(int i=1;i<=n;i++) if(mp[i]==0) count++; cout<<count; } ```
#include <bits/stdc++.h> using namespace std; bool a[101]; int main(){ int n,k,x,y; cin>>n>>k; for(int i=1;i<=k;i++){ cin>>x; for(int i=1;i<=x;i++){ cin>>y; a[y]=true; } } x=0; for(int i=1;i<=n;i++) if(!a[i]) x++; cout<<x; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; bool a[101]; int main(){ int n,k,x,y; cin>>n>>k; for(int i=1;i<=k;i++){ cin>>x; for(int i=1;i<=x;i++){ cin>>y; a[y]=true; } } x=0; for(int i=1;i<=n;i++) if(!a[i]) x++; cout<<x; return 0; } ```
#include <iostream> #include <set> using namespace std; int main() { int N, K; cin>>N>>K; set<int> S; while(--K >= 0) { int d; cin>>d; for(int i = 0; i < d; i++) { int v; cin>>v; S.insert(v); } } cout << N - S.size() << endl; return 0; }
### Prompt Develop a solution in cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <set> using namespace std; int main() { int N, K; cin>>N>>K; set<int> S; while(--K >= 0) { int d; cin>>d; for(int i = 0; i < d; i++) { int v; cin>>v; S.insert(v); } } cout << N - S.size() << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { int sum=0,d,x,i; int n,k,arr[456]={0}; scanf("%d%d",&n,&k); while(k--) { scanf("%d",&x); for(i=0;i<x;i++) { scanf("%d",&d); arr[d]=1; } } for(i=1;i<=n;i++) { if(arr[i]==0) sum++; } printf("%d",sum); }
### Prompt Your task is to create a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int sum=0,d,x,i; int n,k,arr[456]={0}; scanf("%d%d",&n,&k); while(k--) { scanf("%d",&x); for(i=0;i<x;i++) { scanf("%d",&d); arr[d]=1; } } for(i=1;i<=n;i++) { if(arr[i]==0) sum++; } printf("%d",sum); } ```
#include <bits/stdc++.h> using namespace std; int main () { int a,b,k,x; cin>>a>>b; set <int> s; while (b--){ cin>>k; while(k--){ cin>>x; s.insert(x); } } cout<<a-s.size(); return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main () { int a,b,k,x; cin>>a>>b; set <int> s; while (b--){ cin>>k; while(k--){ cin>>x; s.insert(x); } } cout<<a-s.size(); return 0; } ```
#include<iostream> using namespace std; int a[101],n,k,ans; int main(){ cin>>n>>k; int ff,m; for(int i=0;i<k;i++){ cin>>ff; for(int j=0;j<ff;j++){ cin>>m; a[m]++; } } for(int i=1;i<=n;i++){ if(a[i]==0){ ans++; } } cout<<ans<<endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int a[101],n,k,ans; int main(){ cin>>n>>k; int ff,m; for(int i=0;i<k;i++){ cin>>ff; for(int j=0;j<ff;j++){ cin>>m; a[m]++; } } for(int i=1;i<=n;i++){ if(a[i]==0){ ans++; } } cout<<ans<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; set<int> s; while(m--){ int d; cin>>d; while(d--){ int x; cin>>x; s.insert(x); } } cout<<n-s.size()<<endl; }
### Prompt Create a solution in cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; set<int> s; while(m--){ int d; cin>>d; while(d--){ int x; cin>>x; s.insert(x); } } cout<<n-s.size()<<endl; } ```
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,i,e,f,g,n,m,k,l,fix[200005]; string s; int main() { cin>>n>>m; for(long long i=1;i<=m;i++) { cin>>a; while(a--){ cin>>b; if(fix[b]==0) l++; fix[b]=1; } } cout<<n-l; }
### Prompt Please formulate a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; long long a,b,c,d,i,e,f,g,n,m,k,l,fix[200005]; string s; int main() { cin>>n>>m; for(long long i=1;i<=m;i++) { cin>>a; while(a--){ cin>>b; if(fix[b]==0) l++; fix[b]=1; } } cout<<n-l; } ```
#include <iostream> #include <cstdio> using namespace std; int n, k, d, x, ans, v[105]; int main() { cin >> n >> k; while(k--) { cin >> d; while(d--) cin >> x, v[x] = 1; } for(int i=1; i<=n; i++) ans += !v[i]; cout << ans; return 0; }
### Prompt Your task is to create a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <cstdio> using namespace std; int n, k, d, x, ans, v[105]; int main() { cin >> n >> k; while(k--) { cin >> d; while(d--) cin >> x, v[x] = 1; } for(int i=1; i<=n; i++) ans += !v[i]; cout << ans; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; set<int> s; for(int i = 0; i < k; i++){ int sz; cin >> sz; for(int j = 0; j < sz; j++){ int x; cin >> x; s.insert(x); } } cout << n - s.size() << endl; return 0; }
### Prompt Please create a solution in cpp to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; set<int> s; for(int i = 0; i < k; i++){ int sz; cin >> sz; for(int j = 0; j < sz; j++){ int x; cin >> x; s.insert(x); } } cout << n - s.size() << endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; unordered_set<int> m; int main() { int n,k; cin >> n >> k; while(k--) { int d; cin >> d; while(d--) { int t; cin >> t; m.insert(t); } } cout << n - (int)m.size() << "\n"; return 0; }
### Prompt Generate a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; unordered_set<int> m; int main() { int n,k; cin >> n >> k; while(k--) { int d; cin >> d; while(d--) { int t; cin >> t; m.insert(t); } } cout << n - (int)m.size() << "\n"; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; set<int>s; while(k--){ int d,x; cin>>d; for(int i=0;i<d;i++) cin>>x,s.insert(x); } cout<<n-s.size()<<endl; return 0; }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; set<int>s; while(k--){ int d,x; cin>>d; for(int i=0;i<d;i++) cin>>x,s.insert(x); } cout<<n-s.size()<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; vector<int> v(n); for(int i=0; i<k; ++i){ int d; cin >> d; for(int j=0; j<d; ++j){ int a; cin >> a; --a; ++v[a]; } } cout << count(v.begin(),v.end(),0) << endl; }
### Prompt Your task is to create a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; vector<int> v(n); for(int i=0; i<k; ++i){ int d; cin >> d; for(int j=0; j<d; ++j){ int a; cin >> a; --a; ++v[a]; } } cout << count(v.begin(),v.end(),0) << endl; } ```
#include<iostream> using namespace std; int main(){ int n,k,a[105],i,j,count=0,d,c; cin>>n>>k; for(i=0;i<=n;i++) a[i]=0; for(i=0;i<k;i++) { cin>>d; for(j=0;j<d;j++) { cin>>c; a[c]=1; } } for(i=1;i<=n;i++) { if(a[i]==0) count++; } cout<<count; return 0; }
### Prompt Generate a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int main(){ int n,k,a[105],i,j,count=0,d,c; cin>>n>>k; for(i=0;i<=n;i++) a[i]=0; for(i=0;i<k;i++) { cin>>d; for(j=0;j<d;j++) { cin>>c; a[c]=1; } } for(i=1;i<=n;i++) { if(a[i]==0) count++; } cout<<count; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,a,d,c=0; cin>>n>>k; vector<int> f(n); for(i=0;i<k;i++){ cin>>d; for(j=0;j<d;j++){ cin>>a; f.at(a-1)=1; } } for(i=0;i<n;i++) if(f.at(i)==0) c++; cout<<c<<endl; }
### Prompt Please create a solution in Cpp to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,a,d,c=0; cin>>n>>k; vector<int> f(n); for(i=0;i<k;i++){ cin>>d; for(j=0;j<d;j++){ cin>>a; f.at(a-1)=1; } } for(i=0;i<n;i++) if(f.at(i)==0) c++; cout<<c<<endl; } ```
#include<bits/stdc++.h> typedef long long ll; using namespace std; ll a[1000006],n,k,i,j,d,x,res=0; int main() { cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>x; a[x]++; } } for(j=1;j<=n;j++) { if(a[j]==0)res++; } cout<<res; }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> typedef long long ll; using namespace std; ll a[1000006],n,k,i,j,d,x,res=0; int main() { cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>x; a[x]++; } } for(j=1;j<=n;j++) { if(a[j]==0)res++; } cout<<res; } ```
#include<stdio.h> #define ll long long ll n,k,i,d,j,tmp,c; bool ok[102]; int main() { scanf("%lld%lld",&n,&k); for (i=1;i<=k;++i) { scanf("%lld",&d); for (j=1;j<=d;++j) { scanf("%lld",&tmp); ok[tmp]=1; } } for (i=1;i<=n;++i) if (!ok[i]) ++c; printf("%lld",c); }
### Prompt Create a solution in Cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<stdio.h> #define ll long long ll n,k,i,d,j,tmp,c; bool ok[102]; int main() { scanf("%lld%lld",&n,&k); for (i=1;i<=k;++i) { scanf("%lld",&d); for (j=1;j<=d;++j) { scanf("%lld",&tmp); ok[tmp]=1; } } for (i=1;i<=n;++i) if (!ok[i]) ++c; printf("%lld",c); } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; set<int> ans; for(int i=0;i<k;i++) { int kk; cin>>kk; for(int ii=0;ii<kk;ii++) { int temp; cin>>temp; ans.insert(temp); } } cout<<n-ans.size()<<"\n"; }
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; set<int> ans; for(int i=0;i<k;i++) { int kk; cin>>kk; for(int ii=0;ii<kk;ii++) { int temp; cin>>temp; ans.insert(temp); } } cout<<n-ans.size()<<"\n"; } ```
#include <bits/stdc++.h> using namespace std; int n,k,d,ans; set<int>a; int main(){ cin>>n>>k; int x; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>x; a.insert(x); } } cout<<n-a.size(); return 0; }
### Prompt Develop a solution in CPP to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,k,d,ans; set<int>a; int main(){ cin>>n>>k; int x; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>x; a.insert(x); } } cout<<n-a.size(); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int N, K, d, i; set<int> A; cin >> N >> K; while (K>0) { K--; cin >> d; while (d>0) { d--; cin >> i; A.insert(i); } } cout << N - A.size() << endl; }
### Prompt Please formulate a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int N, K, d, i; set<int> A; cin >> N >> K; while (K>0) { K--; cin >> d; while (d>0) { d--; cin >> i; A.insert(i); } } cout << N - A.size() << endl; } ```
#include <stdio.h> int n, m, i, j, k, f[105]; int main(){ scanf("%d%d", &n, &m); for(i=1; i<=m; i++){ scanf("%d", &k); while(k--){ scanf("%d", &j); if(++f[j] == 1) n--; } } printf("%d\n", n); return 0; }
### Prompt Develop a solution in CPP to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <stdio.h> int n, m, i, j, k, f[105]; int main(){ scanf("%d%d", &n, &m); for(i=1; i<=m; i++){ scanf("%d", &k); while(k--){ scanf("%d", &j); if(++f[j] == 1) n--; } } printf("%d\n", n); return 0; } ```
#include<bits/stdc++.h> using namespace std; set<int> st; int main(){ int n,k; cin>>n>>k; for(int i=1;i<=k;i++){ int x; cin>>x; while(x--){ int y; cin>>y; st.insert(y); } } cout<<n-st.size()<<endl; return 0; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; set<int> st; int main(){ int n,k; cin>>n>>k; for(int i=1;i<=k;i++){ int x; cin>>x; while(x--){ int y; cin>>y; st.insert(y); } } cout<<n-st.size()<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; set<int> s; for(int i=0; i<k;i++){ int t; cin >> t; for(int j=0;j<t;j++){ int y; cin >>y; s.insert(y); } } cout << n-s.size() <<endl; }
### Prompt Develop a solution in cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; set<int> s; for(int i=0; i<k;i++){ int t; cin >> t; for(int j=0;j<t;j++){ int y; cin >>y; s.insert(y); } } cout << n-s.size() <<endl; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,d,a; cin>>n>>k; int ans=0,maxi=0; set<int> myset; while(k--) { cin>>d; while(d--) { cin>>a; myset.insert(a); } } int m=myset.size(); cout<<n-m<<endl; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,d,a; cin>>n>>k; int ans=0,maxi=0; set<int> myset; while(k--) { cin>>d; while(d--) { cin>>a; myset.insert(a); } } int m=myset.size(); cout<<n-m<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; const int INF=999999999; char a[10][10]; int main() { int N,K; cin>>N>>K; set<int>k; int d; while(cin>>d){ for(int i=0;i<d;i++){ int A; cin>>A; k.insert(A); } } cout<<N-k.size()<<endl; return 0;}
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; const int INF=999999999; char a[10][10]; int main() { int N,K; cin>>N>>K; set<int>k; int d; while(cin>>d){ for(int i=0;i<d;i++){ int A; cin>>A; k.insert(A); } } cout<<N-k.size()<<endl; return 0;} ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; set<int> s; for(int i = 0; i < k; i++){ int k; cin >> k; for(int j = 0; j < k; j++){ int x; cin >> x; s.insert(x); } } cout << n-s.size(); }
### Prompt Please create a solution in CPP to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; set<int> s; for(int i = 0; i < k; i++){ int k; cin >> k; for(int j = 0; j < k; j++){ int x; cin >> x; s.insert(x); } } cout << n-s.size(); } ```
#include<iostream> using namespace std; int main(){ int j,i,ans=0,N,K,d,temp; bool A[101]={0}; cin>>N>>K; for(i=0;i<K;i++){ cin>>d; for(j=0;j<d;j++){ cin>>temp; A[temp-1]=1; } } for(i=0;i<N;i++) ans+=A[i]; cout<<N-ans<<endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int main(){ int j,i,ans=0,N,K,d,temp; bool A[101]={0}; cin>>N>>K; for(i=0;i<K;i++){ cin>>d; for(j=0;j<d;j++){ cin>>temp; A[temp-1]=1; } } for(i=0;i<N;i++) ans+=A[i]; cout<<N-ans<<endl; } ```
#include<bits/stdc++.h> using namespace std; set<int>cnt; int main() { int n,k; cin>>n>>k; for(int i=0;i<k;i++) { int d; cin>>d; for(int j=0;j<d;j++) { int a; cin>>a; cnt.insert(a); } } cout<<n-cnt.size(); return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; set<int>cnt; int main() { int n,k; cin>>n>>k; for(int i=0;i<k;i++) { int d; cin>>d; for(int j=0;j<d;j++) { int a; cin>>a; cnt.insert(a); } } cout<<n-cnt.size(); return 0; } ```
#include<bits/stdc++.h> using namespace std; int n,k,a[110],x,y,ans; int main(){ cin>>n>>k; for (int i=0;i<k;i++){ cin>>x; for (int j=0;j<x;j++){ cin>>y; a[y]=1; } } for (int i=1;i<=n;i++) if (a[i]==0) ans++; cout<<ans<<endl; return 0; }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k,a[110],x,y,ans; int main(){ cin>>n>>k; for (int i=0;i<k;i++){ cin>>x; for (int j=0;j<x;j++){ cin>>y; a[y]=1; } } for (int i=1;i<=n;i++) if (a[i]==0) ans++; cout<<ans<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int n,d,x,vis[101]; int main() { scanf("%d%d",&n,&d); for (int i = 1;i <= d;i++) { int x,y; scanf("%d",&x); for (;x--;) { scanf("%d",&y); if (vis[y] == 0) n--,vis[y] = 1; } } printf("%d",n); return 0; }
### Prompt Create a solution in CPP for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,d,x,vis[101]; int main() { scanf("%d%d",&n,&d); for (int i = 1;i <= d;i++) { int x,y; scanf("%d",&x); for (;x--;) { scanf("%d",&y); if (vis[y] == 0) n--,vis[y] = 1; } } printf("%d",n); return 0; } ```
#include <bits/stdc++.h> using namespace std; int n,k,r[105]={0},c1,c2,ans=0; int main(){ cin>>n>>k; for(int i=1;i<=k;i++){ cin>>c1; for(int j=1;j<=c1;j++){ cin>>c2; r[c2]=1; } } for(int i=1;i<=n;i++){ if(r[i]==0){ ans++; } } cout<<ans; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int n,k,r[105]={0},c1,c2,ans=0; int main(){ cin>>n>>k; for(int i=1;i<=k;i++){ cin>>c1; for(int j=1;j<=c1;j++){ cin>>c2; r[c2]=1; } } for(int i=1;i<=n;i++){ if(r[i]==0){ ans++; } } cout<<ans; } ```
#include <iostream> #include <string> #include <set> using namespace std; int main() { int n; int k; cin>>n>>k; set<int>Q; int d,e; for(int i=0;i<k;i++) { cin>>d; for(int j=0;j<d;j++) {cin>>e;Q.insert(e);} } cout <<n-Q.size(); }
### Prompt Your task is to create a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <string> #include <set> using namespace std; int main() { int n; int k; cin>>n>>k; set<int>Q; int d,e; for(int i=0;i<k;i++) { cin>>d; for(int j=0;j<d;j++) {cin>>e;Q.insert(e);} } cout <<n-Q.size(); } ```
#include "bits/stdc++.h" using namespace std; const int N=1e3+20; int n,k,d,x,ans,f[N]; int main() { cin>>n>>k; while(k--) { cin>>d; while(d--) cin>>x,f[x]++; } for(int i=1;i<=n;i++) if(f[i]==0) ans++; cout<<ans; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include "bits/stdc++.h" using namespace std; const int N=1e3+20; int n,k,d,x,ans,f[N]; int main() { cin>>n>>k; while(k--) { cin>>d; while(d--) cin>>x,f[x]++; } for(int i=1;i<=n;i++) if(f[i]==0) ans++; cout<<ans; } ```
#include<bits/stdc++.h> using namespace std; int n,k; int d,a; set<int> s; int main() { cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>a; s.insert(a); } } int c=s.size(); cout<<n-c; return 0; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k; int d,a; set<int> s; int main() { cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>a; s.insert(a); } } int c=s.size(); cout<<n-c; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >>n >>k; vector<int>v(n,1); int sum=0; for(int i=0; i<k; i++) { int t; cin >>t; for(int j=0; j<t; j++) {int s; cin >>s; v[s-1]=0;} } for(int i=0; i<n; i++) sum+=v[i]; cout <<sum; return 0;}
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >>n >>k; vector<int>v(n,1); int sum=0; for(int i=0; i<k; i++) { int t; cin >>t; for(int j=0; j<t; j++) {int s; cin >>s; v[s-1]=0;} } for(int i=0; i<n; i++) sum+=v[i]; cout <<sum; return 0;} ```
#include<bits/stdc++.h> int a[105]; using namespace std; int main() { int n,k,d,temp,ans=0; cin>>n>>k; for (int i=0;i<k;i++) { cin>>d; for (int i=0;i<d;i++) { cin>>temp; a[temp]++; } } for (int i=1;i<=n;i++) { if (!a[i]) ans++; } cout<<ans; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> int a[105]; using namespace std; int main() { int n,k,d,temp,ans=0; cin>>n>>k; for (int i=0;i<k;i++) { cin>>d; for (int i=0;i<d;i++) { cin>>temp; a[temp]++; } } for (int i=1;i<=n;i++) { if (!a[i]) ans++; } cout<<ans; return 0; } ```
#include<iostream> using namespace std; const int N=1e3+10; int a[N],n,k; int main(){ cin>>n>>k; for(int i=0;i<k;i++){ int x; cin>>x; for(int j=0;j<x;j++){ int f; cin>>f; a[f]=1; } } int s=0; for(int i=1;i<=n;i++) s+=(!a[i]); cout<<s; return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; const int N=1e3+10; int a[N],n,k; int main(){ cin>>n>>k; for(int i=0;i<k;i++){ int x; cin>>x; for(int j=0;j<x;j++){ int f; cin>>f; a[f]=1; } } int s=0; for(int i=1;i<=n;i++) s+=(!a[i]); cout<<s; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,d,x; set<int>s; cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>x; s.insert(x); } } cout<<n-s.size(); }
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,k,d,x; set<int>s; cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>x; s.insert(x); } } cout<<n-s.size(); } ```
#include<bits/stdc++.h> using namespace std; int main(){ int i,j,k,l,m,n,o,p,q; while(cin>>p>>q){ int x[10000]={0}; while(q--){ cin>>m; for(i=0;i<m;i++){cin>>n; x[n]++; } } m=0; for(i=1;i<=p;i++)if(x[i]==0)m++; cout<<m<<endl; } return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int i,j,k,l,m,n,o,p,q; while(cin>>p>>q){ int x[10000]={0}; while(q--){ cin>>m; for(i=0;i<m;i++){cin>>n; x[n]++; } } m=0; for(i=1;i<=p;i++)if(x[i]==0)m++; cout<<m<<endl; } return 0; } ```
#include <iostream> #include <set> using namespace std; int main() { int n, k; cin >> n >> k; set<int> st; for (int i = 0; i < k; ++i) { int d; cin >> d; for (int j = 0; j < d; ++j) { int a; cin >> a; st.insert(a); } } cout << n - st.size() << endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <set> using namespace std; int main() { int n, k; cin >> n >> k; set<int> st; for (int i = 0; i < k; ++i) { int d; cin >> d; for (int j = 0; j < d; ++j) { int a; cin >> a; st.insert(a); } } cout << n - st.size() << endl; return 0; } ```
#include <cstdio> int main() { int N,K,C[101]={0,}; scanf ("%d %d",&N,&K); for (int k=0;k<K;k++){ int d; scanf ("%d",&d); while (d--){ int x; scanf ("%d",&x); C[x]++; } } int a = 0; for (int i=1;i<=N;i++) if (!C[i]) a++; printf ("%d\n",a); return 0; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <cstdio> int main() { int N,K,C[101]={0,}; scanf ("%d %d",&N,&K); for (int k=0;k<K;k++){ int d; scanf ("%d",&d); while (d--){ int x; scanf ("%d",&x); C[x]++; } } int a = 0; for (int i=1;i<=N;i++) if (!C[i]) a++; printf ("%d\n",a); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; set<int> s; for(int i=0; i<k; ++i){ int d; cin >> d; for(int j=0; j<d; ++j){ int a; cin >> a; s.insert(a); } } cout << n-(int)s.size() << endl; return 0; }
### Prompt In CPP, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n >> k; set<int> s; for(int i=0; i<k; ++i){ int d; cin >> d; for(int j=0; j<d; ++j){ int a; cin >> a; s.insert(a); } } cout << n-(int)s.size() << endl; return 0; } ```
#include <stdio.h> #include <set> int n, k; std::set<int> x; int main() { scanf("%d%d", &n, &k); while (k--) { int d; scanf("%d", &d); while (d--) { int a; scanf("%d", &a); x.insert(a); } } printf("%d\n", n - x.size()); return 0; }
### Prompt Your challenge is to write a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <stdio.h> #include <set> int n, k; std::set<int> x; int main() { scanf("%d%d", &n, &k); while (k--) { int d; scanf("%d", &d); while (d--) { int a; scanf("%d", &a); x.insert(a); } } printf("%d\n", n - x.size()); return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; int d; set<int> s; for(int i=0;i<m;i++){ cin>>d; for(int i =0;i<d;i++){ int A; cin>>A; s.insert(A); } } cout<<n-s.size()<<endl; }
### Prompt Construct a CPP code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; int d; set<int> s; for(int i=0;i<m;i++){ cin>>d; for(int i =0;i<d;i++){ int A; cin>>A; s.insert(A); } } cout<<n-s.size()<<endl; } ```
#include <iostream> #include <cstdio> using namespace std; int n, k, d, a, ans, v[105]; int main() { cin >> n >> k; ans = n; while(k--) { cin >> d; while(d--) { cin >> a; if(!v[a]) v[a] = 1, ans--; } } cout << ans; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <cstdio> using namespace std; int n, k, d, a, ans, v[105]; int main() { cin >> n >> k; ans = n; while(k--) { cin >> d; while(d--) { cin >> a; if(!v[a]) v[a] = 1, ans--; } } cout << ans; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(void) { int a[105],n,k,d,b,i; cin>>n>>k; memset(a,0,sizeof(a)); while(k--) { cin>>d; for(i=1;i<=d;i++) { cin>>b; a[b]++; } } int ans=0; for(i=1;i<=n;i++) if(a[i]==0)ans++; cout<<ans; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(void) { int a[105],n,k,d,b,i; cin>>n>>k; memset(a,0,sizeof(a)); while(k--) { cin>>d; for(i=1;i<=d;i++) { cin>>b; a[b]++; } } int ans=0; for(i=1;i<=n;i++) if(a[i]==0)ans++; cout<<ans; return 0; } ```
#include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { // your code goes here int n,a,k; cin>>n>>k; int d[k]; set<int >s; for(int i=0;i<k;i++){ cin>>d[i]; for(int j=0;j<d[i];j++){ cin>>a; s.insert(a); } } cout<<n-s.size()<<endl; return 0; }
### Prompt Construct a Cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { // your code goes here int n,a,k; cin>>n>>k; int d[k]; set<int >s; for(int i=0;i<k;i++){ cin>>d[i]; for(int j=0;j<d[i];j++){ cin>>a; s.insert(a); } } cout<<n-s.size()<<endl; return 0; } ```
#include <iostream> using namespace std; int f[1005]; int main(){ int n,m,sum=0; cin>>n>>m; for(int i=1;i<=m;i++){ int k; cin>>k; for(int j=1;j<=k;j++){ int t; cin>>t; f[t]++; } } for(int i=1;i<=n;i++){ if(!f[i]) sum++; } cout<<sum; }
### Prompt Create a solution in Cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> using namespace std; int f[1005]; int main(){ int n,m,sum=0; cin>>n>>m; for(int i=1;i<=m;i++){ int k; cin>>k; for(int j=1;j<=k;j++){ int t; cin>>t; f[t]++; } } for(int i=1;i<=n;i++){ if(!f[i]) sum++; } cout<<sum; } ```
#include <stdio.h> int n, k, d, e, x; int a[100]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &e); a[e - 1]++; } } for (int i = 0; i < n; i++) { if (!a[i])x++; } printf("%d\n", x); }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <stdio.h> int n, k, d, e, x; int a[100]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &e); a[e - 1]++; } } for (int i = 0; i < n; i++) { if (!a[i])x++; } printf("%d\n", x); } ```
#include<bits/stdc++.h> using namespace std; int d[1001], t, a[1001], n, k, s=0; int main(){ scanf("%d %d", &n, &k); for(int i=1; i<=k; i++){ scanf("%d", &d[i]); for(int j=1; j<=d[i]; j++){ scanf("%d", &t); if(a[t]==0){ a[t]=1; s++; } } } printf("%d", n-s); }
### Prompt Construct a CPP code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int d[1001], t, a[1001], n, k, s=0; int main(){ scanf("%d %d", &n, &k); for(int i=1; i<=k; i++){ scanf("%d", &d[i]); for(int j=1; j<=d[i]; j++){ scanf("%d", &t); if(a[t]==0){ a[t]=1; s++; } } } printf("%d", n-s); } ```
#include<bits/stdc++.h> using namespace std; int n,k,vis[1000003],a,ans,d; int main() { cin>>n>>k; for(int i=1;i<=k;i++) { cin>>d; for(int j=1;j<=d;j++) { cin>>a; vis[a]=1; } } for(int i=1;i<=n;i++) if(vis[i]==0) ans++; cout<<ans; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k,vis[1000003],a,ans,d; int main() { cin>>n>>k; for(int i=1;i<=k;i++) { cin>>d; for(int j=1;j<=d;j++) { cin>>a; vis[a]=1; } } for(int i=1;i<=n;i++) if(vis[i]==0) ans++; cout<<ans; return 0; } ```
#include "bits/stdc++.h" using namespace std; int main() { int N, K; cin >> N >> K; set<int> s; for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int a; cin >> a; s.insert(a); } } cout << N - s.size() << endl; return 0; }
### Prompt Develop a solution in cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include "bits/stdc++.h" using namespace std; int main() { int N, K; cin >> N >> K; set<int> s; for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int a; cin >> a; s.insert(a); } } cout << N - s.size() << endl; return 0; } ```
#include<bits/stdc++.h> //ABC 166_b #define ll long long using namespace std; int a[110],n,k,x,y,ans; int main(){ cin>>n>>k; for(int i=1;i<=k;i++){ cin>>x; for(int j=1;j<=x;j++){ cin>>y; a[y]++; } } for(int i=1;i<=n;i++){ if(a[i]==0) ans++; } cout<<ans; return 0; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> //ABC 166_b #define ll long long using namespace std; int a[110],n,k,x,y,ans; int main(){ cin>>n>>k; for(int i=1;i<=k;i++){ cin>>x; for(int j=1;j<=x;j++){ cin>>y; a[y]++; } } for(int i=1;i<=n;i++){ if(a[i]==0) ans++; } cout<<ans; return 0; } ```
#include<cstdio> int n,k,x,m,ans; bool b[105]; int main() { scanf("%d%d",&n,&k); while(k--) { scanf("%d",&m); for(int i=1;i<=m;++i) { scanf("%d",&x); b[x]=true; } } for(int i=1;i<=n;++i) if(!b[i])++ans; printf("%d",ans); }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<cstdio> int n,k,x,m,ans; bool b[105]; int main() { scanf("%d%d",&n,&k); while(k--) { scanf("%d",&m); for(int i=1;i<=m;++i) { scanf("%d",&x); b[x]=true; } } for(int i=1;i<=n;++i) if(!b[i])++ans; printf("%d",ans); } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,a,d; set<int>s; cin>>n>>k; for(i=0;i<k;i++) { cin>>d; for(j=0;j<d;j++) { cin>>a; s.insert(a); } } cout<<n-s.size()<<endl; }
### Prompt In CPP, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,a,d; set<int>s; cin>>n>>k; for(i=0;i<k;i++) { cin>>d; for(j=0;j<d;j++) { cin>>a; s.insert(a); } } cout<<n-s.size()<<endl; } ```
#include <iostream> #include <vector> using namespace std; int n,k,d,temp; int main(){ cin>>n>>k; vector <int> a(n,1); while(k--){ cin>>d; while(d--){ cin>>temp; a[temp-1]=0; } } int sum=0; for(int i=0;i<n;i++){ sum+=a[i]; } cout<<sum; }
### Prompt Develop a solution in Cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <vector> using namespace std; int n,k,d,temp; int main(){ cin>>n>>k; vector <int> a(n,1); while(k--){ cin>>d; while(d--){ cin>>temp; a[temp-1]=0; } } int sum=0; for(int i=0;i<n;i++){ sum+=a[i]; } cout<<sum; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,d,a,ans[105]={}; cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>a; if(ans[a]==0){ n--; ans[a]++; } } } cout<<n<<endl; return(0); }
### Prompt Please create a solution in CPP to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n,k,d,a,ans[105]={}; cin>>n>>k; for(int i=0;i<k;i++){ cin>>d; for(int j=0;j<d;j++){ cin>>a; if(ans[a]==0){ n--; ans[a]++; } } } cout<<n<<endl; return(0); } ```
#include <iostream> #include <set> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n,k,d,a; cin>>n>>k; set<int> ms; while(k--){ cin>>d; while(d--){ cin>>a; ms.insert(a); } } cout<<n-ms.size()<<endl; return 0; }
### Prompt Construct a CPP code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <iostream> #include <set> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n,k,d,a; cin>>n>>k; set<int> ms; while(k--){ cin>>d; while(d--){ cin>>a; ms.insert(a); } } cout<<n-ms.size()<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; set<int> s; int main(){ int n,k; cin>>n>>k; while(k--){ int a; cin>>a; for(int i = 0 ; i < a; i++){ int l; cin>>l; s.insert(l); } } int ans = n - s.size(); cout<<ans<<endl; }
### Prompt Create a solution in Cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; set<int> s; int main(){ int n,k; cin>>n>>k; while(k--){ int a; cin>>a; for(int i = 0 ; i < a; i++){ int l; cin>>l; s.insert(l); } } int ans = n - s.size(); cout<<ans<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,d,i,j,l,count=0; map<int ,int>m; cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>l; m[l]=1; } } for(i=1;i<=n;i++) { if(m[i]==0)count++; } cout<<count<<endl; return 0; }
### Prompt Develop a solution in cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,d,i,j,l,count=0; map<int ,int>m; cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>l; m[l]=1; } } for(i=1;i<=n;i++) { if(m[i]==0)count++; } cout<<count<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n >> k; int t=n; set<int>s; while(k--){ int d; cin>>d; for(int i =0;i<d;i++){ int h; cin>>h; s.insert(h); } } int j=s.size(); cout<<t-j; return 0; }
### Prompt Create a solution in Cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n >> k; int t=n; set<int>s; while(k--){ int d; cin>>d; for(int i =0;i<d;i++){ int h; cin>>h; s.insert(h); } } int j=s.size(); cout<<t-j; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n,k; cin>>n>>k; set<int>s; while(k--){ int d,g; cin>>d; while(d--){ cin>>g; s.insert(g); } } cout<<n-s.size(); return 0; }
### Prompt Develop a solution in Cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { // your code goes here int n,k; cin>>n>>k; set<int>s; while(k--){ int d,g; cin>>d; while(d--){ cin>>g; s.insert(g); } } cout<<n-s.size(); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin>>n>>k; set<int> s; for (int i=0; i<k; i++) { int d; cin>>d; for (int j=0; j<d; j++) { int ai; cin>>ai; s.insert(ai); } } cout<< n - s.size()<<endl; }
### Prompt Your task is to create a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n, k; cin>>n>>k; set<int> s; for (int i=0; i<k; i++) { int d; cin>>d; for (int j=0; j<d; j++) { int ai; cin>>ai; s.insert(ai); } } cout<< n - s.size()<<endl; } ```
#include<bits/stdc++.h> #include<set> using namespace std; int main(){ int n,k,d,a; cin >> n >> k; set<int> A; for(int i =0;i < k;++i){ cin >> d; for(int j=0;j < d;++j){ cin >>a; A.insert(a); } } cout << n-A.size() << endl; }
### Prompt Please formulate a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> #include<set> using namespace std; int main(){ int n,k,d,a; cin >> n >> k; set<int> A; for(int i =0;i < k;++i){ cin >> d; for(int j=0;j < d;++j){ cin >>a; A.insert(a); } } cout << n-A.size() << endl; } ```
#include<iostream> #include<set> using namespace std; int main(){ int n, k; cin>>n>>k; std::set<int> a; for(int i = 0; i < k; i++){ int d; cin>>d; for(int j = 0; j < d; j++){ int x; cin>>x; a.insert(x); } } cout<<n-a.size(); }
### Prompt Develop a solution in Cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> #include<set> using namespace std; int main(){ int n, k; cin>>n>>k; std::set<int> a; for(int i = 0; i < k; i++){ int d; cin>>d; for(int j = 0; j < d; j++){ int x; cin>>x; a.insert(x); } } cout<<n-a.size(); } ```
#include<iostream> using namespace std; int main(){ int N,K,A,D,cou=0; cin>>N>>K; int H[101]={0}; for(int i=0;i<K;i++){ cin>>D; for(int t=0;t<D;t++){ cin>>A; H[A]++; } } for(int i=1;i<=N;i++){ if(H[i]==0)cou++; } cout<<cou<<endl; }
### Prompt Your challenge is to write a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int main(){ int N,K,A,D,cou=0; cin>>N>>K; int H[101]={0}; for(int i=0;i<K;i++){ cin>>D; for(int t=0;t<D;t++){ cin>>A; H[A]++; } } for(int i=1;i<=N;i++){ if(H[i]==0)cou++; } cout<<cou<<endl; } ```
#include<iostream> using namespace std; int main() { int n, k, cnt=0,d, x, a[1000]={}, i; cin >> n >> k; while(k--) { cin >> d; while(d--) { cin >> x; a[x]+=1; } } for(i=1;i<=n;i++) if(a[i]==0) cnt+=1; cout << cnt << endl; return 0; }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int main() { int n, k, cnt=0,d, x, a[1000]={}, i; cin >> n >> k; while(k--) { cin >> d; while(d--) { cin >> x; a[x]+=1; } } for(i=1;i<=n;i++) if(a[i]==0) cnt+=1; cout << cnt << endl; return 0; } ```
#include<iostream> using namespace std; int main() { int n,m,k,d,pd[105]={0}; cin>>n>>k; for (int i=1;i<=k;i++) { cin>>m; for(int j=1;j<=m;j++) { cin>>d; pd[d] = 1; } } int sum=0; for (int i=1;i<=n;i++) { if (pd[i]==0) sum++; } cout<<sum; }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; int main() { int n,m,k,d,pd[105]={0}; cin>>n>>k; for (int i=1;i<=k;i++) { cin>>m; for(int j=1;j<=m;j++) { cin>>d; pd[d] = 1; } } int sum=0; for (int i=1;i<=n;i++) { if (pd[i]==0) sum++; } cout<<sum; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,s,b; cin>>n; cin>>k; unordered_set<int> a; for(int i=0;i<k;i++) { cin>>s; for(int j=0;j<s;j++){ cin>>b; a.insert(b); } }int c=0; for(auto it:a) { c++; } cout<<n-c; }
### Prompt Create a solution in CPP for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,s,b; cin>>n; cin>>k; unordered_set<int> a; for(int i=0;i<k;i++) { cin>>s; for(int j=0;j<s;j++){ cin>>b; a.insert(b); } }int c=0; for(auto it:a) { c++; } cout<<n-c; } ```
#include<bits/stdc++.h> using namespace std; int n,k,ans; int a[110]; int main() { scanf("%d %d",&n,&k); for(int i=1,d;i<=k;++i){ scanf("%d",&d); while(d--){ int x; scanf("%d",&x); a[x]=1; } } for(int i=1;i<=n;++i){ if(!a[i]) ++ans; } printf("%d\n",ans); }
### Prompt Your task is to create a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k,ans; int a[110]; int main() { scanf("%d %d",&n,&k); for(int i=1,d;i<=k;++i){ scanf("%d",&d); while(d--){ int x; scanf("%d",&x); a[x]=1; } } for(int i=1;i<=n;++i){ if(!a[i]) ++ans; } printf("%d\n",ans); } ```
#include<iostream> #include<set> using namespace std; int N,K,d,A; set<int>S; int main() { cin>>N>>K; for(;K--;) { cin>>d; for(;d--;)cin>>A,S.insert(A); } cout<<N-S.size()<<endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> #include<set> using namespace std; int N,K,d,A; set<int>S; int main() { cin>>N>>K; for(;K--;) { cin>>d; for(;d--;)cin>>A,S.insert(A); } cout<<N-S.size()<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; int d; int X; set<int> S; for(int i = 0; i < K; i++){ cin >> d; for(int j = 0; j < d; j++){ cin >> X; S.insert(X); } } cout << N - S.size() << endl; }
### Prompt In CPP, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; int d; int X; set<int> S; for(int i = 0; i < K; i++){ cin >> d; for(int j = 0; j < d; j++){ cin >> X; S.insert(X); } } cout << N - S.size() << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; map<int,int>mp; for(int i=0;i<m;i++) { int q; cin>>q; for(int k=0;k<q;k++) { int p; cin>>p; mp[p]++; } } int ct=0; for(int i=1;i<=n;i++){if(!mp[i]){ct++;}} cout<<ct; }
### Prompt Create a solution in cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; map<int,int>mp; for(int i=0;i<m;i++) { int q; cin>>q; for(int k=0;k<q;k++) { int p; cin>>p; mp[p]++; } } int ct=0; for(int i=1;i<=n;i++){if(!mp[i]){ct++;}} cout<<ct; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; set<long long int>s; while(m--) { int k; cin>>k; int a[k]; for(int i=0;i<k;i++) { cin>>a[i]; s.insert(a[i]); } } cout<<n-s.size(); }
### Prompt Please create a solution in cpp to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; set<long long int>s; while(m--) { int k; cin>>k; int a[k]; for(int i=0;i<k;i++) { cin>>a[i]; s.insert(a[i]); } } cout<<n-s.size(); } ```
#include<bits/stdc++.h> using namespace std; int n, k, d, a, cnt; bool ada[105]; int main(){ cin>>n>>k; for(int i=1; i<=k; i++){ cin>>d; for(int j=1; j<=d; j++){ cin>>a; ada[a]=true; } } for(int j=1; j<=n; j++){ if(ada[j]==false)cnt++; } cout<<cnt<<endl; }
### Prompt Construct a cpp code solution to the problem outlined: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n, k, d, a, cnt; bool ada[105]; int main(){ cin>>n>>k; for(int i=1; i<=k; i++){ cin>>d; for(int j=1; j<=d; j++){ cin>>a; ada[a]=true; } } for(int j=1; j<=n; j++){ if(ada[j]==false)cnt++; } cout<<cnt<<endl; } ```
#include<bits/stdc++.h> using namespace std; long long n,k,i,o,ans,m,i2; bool a[10000009]; int main() { cin>>n>>k; for(i=1;i<=k;i++) { cin>>m; for(i2=1;i2<=m;i2++) { cin>>o; a[o]=true; } } for(i=1;i<=n;i++) { if(a[i]==false) ans++; } cout<<ans; }
### Prompt Please formulate a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; long long n,k,i,o,ans,m,i2; bool a[10000009]; int main() { cin>>n>>k; for(i=1;i<=k;i++) { cin>>m; for(i2=1;i2<=m;i2++) { cin>>o; a[o]=true; } } for(i=1;i<=n;i++) { if(a[i]==false) ans++; } cout<<ans; } ```
#include <bits/stdc++.h> using namespace std; int main() {int N, K; cin >> N >> K; vector<int> cs(N, 1); while (K--) {int d; cin >> d; for (int i = 0; i < d; ++i) {int A; cin >> A; cs[A - 1] = 0;}} cout << accumulate(cs.begin(), cs.end(), 0) << endl;}
### Prompt Create a solution in cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() {int N, K; cin >> N >> K; vector<int> cs(N, 1); while (K--) {int d; cin >> d; for (int i = 0; i < d; ++i) {int A; cin >> A; cs[A - 1] = 0;}} cout << accumulate(cs.begin(), cs.end(), 0) << endl;} ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; set<int> st; for(int i=0;i<k;i++) { int s; cin>>s; for(int i=0;i<s;i++) { int a; cin>>a; st.insert(a); } } cout<<n-st.size(); return 0; }
### Prompt Create a solution in CPP for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; set<int> st; for(int i=0;i<k;i++) { int s; cin>>s; for(int i=0;i<s;i++) { int a; cin>>a; st.insert(a); } } cout<<n-st.size(); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ int n,k,i,x,y; cin>>n>>k; set<int> s; while(k--) { cin>>x; while(x--){ cin>>y; s.insert(y); } } cout<<n-s.size()<<endl; return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int n,k,i,x,y; cin>>n>>k; set<int> s; while(k--) { cin>>x; while(x--){ cin>>y; s.insert(y); } } cout<<n-s.size()<<endl; return 0; } ```
#include <cstdio> #include <algorithm> using namespace std; int n,m,s,ok[105]; int main(void){ scanf("%d %d",&n,&m); for(int i=1;i<=m;i++){ int d; scanf("%d",&d); for(int j=1;j<=d;j++){ int a; scanf("%d",&a); if(ok[a]==0)s++; ok[a]=1; } } printf("%d\n",n-s); }
### Prompt Please create a solution in cpp to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <cstdio> #include <algorithm> using namespace std; int n,m,s,ok[105]; int main(void){ scanf("%d %d",&n,&m); for(int i=1;i<=m;i++){ int d; scanf("%d",&d); for(int j=1;j<=d;j++){ int a; scanf("%d",&a); if(ok[a]==0)s++; ok[a]=1; } } printf("%d\n",n-s); } ```
#include<bits/stdc++.h> using namespace std; int main() { int N, K, d, A, ans = 0; cin >> N >> K; set<int> S; while (K--) { cin >> d; while (d--) { cin >> A; S.insert(A); } } cout << N - S.size() << endl; }
### Prompt In CPP, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int N, K, d, A, ans = 0; cin >> N >> K; set<int> S; while (K--) { cin >> d; while (d--) { cin >> A; S.insert(A); } } cout << N - S.size() << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { int N,K,di,A; cin >> N >> K; map<int,int> count; for(int i=0;i<K;i++){ cin>>di; for(int j=0;j<di;j++){ cin >> A; count[A]++; } } cout << N-count.size() << endl; }
### Prompt Please create a solution in CPP to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int N,K,di,A; cin >> N >> K; map<int,int> count; for(int i=0;i<K;i++){ cin>>di; for(int j=0;j<di;j++){ cin >> A; count[A]++; } } cout << N-count.size() << endl; } ```
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { set <int> s; int n,k,i,j,a,b; cin>>n>>k; for(i=0;i<k;i++) { cin>>a; for(j=0;j<a;j++) { cin>>b; s.insert(b); } } cout<<n-s.size(); }
### Prompt Please provide a CPP coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define ll long long int main() { set <int> s; int n,k,i,j,a,b; cin>>n>>k; for(i=0;i<k;i++) { cin>>a; for(j=0;j<a;j++) { cin>>b; s.insert(b); } } cout<<n-s.size(); } ```
#include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; set<int> snuke; for(int i = 0, d; i < k; ++i){ cin >> d; for(int j = 0, temp; j < d; ++j){ cin >> temp; snuke.insert(temp); } } cout << n - snuke.size() << endl; }
### Prompt Please formulate a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; set<int> snuke; for(int i = 0, d; i < k; ++i){ cin >> d; for(int j = 0, temp; j < d; ++j){ cin >> temp; snuke.insert(temp); } } cout << n - snuke.size() << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n, k, size, tmp; cin >> n >> k; set<int> st; for (int i = 0; i < n; i++) { cin >> size; for (int j = 0; j < size; j++) { cin >> tmp; st.insert(tmp); } } cout << n - st.size() << endl; }
### Prompt Your task is to create a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n, k, size, tmp; cin >> n >> k; set<int> st; for (int i = 0; i < n; i++) { cin >> size; for (int j = 0; j < size; j++) { cin >> tmp; st.insert(tmp); } } cout << n - st.size() << endl; } ```
// B - Trick or Treat #include <bits/stdc++.h> using namespace std; int in(){int x;cin>>x;return x;} int main(){ int N,K; cin>>N>>K; set<int> ok; for(int i=0; i<K; ++i) for(int d=in(), j=0; j<d; ++j) ok.insert(in()); cout<< N-ok.size() <<endl; }
### Prompt Please create a solution in CPP to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp // B - Trick or Treat #include <bits/stdc++.h> using namespace std; int in(){int x;cin>>x;return x;} int main(){ int N,K; cin>>N>>K; set<int> ok; for(int i=0; i<K; ++i) for(int d=in(), j=0; j<d; ++j) ok.insert(in()); cout<< N-ok.size() <<endl; } ```
#include<bits/stdc++.h> using namespace std; int n,k,d,a[110]; int main(){ int i,j,l; cin>>n>>k; for(i=1;i<=k;i++){ cin>>d; for(j=1;j<=d;j++){ cin>>l; a[l]=1; } } int cnt=0; for(i=1;i<=n;i++){ if(a[i])cnt++; } cout<<n-cnt; getchar();getchar(); }
### Prompt Please formulate a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k,d,a[110]; int main(){ int i,j,l; cin>>n>>k; for(i=1;i<=k;i++){ cin>>d; for(j=1;j<=d;j++){ cin>>l; a[l]=1; } } int cnt=0; for(i=1;i<=n;i++){ if(a[i])cnt++; } cout<<n-cnt; getchar();getchar(); } ```
#include<bits/stdc++.h> using namespace std; #define r(i,n) for(int i=0;i<n;i++) int main(){ int n,k,c=0;cin>>n>>k;vector<int>a(n); r(i,k){ int d;cin>>d; r(j,d){ int x;cin>>x;a.at(x-1)++; } } r(i,n){if(a.at(i)==0)c++;} cout<<c<<endl; }
### Prompt Create a solution in Cpp for the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define r(i,n) for(int i=0;i<n;i++) int main(){ int n,k,c=0;cin>>n>>k;vector<int>a(n); r(i,k){ int d;cin>>d; r(j,d){ int x;cin>>x;a.at(x-1)++; } } r(i,n){if(a.at(i)==0)c++;} cout<<c<<endl; } ```
#include<cstdio> int f[10001],n,m; int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=m;i++){ int x;scanf("%d",&x); for(int i=1;i<=x;i++){ int y;scanf("%d",&y),n-=f[y]==0,f[y]=1; } } printf("%d\n",n); }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<cstdio> int f[10001],n,m; int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=m;i++){ int x;scanf("%d",&x); for(int i=1;i<=x;i++){ int y;scanf("%d",&y),n-=f[y]==0,f[y]=1; } } printf("%d\n",n); } ```
#include <bits/stdc++.h> using namespace std; signed main(){ int n,k;cin>>n>>k; vector<int> v(n,0); for(int i=0;i<k;i++){ int d;cin>>d; while(d--){ int a;cin>>a;a--;v[a]++; } } int ans=0;for(int i=0;i<n;i++)ans+=v[i]==0; cout<<ans<<endl; }
### Prompt Develop a solution in Cpp to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; signed main(){ int n,k;cin>>n>>k; vector<int> v(n,0); for(int i=0;i<k;i++){ int d;cin>>d; while(d--){ int a;cin>>a;a--;v[a]++; } } int ans=0;for(int i=0;i<n;i++)ans+=v[i]==0; cout<<ans<<endl; } ```
#include<stdio.h> int vis[103]; int main(){ int n,k; scanf("%d%d",&n,&k); for(int i=1;i<=k;i++){ int tmp;scanf("%d",&tmp); for(int j=1;j<=tmp;j++){ int a;scanf("%d",&a); vis[a]=1; } } int ans=0; for(int i=1;i<=n;i++){ if(vis[i]==0)ans++; } printf("%d\n",ans); }
### Prompt Your challenge is to write a CPP solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<stdio.h> int vis[103]; int main(){ int n,k; scanf("%d%d",&n,&k); for(int i=1;i<=k;i++){ int tmp;scanf("%d",&tmp); for(int j=1;j<=tmp;j++){ int a;scanf("%d",&a); vis[a]=1; } } int ans=0; for(int i=1;i<=n;i++){ if(vis[i]==0)ans++; } printf("%d\n",ans); } ```
#include <bits/stdc++.h> using namespace std; int main(){ int N,K;cin>>N>>K; map<int,int>mp; for(int X=0;X<K;X++){ int D;cin>>D; for(int Y=0;Y<D;Y++){ int A;cin>>A;mp[A]++; } } int U=0; for(auto p:mp){ auto V=p.second;U++; } cout<<N-U<<endl; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int N,K;cin>>N>>K; map<int,int>mp; for(int X=0;X<K;X++){ int D;cin>>D; for(int Y=0;Y<D;Y++){ int A;cin>>A;mp[A]++; } } int U=0; for(auto p:mp){ auto V=p.second;U++; } cout<<N-U<<endl; } ```
#include<iostream> using namespace std; bool s[110]; int n,k,cnt=0; int main(){ cin>>n>>k; while(k--){ int v; cin>>v; while(v--){ int p;cin>>p; s[p]=1; } } for(int i=1;i<=n;i++){ if(s[i]==0)cnt+=1; } cout<<cnt<<endl; }
### Prompt In Cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<iostream> using namespace std; bool s[110]; int n,k,cnt=0; int main(){ cin>>n>>k; while(k--){ int v; cin>>v; while(v--){ int p;cin>>p; s[p]=1; } } for(int i=1;i<=n;i++){ if(s[i]==0)cnt+=1; } cout<<cnt<<endl; } ```
#include<bits/stdc++.h> using namespace std; #define ll long long int n,k; int a[105],x,num,y; int main() { cin>>n>>k; for(int i=1;i<=k;i++) { cin>>x; for(int j=1;j<=x;j++) cin>>y,a[y]++; } for(int i=1;i<=n;i++) if(a[i]==0) num++; cout<<num; return 0; }
### Prompt In CPP, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define ll long long int n,k; int a[105],x,num,y; int main() { cin>>n>>k; for(int i=1;i<=k;i++) { cin>>x; for(int j=1;j<=x;j++) cin>>y,a[y]++; } for(int i=1;i<=n;i++) if(a[i]==0) num++; cout<<num; return 0; } ```
#include<bits/stdc++.h> using namespace std; int n,k,d,x; map<int,int> v; int main() { cin>>n>>k; while(k--) { cin>>d; while(d--) { cin>>x; v[x]++; } } int sum=0; for(int i=1;i<=n;i++) { if(!v[i]) sum++; } cout<<sum<<endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,k,d,x; map<int,int> v; int main() { cin>>n>>k; while(k--) { cin>>d; while(d--) { cin>>x; v[x]++; } } int sum=0; for(int i=1;i<=n;i++) { if(!v[i]) sum++; } cout<<sum<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; vector<int> arr(n+1, 0); int ans = n; while(k--){ int x,y; cin>>x; while(x--){ cin>>y; if(arr[y]==0) ans--; arr[y]++; } } cout<<ans<<endl; }
### Prompt In cpp, your task is to solve the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; vector<int> arr(n+1, 0); int ans = n; while(k--){ int x,y; cin>>x; while(x--){ cin>>y; if(arr[y]==0) ans--; arr[y]++; } } cout<<ans<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,d,i,j,l,count=0; map<int ,int>mp; cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>l; mp[l]=1; } } for(i=1;i<=n;i++) { if(mp[i]==0)count++; } cout<<count<<endl; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,d,i,j,l,count=0; map<int ,int>mp; cin>>n>>k; for(i=1;i<=k;i++) { cin>>d; for(j=1;j<=d;j++) { cin>>l; mp[l]=1; } } for(i=1;i<=n;i++) { if(mp[i]==0)count++; } cout<<count<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n,k,m,a,b[1005]={0},i; scanf("%d%d",&n,&k); while(k--) { scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&a); b[a]++; } } int x=0; for(i=1;i<=n;i++) { if(b[i]==0) x++; } printf("%d\n",x); }
### Prompt Generate a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n,k,m,a,b[1005]={0},i; scanf("%d%d",&n,&k); while(k--) { scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&a); b[a]++; } } int x=0; for(i=1;i<=n;i++) { if(b[i]==0) x++; } printf("%d\n",x); } ```
#include<bits/stdc++.h> using namespace std; int main() { set< int > s; int n, k, d, x; cin >> n >> k; for ( int i = 0; i < k; i++ ) { cin >> d; for ( int j = 0; j < d; j++ ) { cin >> x; s.insert ( x ); } } cout << n - s.size() << endl; }
### Prompt Generate a cpp solution to the following problem: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { set< int > s; int n, k, d, x; cin >> n >> k; for ( int i = 0; i < k; i++ ) { cin >> d; for ( int j = 0; j < d; j++ ) { cin >> x; s.insert ( x ); } } cout << n - s.size() << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { int N, K, d,A; cin >> N >> K; bitset<100> sunuke; for(int i=0; i<K; i++){ cin >> d; for (int j=0; j<d; j++){ cin >> A; sunuke.set(A-1,1); } } cout << N - sunuke.count() <<endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief? Constraints * All values in input are integers. * 1 \leq N \leq 100 * 1 \leq K \leq 100 * 1 \leq d_i \leq N * 1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N Input Input is given from Standard Input in the following format: N K d_1 A_{1, 1} \cdots A_{1, d_1} \vdots d_K A_{K, 1} \cdots A_{K, d_K} Output Print the answer. Examples Input 3 2 2 1 3 1 3 Output 1 Input 3 3 1 3 1 3 1 3 Output 2 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int N, K, d,A; cin >> N >> K; bitset<100> sunuke; for(int i=0; i<K; i++){ cin >> d; for (int j=0; j<d; j++){ cin >> A; sunuke.set(A-1,1); } } cout << N - sunuke.count() <<endl; } ```