buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n, k = [int(i) for i in input().split()] ds = [] As = [] for i in range(2*k): ds.append(int(input())) As += [int(j) for j in input().split()] print(n-len(set(As)))
n, k = [int(i) for i in input().split()] ds = [] As = [] for i in range(k): ds.append(int(input())) As += [int(j) for j in input().split()] print(n-len(set(As)))
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 48]]
5
79
#include <array> #include <iostream> #include <string> #include <vector> int main() { int n, k, m = 0; std::cin >> n >> k; std::vector<int> a(n); for (int i = 0; i < k; i++) { int d, dd; std::cin >> d; for (int j = 0; j < d; j++) { std::cin >> dd; a[dd - 1] = 1; } } for (int l = ...
#include <array> #include <iostream> #include <string> #include <vector> int main() { int n, k, m = 0; std::cin >> n >> k; std::vector<int> a(n); for (int i = 0; i < k; i++) { int d, dd; std::cin >> d; for (int j = 0; j < d; j++) { std::cin >> dd; a[dd - 1] = 1; } } for (int l =...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
150
#include <bits/stdc++.h> using namespace std; long n, k, d[100], m, ans; bool a[100]; int main() { cin >> n >> k; for (int i = 0; i < k; i++) { cin >> d[i]; for (int j = 0; j < d[i]; j++) { cin >> m; a[m] = true; } } for (int i = 0; i < n; i++) if (a[i] == false) ans++; co...
#include <bits/stdc++.h> using namespace std; long n, k, d[100], m, ans; bool a[100]; int main() { cin >> n >> k; for (int i = 0; i < k; i++) { cin >> d[i]; for (int j = 0; j < d[i]; j++) { cin >> m; a[m] = true; } } for (int i = 1; i <= n; i++) if (a[i] == false) ans++; c...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
126
#include <stdio.h> #include <string.h> int main(void) { int N, K; int d[101]; int A[101][101]; int i, j; int count = 0; scanf("%d %d\n", &N, &K); int flag[N]; memset(flag, 0, sizeof(flag)); for (i = 0; i < K; i++) { scanf("%d\n", &d[i]); for (j = 0; j < d[i]; j++) { scanf("%d", &A[i][...
#include <stdio.h> #include <string.h> int main(void) { int N, K; int d[101]; int A[101][101]; int i, j; int count = 0; scanf("%d %d\n", &N, &K); int flag[N + 1]; memset(flag, 0, sizeof(flag)); for (i = 0; i < K; i++) { scanf("%d\n", &d[i]); for (j = 0; j < d[i]; j++) { scanf("%d", &A...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 11, 31, 69, 71, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
192
N,K=map(int,input().split()) a=[list(map(int,input().split()))for i in range(2*K)] sunuke=[] for i in range(2*K-1): if i%2==1: d=sum(a[i-1]) for n in range(d): sunuke.append(a[i][n]) sunuke=set(sunuke) print(N-len(sunuke))
N,K=map(int,input().split()) a=[list(map(int,input().split()))for i in range(2*K)] sunuke=[] for i in range(2*K): if i%2==1: d=sum(a[i-1]) for n in range(d): sunuke.append(a[i][n]) sunuke=set(sunuke) print(N-len(sunuke))
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
113
n,k=map(int,input().split()) kashi = [0] * n cnt = 0 M = 0 for s in range(n-1): i=int(input()) li=list(map(int,input().split())) if i > 0: for m in li: kashi[m-1] +=1 for i in kashi: if i == 0: cnt += 1 print(cnt)
n,k=map(int,input().split()) kashi = [0] * n cnt = 0 M = 0 for s in range(k): i=int(input()) li=list(map(int,input().split())) if i > 0: for m in li: kashi[m-1] +=1 for i in kashi: if i == 0: cnt += 1 print(cnt)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
99
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int sunuke[102]; int N, K; int d, i, ans, t, j; sunuke[0] = 1; for (i = 1; i <= 101; i++) { sunuke[i] = 0; } scanf("%d %d", &N, &K); for (i = 0; i < K; i++) { scanf("%d", &d); for (j = 0; j < d; j++) { scanf("%d"...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int sunuke[102]; int N, K; int d, i, ans, t, j; sunuke[0] = 1; for (i = 1; i <= 101; i++) { sunuke[i] = 0; } scanf("%d %d", &N, &K); for (i = 0; i < K; i++) { scanf("%d", &d); for (j = 0; j < d; j++) { scanf("%d"...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
0
174
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[k]; for (int i = 0; i < k; ++i) { a[i] = 0; } int num; int y; for (int i = 0; i < k; ++i) { cin >> num; for (int x = 0; x < num; ++x) { cin >> y; a[y - 1] += 1; } } int count = 0; fo...
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; ++i) { a[i] = 0; } int num; int y; for (int i = 0; i < k; ++i) { cin >> num; for (int x = 0; x < num; ++x) { cin >> y; a[y - 1] += 1; } } int count = 0; fo...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
149
#include <bits/stdc++.h> using namespace std; int main() { int N, K, d, sum; sum = 0; cin >> N >> K; vector<int> sunuke(N), okasi(N); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> okasi.at(j); for (int l = 0; l < N; l++) { if (l == okasi.at(j)) { ...
#include <bits/stdc++.h> using namespace std; int main() { int N, K, d, sum; sum = 0; cin >> N >> K; vector<int> sunuke(N), okasi(N); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> okasi.at(j); for (int l = 0; l < N; l++) { if (l == okasi.at(j) - 1) ...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
167
import sys import itertools N, K = map(int, input().split()) nums = [ ] for _ in range(N): _ = int(input()) nums.extend([int(x.strip()) for x in input().split(' ') ]) print(N - len(set(nums)))
import sys import itertools N, K = map(int, input().split()) nums = [ ] for _ in range(K): _ = int(input()) nums.extend([int(x.strip()) for x in input().split(' ') ]) print(N - len(set(nums)))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
80
N , K = map(int,input().split()) lis = [] for i in range(K): d = int(input()) lis.extend([map(int,input().split())]) lis = set(lis) print(N-len(lis))
N , K = map(int,input().split()) lis = [] for i in range(K): d = int(input()) lis.extend(list(map(int,input().split()))) lis = set(lis) print(N-len(lis))
[["-", 0, 1, 0, 652, 3, 4, 0, 634, 0, 70], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 634, 0, 73], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
70
N, K = map(int, input().split()) List = [] void = 0 cnt = 0 for i in range(int(K)): void = int(input()) List.append(list(map(int, input().split()))) arr = [int(x) for y in List for x in y] for k in range(1,N): if k in arr: pass else: cnt += 1 print(cnt)
N, K = map(int, input().split()) List = [] void = 0 cnt = 0 for i in range(int(K)): void = int(input()) List.append(list(map(int, input().split()))) arr = [int(x) for y in List for x in y] for k in range(1,N+1): if k in arr: pass else: cnt += 1 print(cnt)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
106
n,k = map(int,input().split()) l=[0]*n print(l) for i in range(k): d=int(input()) a=list(map(int,input().split())) for j in a: l[j-1]+=1 print(l.count(0))
n,k = map(int,input().split()) l=[0]*n for i in range(k): d=int(input()) a=list(map(int,input().split())) for j in a: l[j-1]+=1 print(l.count(0))
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
82
#include <bits/stdc++.h> using namespace std; int lastStoneWeight(vector<int> &stones) { sort(stones.begin(), stones.end()); while (1) { int dd = stones[stones.size() - 1] - stones[stones.size() - 2]; stones.erase(stones.begin() + stones.size() - 1); stones.erase(stones.begin() + stones.size() - 2); ...
#include <bits/stdc++.h> using namespace std; int lastStoneWeight(vector<int> &stones) { sort(stones.begin(), stones.end()); while (1) { int dd = stones[stones.size() - 1] - stones[stones.size() - 2]; stones.erase(stones.begin() + stones.size() - 1); stones.erase(stones.begin() + stones.size() - 2); ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
228
#include <math.h> #include <stdio.h> #include <stdlib.h> int main() { int n, k, tipo, cont = 0; scanf("%d %d", &n, &k); int pessoas[n], qrecebe; for (int i = 0; i < n; ++i) pessoas[i] = 0; for (int j = 0; j < k; ++j) { scanf("%d", &tipo); for (int i = 0; i < tipo; ++i) { scanf("%d", &qrece...
#include <math.h> #include <stdio.h> #include <stdlib.h> int main() { int n, k, tipo, cont = 0; scanf("%d %d", &n, &k); int pessoas[n], qrecebe; for (int i = 0; i < n; ++i) pessoas[i] = 0; for (int j = 0; j < k; ++j) { scanf("%d", &tipo); for (int i = 0; i < tipo; ++i) { scanf("%d", &qrece...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
168
N,K = map(int, input().split()) d = [] n = [] for k in range(K): d.append(input()) n.append(input().split()) def flatten(nested_list): return [e for inner_list in nested_list for e in inner_list] nfu = set(flatten(n)) print(nfu) print(N - len(nfu))
N,K = map(int, input().split()) d = [] n = [] for k in range(K): d.append(input()) n.append(input().split()) def flatten(nested_list): return [e for inner_list in nested_list for e in inner_list] nfu = set(flatten(n)) print(N - len(nfu))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
92
#include <iostream> using namespace std; int main() { // 整数の入力 int n, k; cin >> n >> k; // cout << n << " " << k << endl; int hasSweets[n]; for (int i = 0; i < n; i++) { hasSweets[i] = 0; } for (int i = 0; i < n; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int tmp; ...
#include <iostream> using namespace std; int main() { // 整数の入力 int n, k; cin >> n >> k; // cout << n << " " << k << endl; // init int hasSweets[n]; for (int i = 0; i < n; i++) { hasSweets[i] = 0; } for (int i = 0; i < k; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
162
#include <bits/stdc++.h> using namespace std; int main(void) { int N, K; int d, x; int count = 0; cin >> N >> K; vector<int> sunuke(N); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> x; sunuke.at(x - 1) = 1; } } for (int i = 0; i < K; i++) { if...
#include <bits/stdc++.h> using namespace std; int main(void) { int N, K; int d, x; int count = 0; cin >> N >> K; vector<int> sunuke(N); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> x; sunuke.at(x - 1) = 1; } } for (int i = 0; i < N; i++) { if...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
128
#include <bits/stdc++.h> using namespace std; int main() { int N, K; int a_i, i, ans = 0; cin >> N >> K; int cnt[N] = {}; for (int d = 0; d < K; d++) { cin >> i; for (int a = 0; a < i; a++) { cin >> a_i; cnt[a_i - 1] += 1; } } for (int x : cnt) { if (x == K) ans += 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; int a_i, i, ans = 0; cin >> N >> K; int cnt[N] = {}; for (int d = 0; d < K; d++) { cin >> i; for (int a = 0; a < i; a++) { cin >> a_i; cnt[a_i - 1] += 1; } } for (int x : cnt) { if (x > 0) ans += 1; }...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
117
import numpy as np N, K = map(int, input().split()) A = [] for i in range(K): d = int(input()) temp = list(map(int, input().split())) A = A + temp hito = np.ones(N) for i in range(len(A)): hito[A[i]] = 0 print(int(np.sum(hito)))
import numpy as np N, K = map(int, input().split()) A = [] for i in range(K): d = int(input()) temp = list(map(int, input().split())) A = A + temp hito = np.ones(N) for i in range(len(A)): hito[A[i]-1] = 0 print(int(np.sum(hito)))
[["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612]]
5
102
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; //#define INF 1000000000000 //10^12:極めて大きい値,∞ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; typedef long long ll; //#define INF 1000000000000 //10^12:極めて大きい値,∞ #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
240
#include <iostream> #include <vector> using namespace std; int main() { long n, k; cin >> n; cin >> k; long d; long num; vector<long> a; for (int i = 0; i < n; i++) { a.push_back(0); } for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> num; a[num] =...
#include <iostream> #include <vector> using namespace std; int main() { long n, k; cin >> n; cin >> k; long d; long num; vector<long> a; for (int i = 0; i < n; i++) { a.push_back(0); } for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> num; a[num -...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13], ["+", 8, ...
1
150
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int N; int K; int d[200]; int A; int B[200] = {0}; cin >> N; cin >> K; for (int i = 0; i < K; i++) { cin >> d[i]; for (int j = 0; j < d[i]; j++) { cin >> A; B[A - 1] = 1; } } int c...
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int N; int K; int d[200]; int A; int B[200] = {0}; cin >> N; cin >> K; for (int i = 0; i < K; i++) { cin >> d[i]; for (int j = 0; j < d[i]; j++) { cin >> A; B[A - 1] = 1; } } int c...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
145
N,K = input().split() N = int(N) K = int(K) have = [] result = 0 for i in range(N): have.append([0]*K) for i in range(K): d = int(input()) A = input().split() A = map(int,A) for a in A: have[a-1][d-1] = 1 for j in have: if j == [0]*K: result += 1 print(result)
N,K = input().split() N = int(N) K = int(K) have = [] result = 0 for i in range(N): have.append([1]*K) for i in range(K): d = int(input()) A = input().split() A = map(int,A) for a in A: have[a-1][i-1] = 0 for j in have: if j == [1]*K: result += 1 print(result...
[["-", 0, 652, 3, 4, 0, 657, 31, 634, 0, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 634, 0, 612], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 57, 15, 666, 0, 657, 31, 634, 0, 6...
5
120
#include <stdio.h> int main(void) { int N, K; scanf("%d%d", &N, &K); int cnt[K]; for (int i = 0; i < K; i++) { cnt[i] = 0; } for (int i = 0; i < K; i++) { int d; scanf("%d", &d); int A[d]; for (int k = 0; k < d; k++) { scanf("%d", &A[k]); } for (int j = 0; j < d; j++) { ...
#include <stdio.h> int main(void) { int N, K; scanf("%d%d", &N, &K); int cnt[N]; for (int i = 0; i < N; i++) { cnt[i] = 0; } for (int i = 0; i < K; i++) { int d; scanf("%d", &d); int A[d]; for (int k = 0; k < d; k++) { scanf("%d", &A[k]); } for (int j = 0; j < d; j++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
199
N, K = list(map(int, input().split())) d = [] A = [] B = set() for i in range(K): _d = int(input()) _A = list(map(int, input().split())) d.append(_d) A.append(_A) _B = set(_A) B = B or _B print(N - len(B))
N, K = list(map(int, input().split())) d = [] A = [] B = set() for i in range(K): _d = int(input()) _A = list(map(int, input().split())) d.append(_d) A.append(_A) _B = set(_A) B = B | _B print(N - len(B))
[["-", 8, 196, 0, 1, 0, 662, 12, 679, 17, 354], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 139]]
5
97
#include <bits/stdc++.h> using namespace std; int main() { int d, N, K; cin >> N >> K; vector<int> S(N + 1); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { int A; cin >> A; S.at(A)++; } } int count = 0; for (int i = 0; i < N; i++) { if (S.at(i) ...
#include <bits/stdc++.h> using namespace std; int main() { int d, N, K; cin >> N >> K; vector<int> S(N); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { int A; cin >> A; S.at(A - 1)++; } } int count = 0; for (int i = 0; i < N; i++) { if (S.at(i) ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 27, 28, 2, 3, 4, 0, 16, 12, 13]]
1
128
def main(): s = list(map(int,input().split())) n = [0]*s[0] for k in range(1,s[1],1): d = int(input()) a = list(map(int,input().split())) #print(a) for i in range(0,d,1): #print(a[i]) n[a[i]-1] = 1 #print(n) sum=0 #print(n) for k in range(0,s[0],1): if(n[k]=...
def main(): s = list(map(int,input().split())) n = [0]*s[0] for k in range(0,s[1],1): d = int(input()) a = list(map(int,input().split())) #print(a) for i in range(0,d,1): #print(a[i]) n[a[i]-1] = 1 #print(n) sum=0 #print(n) for k in range(0,s[0],1): if(n[k]=...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
139
#include <algorithm> #include <iostream> #include <list> #include <map> //連想配列 #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> //動的配列 #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { int N, K, d, tmp; cin ...
#include <algorithm> #include <iostream> #include <list> #include <map> //連想配列 #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> //動的配列 #define rep(i, N) for (int i = 0; i < N; i++) using namespace std; int main() { int N, K, d, tmp; cin ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
145
#include <iostream> using namespace std; int main() { int n, k, count = 0; cin >> n >> k; int arr[n] = {0}; for (int i = 0; i < k; i++) { int d; cin >> d; int a; for (int j = 0; j < d; j++) { cin >> a; arr[a - 1] += 1; } } for (int i = 0; i < n; i++) if (arr[i - 1] == 0) ...
#include <iostream> using namespace std; int main() { int n, k, count = 0; cin >> n >> k; int arr[n] = {0}; for (int i = 0; i < k; i++) { int d; cin >> d; int a; for (int j = 0; j < d; j++) { cin >> a; arr[a - 1] += 1; } } for (int i = 0; i < n; i++) if (arr[i] == 0) ...
[["-", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
127
def getN(): return int(input()) def getIntList(): return list(map(int, input().split())) def main(): N,K= map(int,input().split()) slist = [0] * N for i in range(K): d = getN() A = getIntList() for j in range(d): slist[j] += 1 print(slist.count(0)) ...
def getN(): return int(input()) def getIntList(): return list(map(int, input().split())) def main(): N,K= map(int,input().split()) slist = [0] * N for i in range(K): d = getN() A = getIntList() for j in range(d): slist[A[j]-1] += 1 print(slist.count...
[["+", 0, 677, 31, 206, 206, 657, 31, 206, 51, 22], ["+", 0, 677, 31, 206, 206, 657, 31, 206, 0, 70], ["+", 0, 677, 31, 206, 206, 657, 31, 206, 0, 73], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
113
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define mod 1000000007 using namespace std; using ll = long long; const int INF = 100000000; int main() { ll N, K; cin >> N >> K; ll d[1000] = {}, a[1000][1000] = {}, res[1000] = {}; ll ret = 0; rep(i, K) { cin >> d[i]; for ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define mod 1000000007 using namespace std; using ll = long long; const int INF = 100000000; int main() { ll N, K; cin >> N >> K; ll d[1000] = {}, a[1000][1000] = {}, res[1000] = {}; ll ret = 0; rep(i, K) { cin >> d[i]; for ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
206
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define rep(i, k, n) for (int(i) = (k); (i) < (n); (i)++) #define max(a, b) (a) > (b) ? (a) : (b) #define min(a, b) (a) < (b) ? (a) : (b) #define abs(a, b) (a) < 0 ? (a) : -(a) #define llong long long int main() { int N, K; scanf("%d %d"...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define rep(i, k, n) for (int(i) = (k); (i) < (n); (i)++) #define max(a, b) (a) > (b) ? (a) : (b) #define min(a, b) (a) < (b) ? (a) : (b) #define abs(a) (a) > 0 ? (a) : -(a) #define llong long long int main() { int N, K; scanf("%d %d", &...
[["-", 36, 36, 0, 30, 0, 112, 54, 158, 0, 21], ["-", 36, 36, 0, 30, 0, 112, 54, 158, 0, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22]]
0
186
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int ans = 0; cin >> n >> k; map<int, int> cnt; for (int i = 0; i < k; i++) { int a; cin >> a; vector<int> vec(a); for (int j = 0; j < a; j++) { cin >> vec.at(j); } for (int x : vec) { if (cnt.count(x)) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int ans = 0; cin >> n >> k; map<int, int> cnt; for (int i = 0; i < k; i++) { int a; cin >> a; vector<int> vec(a); for (int j = 0; j < a; j++) { cin >> vec.at(j); } for (int x : vec) { if (cnt.count(x)) { ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]]
1
172
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; bool *tric = new bool[N]; int d; int temp; for (int i = 1; i <= K; ++i) { cin >> d; for (int j = 1; j <= d; ++j) { cin >> temp; tric[temp - 1] = true; } } int ans = 0; for (int i = 0; i < K; ++i...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; bool *tric = new bool[N]; int d; int temp; for (int i = 1; i <= K; ++i) { cin >> d; for (int j = 1; j <= d; ++j) { cin >> temp; tric[temp - 1] = true; } } int ans = 0; for (int i = 0; i < N; ++i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
129
#include <iostream> using namespace std; int main(void) { int N, K, i, j, *n, d, dn, count; cin >> N >> K; n = new int[N + 1]; for (i = 0; i < N; i++) { n[i + 1] = i + 1; } count = N; for (i = 0; i < K; i++) { cin >> d; for (j = 0; j < d; j++) { cin >> dn; if (n[dn] != 0) { ...
#include <iostream> using namespace std; int main(void) { int N, K, i, j, *n, d, dn, count; cin >> N >> K; n = new int[N + 1]; for (i = 0; i < N; i++) { n[i + 1] = i + 1; } count = N; for (i = 0; i < K; i++) { cin >> d; for (j = 0; j < d; j++) { cin >> dn; if (n[dn] != 0) { ...
[["-", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
151
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector<int> vec(n + 1); for (int i = 0; i < k; i++) { int d; cin >> d; for (int j = 1; j <= d; j++) { int x; cin >> x; vec[j]++; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector<int> vec(n + 1); for (int i = 0; i < k; i++) { int d; cin >> d; for (int j = 1; j <= d; j++) { int x; cin >> x; vec[x]++; ...
[["-", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22]]
1
149
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int d[n], a[n], s[n] = {0}; for (int i = 1; i <= k; i++) { cin >> d[i]; for (int j = 1; j <= d[i]; j++) { cin >> a[j]; s[a[j]]++; } } int cnt = 0; for (int i = 1; i <= n; i++) { if (s[i] == 0) {...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int d[10000], a[10000], s[10000] = {0}; for (int i = 1; i <= k; i++) { cin >> d[i]; for (int j = 1; j <= d[i]; j++) { cin >> a[j]; s[a[j]]++; } } long long cnt = 0; for (int i = 1; i <= n; i++) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 22], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
142
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int N, K, i, j; cin >> N >> K; int d = 0, A = 0; int count = 0, check[N + 1] = {}; for (i = 1; i <= K; i++) { j = 1; cin >> d; do { cin >> A; check[A]++; j++; } while (j < d); } for (i = 1; ...
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int N, K, i, j; cin >> N >> K; int d = 0, A = 0; int count = 0, check[N + 1] = {}; for (i = 1; i <= K; i++) { j = 1; cin >> d; do { cin >> A; check[A]++; j++; } while (j <= d); } for (i = 1;...
[["-", 8, 9, 0, 82, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 82, 15, 23, 0, 16, 17, 19]]
1
136
"use strict"; const input = require("fs").readFileSync("/dev/stdin", "utf8"); const rows = input.trim().split("\n"); const header = rows.shift().split(" ").map(Number); const N = header[0]; const K = header[1]; const map = {}; for (let i = 0; i < K; i += 2) { rows[i + 1].split(" ").forEach((n) => { map[n] = n; });...
"use strict"; const input = require("fs").readFileSync("/dev/stdin", "utf8"); const rows = input.trim().split("\n"); const header = rows.shift().split(" ").map(Number); const N = header[0]; const K = header[1]; const map = {}; for (let i = 0; i < K; i++) { rows[2 * i + 1].split(" ").forEach((n) => { map[n] = n; })...
[["-", 36, 36, 0, 493, 0, 7, 567, 564, 17, 107], ["-", 36, 36, 0, 493, 0, 7, 567, 564, 12, 555], ["+", 36, 36, 0, 493, 0, 7, 567, 27, 17, 29], ["+", 63, 558, 500, 69, 71, 16, 31, 16, 31, 555], ["+", 63, 558, 500, 69, 71, 16, 31, 16, 17, 48]]
2
153
ARRAY = gets.split.map(&:to_i) N = ARRAY[0] K = ARRAY[1] $a = Array.new(N, 1) K.times do gets tmp = gets.split.map(&:to_i) tmp.each do |e| $a[e - 1] = 0 end end p $a puts $a.select{|v| v == 1}.count
ARRAY = gets.split.map(&:to_i) N = ARRAY[0] K = ARRAY[1] $a = Array.new(N, 1) K.times do gets tmp = gets.split.map(&:to_i) tmp.each do |e| $a[e - 1] = 0 end end puts $a.select{|v| v == 1}.count
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 744]]
4
82
#include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n + 1, 0); int a; for (int i = 0; i < k; i++) { cin >> a; for (int j = 0; j < a; j++) { int x; cin >> x; v[x]++; } } int count = 0; for (int i = 1; i < n; i++) { ...
#include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n + 1, 0); int a; for (int i = 0; i < k; i++) { cin >> a; for (int j = 0; j < a; j++) { int x; cin >> x; v[x]++; } } int count = 0; for (int i = 1; i <= n; i++) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
129
n, k = map(int,input().split()) data = [] for _ in range(k): d = int(input()) data.extend(list(map(int,input().split()))) print(data) print(n-len(set(data)))
n, k = map(int,input().split()) data = [] for _ in range(k): d = int(input()) data.extend(list(map(int,input().split()))) print(n-len(set(data)))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
72
require 'set' n, k = gets.split.map(&:to_i) snks = Set[] k.times{|i| gets snks << gets.split.map(&:to_i) } puts n - snks.size
require 'set' n, k = gets.split.map(&:to_i) snks = Set[] k.times{|i| gets snks += gets.split.map(&:to_i) } puts n - snks.size
[["-", 0, 652, 196, 196, 8, 734, 0, 738, 17, 151], ["+", 0, 652, 196, 196, 8, 734, 0, 755, 17, 107]]
4
48
#include <iostream> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> sunuke; for (int i = 0; i < N; i++) { sunuke.push_back(0); } for (int i = 0; i < K; i++) { int di; cin >> di; for (int j = 0; j < di; j++) { int index; cin >> index; ...
#include <iostream> #include <vector> using namespace std; int main() { int N, K; cin >> N >> K; vector<int> sunuke; for (int i = 0; i < N; i++) { sunuke.push_back(0); } for (int i = 0; i < K; i++) { int di; cin >> di; for (int j = 0; j < di; j++) { int index; cin >> index; ...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
138
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int i, j, l; int c[100]; int ans = 0; for (i = 0; i <= n; i++) c[i] = 0; int tmp; for (i = 0; i < k; i++) { cin >> j; for (l = 0; l < j; l++) { cin >> tmp; c[tmp]++; } } for (i = 1; i < ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int i, j, l; int c[100]; int ans = 0; for (i = 0; i <= n; i++) c[i] = 0; int tmp; for (i = 0; i < k; i++) { cin >> j; for (l = 0; l < j; l++) { cin >> tmp; c[tmp]++; } } for (i = 1; i <=...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
137
N, K = map(int, input().split()) d_list = [] A_list = [] for i in range(K): d_list.append(int(input())) A_ = list(map(int, input().split())) A_list.extend(A_) K_all = set(A_list) N_all = set(range(1, N)) no_N = N_all - K_all print(len(no_N))
N, K = map(int, input().split()) d_list = [] A_list = [] for i in range(K): d_list.append(int(input())) A_ = list(map(int, input().split())) A_list.extend(A_) K_all = set(A_list) N_all = set(range(1, N+1)) no_N = N_all - K_all print(len(no_N))
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
95
#include <iostream> using namespace std; int main() { int n, k, d[110], a, sunuke[110] = {0}; cin >> n >> k; for (int i = 0; i < k; ++i) { cin >> d[i]; for (int j = 0; j < d[i]; ++j) { cin >> a; sunuke[a = 1] = 1; } } int cnt = 0; for (int i = 0; i < n; ++i) if (!sunuke[i]) ...
#include <iostream> using namespace std; int main() { int n, k, d[110], a, sunuke[110] = {0}; cin >> n >> k; for (int i = 0; i < k; ++i) { cin >> d[i]; for (int j = 0; j < d[i]; ++j) { cin >> a; sunuke[a - 1] = 1; } } int cnt = 0; for (int i = 0; i < n; ++i) if (!sunuke[i]) ...
[["-", 0, 11, 31, 69, 341, 342, 0, 11, 17, 32], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33]]
1
130
import numpy N, K = map(int, input().split()) d = 0 l = list(numpy.zeros(N)) for i in range(K): d = int(input()) A = list(map(int, input().split())) for j in range(len(A)): l[j] = 1 print(l.count(0))
import numpy N, K = map(int, input().split()) d = 0 l = list(numpy.zeros(N)) for i in range(K): d = int(input()) A = list(map(int, input().split())) for j in range(len(A)): l[A[j]-1] += 1 print(l.count(0))
[["+", 0, 677, 31, 206, 206, 657, 31, 206, 51, 22], ["+", 0, 677, 31, 206, 206, 657, 31, 206, 0, 70], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 73], ["+", 0, 7, 8, 196, 0, 1, 0, 677, ...
5
91
list=input().split(" ") N=int(list[0]) K=int(list[1]) sunuke_list=[1] for i in range(N): sunuke_list.append(0) for i in range(K): num=int(input()) have_list=input().split(" ") for j in range(num): tmp=int(have_list[j]) sunuke_list[tmp]=1 count=0 for i in range(N): if sunuke_list[...
list=input().split(" ") N=int(list[0]) K=int(list[1]) sunuke_list=[1] for i in range(N): sunuke_list.append(0) for i in range(K): num=int(input()) have_list=input().split(" ") for j in range(num): tmp=int(have_list[j]) sunuke_list[tmp]=1 count=0 for i in range(1,N+1): if sunuke_l...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
126
N, K = map(int, input().split()) withSnacks = [] for x in range(K): nUmsnakes = int(input) snakes = list(map(int, input().split())) withSnacks.extend(snakes) withSnacks = list(set(withSnacks)) count = 0 for x in range(1, x + 1): if not x in withSnacks: count += 1 print(count)
N, K = map(int, input().split()) withSnacks = [] for x in range(K): nUmsnakes = int(input()) snakes = list(map(int, input().split())) withSnacks.extend(snakes) withSnacks = list(set(withSnacks)) count = 0 for x in range(1, N + 1): if not x in withSnacks: count += 1 print(count)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
94
N,K=map(int,input().split())#N人K種類 ls=[False for _ in range(N)] for i in range(K): d=int(input()) A=list(map(int,input().split())) for j in range(d): ls[A[j]-1]=True S=0 for i in range(K): if ls[i]==False: S+=1 print(S)
N,K=map(int,input().split())#N人K種類 ls=[False for _ in range(N)] for i in range(K): d=int(input()) A=list(map(int,input().split())) for j in range(d): ls[A[j]-1]=True S=0 for i in range(N): if ls[i]==False: S+=1 print(S)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
107
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n); for (int i = 0; i < n; i++) { v[i] = 0; } for (int i = 0; i < k; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int a; cin >> a; v[a]++; } } int sum = 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 < n; i++) { v[i] = 0; } for (int i = 0; i < k; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int a; cin >> a; v[a - 1]++; } } int sum = 0...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
148
#include <iostream> #include <string> int main() { int people[101]; for (int i = 0; i < 101; i++) { people[i] = 0; } int N, K; std::cin >> N >> K; int d = 0; int A = 0; for (int i = 0; i < K; i++) { std::cin >> d; for (int j = 0; j < d; j++) { std::cin >> A; people[A]++;...
#include <iostream> #include <string> int main() { int people[101]; for (int i = 0; i < 101; i++) { people[i] = 0; } int N, K; std::cin >> N >> K; int d = 0; int A = 0; for (int i = 0; i < K; i++) { std::cin >> d; for (int j = 0; j < d; j++) { std::cin >> A; people[A]++;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
153
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n, k; cin >> n >> k; vector<bool> has(k); rep(i, k) { int d; cin >> d; rep(j, d) { ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n, k; cin >> n >> k; vector<bool> has(n); rep(i, k) { int d; cin >> d; rep(j, d) { ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
122
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, N, K, d, a; cin >> N >> K; vector<bool> people(N, 1); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> a; if (people.at(a - 1)) people.at(a - 1) = 0; } } for (int i = 0; i < ...
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, N, K, d, a; cin >> N >> K; vector<bool> people(N, 1); for (int i = 0; i < K; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> a; if (people.at(a - 1)) people.at(a - 1) = 0; } } for (int i = 0; i < ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
138
#include <bits/stdc++.h> using namespace std; int ctoi(const char c) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8...
#include <bits/stdc++.h> using namespace std; int ctoi(const char c) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 22], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 22]]
1
272
N, K = [int(n) for n in input().split()] have_players = set() for i in range(1, K): di = int(input()) [have_players.add(n) for n in input().split()] ans = N - len(have_players) print(ans)
N, K = [int(n) for n in input().split()] have_players = set() for i in range(0, K): di = int(input()) [have_players.add(n) for n in input().split()] ans = N - len(have_players) print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
73
n,k = map(int,input().split()) dlist = list(range(1,k+1)) d = [] for i in range(k): d.append(int(input())) a = list(map(int,input().split())) for j in range(len(a)): if a[j] in dlist: dlist.remove(a[j]) print(len(dlist))
n,k = map(int,input().split()) dlist = list(range(1,n+1)) d = [] for i in range(k): d.append(int(input())) a = list(map(int,input().split())) for j in range(len(a)): if a[j] in dlist: dlist.remove(a[j]) print(len(dlist))
[["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22]]
5
104
#include <stdio.h> int main() { int n, k; scanf("%d %d", &n, &k); int snk[n]; for (int i = 0; i < n; i++) { snk[i] = 0; } int a, d; for (int i = 0; i < k; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &a); snk[a]++; } } int cnt = 0; for (int i = 0;...
#include <stdio.h> int main() { int n, k; scanf("%d %d", &n, &k); int snk[n]; for (int i = 0; i < n; i++) { snk[i] = 0; } int a, d; for (int i = 0; i < k; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &a); snk[a - 1]++; } } int cnt = 0; for (int i ...
[["+", 0, 1, 0, 27, 28, 69, 71, 16, 17, 33], ["+", 0, 1, 0, 27, 28, 69, 71, 16, 12, 13]]
0
165
#include <iostream> using namespace std; int main() { int N; int K; int i; int di; int r; int dk; int result = 0; int flag[101] = {0}; cin >> N >> K; for (i = 0; i < K; i++) { cin >> di; for (r = 0; r < di; r++) { cin >> dk; flag[dk] = 1; } } for (i = 1; i < N; i++) {...
#include <iostream> using namespace std; int main() { int N; int K; int i; int di; int r; int dk; int result = 0; int flag[101] = {0}; cin >> N >> K; for (i = 0; i < K; i++) { cin >> di; for (r = 0; r < di; r++) { cin >> dk; flag[dk] = 1; } } for (i = 1; i < N + 1; i+...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
132
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k, d, w; cin >> n >> k; set<int> a; rep(i, 2) { cin >> d; rep(j, d) { cin >> w; a.insert(w); } } cout << n - a.size() << ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k, d, w; cin >> n >> k; set<int> a; rep(i, k) { cin >> d; rep(j, d) { cin >> w; a.insert(w); } } cout << n - a.size() << ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
101
n, k = map(int, input().split()) okashi = [0 for _ in range(n)] for i in range(k): d = int(input()) lis = list(map(int,input().split())) for j in range(d): okashi[j-1] = 1 print(okashi.count(0))
n, k = map(int, input().split()) okashi = [0 for _ in range(n)] #print(okashi) for i in range(k): d = int(input()) lis = list(map(int,input().split())) for j in lis: okashi[j-1] = 1 #print(okashi) print(okashi.count(0))
[["-", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22]]
5
86
#include <iostream> #include <stack>/*** LIFO *** stack<type> var; #include<string> push(), top():to get data, pop():to remove, size(), empty() ***/ using namespace std; #define Fp(I, STAT, END) for (int I = STAT; I < END; I++) #define Fm(I, STAT, END) for (int I = STAT; I > END; I--) int main() { int N, K, d, temp...
#include <iostream> #include <stack>/*** LIFO *** stack<type> var; #include<string> push(), top():to get data, pop():to remove, size(), empty() ***/ using namespace std; #define Fp(I, STAT, END) for (int I = STAT; I < END; I++) #define Fm(I, STAT, END) for (int I = STAT; I > END; I--) int main() { int N, K, d, temp...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
130
import collections n,k = map(int,input().split()) d = [] a = [] for i in range(k): d_ = int(input()) d.append(d_) a_ = list(map(int,input().split())) a = a + a_ c = collections.Counter(a) # print(c) # print(c.values()) ans = 0 for i in range(n): if i+1 not in c.values(): ans += 1 print(a...
import collections n,k = map(int,input().split()) d = [] a = [] for i in range(k): d_ = int(input()) d.append(d_) a_ = list(map(int,input().split())) a = a + a_ c = collections.Counter(a) # print(c) # print(c.keys()) ans = 0 for i in range(n): if i+1 not in c.keys(): ans += 1 print(ans)
[["-", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22], ["+", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22]]
5
110
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int d, a[n], b, t; t = 0; for (int i = 0; i < n; i++) { a[i] = 0; } for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> b; a[b]++; } } for (int i = 0; i < n; i++) { i...
#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int d, a[n], b, t; t = 0; for (int i = 0; i < n; i++) { a[i] = 0; } for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> b; a[b - 1]++; } } for (int i = 0; i < n; i++) { ...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13]]
1
145
n,k=map(int,input().split()) d=list() array=list() for i in range(k): d.extend(input()) array.extend(input()) print(n-len(set(array)))
n,k=map(int,input().split()) d=list() array=list() for i in range(k): d.extend(input()) array.extend(input().split()) print(n-len(set(array)))
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
62
//#pragma region ALL(include define etc) #include <algorithm> // max(a, b) min(a, b) reverse() sort() #include <cmath> // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592) #include <functional> // sort(a, a + N, greater<型>()); #include <iostream> // swap(a, b) #include <math.h> #include <string> #include <vector> // ...
//#pragma region ALL(include define etc) #include <algorithm> // max(a, b) min(a, b) reverse() sort() #include <cmath> // abs(絶対値) sin cos tan(角度 / 180.0 * 3.141592) #include <functional> // sort(a, a + N, greater<型>()); #include <iostream> // swap(a, b) #include <math.h> #include <string> #include <vector> // ...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
158
import collections li=[] n,k=map(int,input().split()) for i in range(k): d=int(input()) lik=list(map(int,input().split())) li+=lik print(li) li=collections.Counter(li) ans=0 for j in range(1,n+1): if li[j]==0: ans+=1 print(ans)
import collections li=[] n,k=map(int,input().split()) for i in range(k): d=int(input()) lik=list(map(int,input().split())) li+=lik li=collections.Counter(li) ans=0 for j in range(1,n+1): if li[j]==0: ans+=1 print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
100
#include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d %d", &N, &K); int a = 0; int b = 0; int num; int input; char numbers_str; vector<int> v; while (a < K) { scanf("%d", &num); b = 0; for (b = 0; b < num; b++) { cin >> input; // cout << input << endl;...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d %d", &N, &K); int a = 0; int b = 0; int num; int input; char numbers_str; vector<int> v; while (a < K) { scanf("%d", &num); b = 0; for (b = 0; b < num; b++) { cin >> input; // cout << input << endl;...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
175
#include <bits/stdc++.h> using namespace std; int main() { int N, K, x = 0; cin >> N >> K; vector<vector<int>> sunuke(N, vector<int>(0)); for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int A; cin >> A; sunuke.at(A).push_back(i); } } for (int i...
#include <bits/stdc++.h> using namespace std; int main() { int N, K, x = 0; cin >> N >> K; vector<vector<int>> sunuke(N, vector<int>(0)); for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int A; cin >> A; sunuke.at(A - 1).push_back(i); } } for (i...
[["+", 63, 118, 28, 2, 3, 4, 0, 16, 17, 33], ["+", 63, 118, 28, 2, 3, 4, 0, 16, 12, 13]]
1
145
a,b = map(int, input().split()) List = [list(map(int, input().split())) for i in range(2*b)] list_all=[] Output = 0 for i in range(b): list_all = list_all+List[2*i] set_a = set(list_all) Output = a- len(set_a) print(Output)
a,b = map(int, input().split()) List = [list(map(int, input().split())) for i in range(2*b)] list_all=[] Output = 0 for i in range(b): list_all = list_all+List[2*i+1] set_a = set(list_all) Output = a- len(set_a) print(Output)
[["+", 0, 662, 12, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 12, 612]]
5
87
N, K = list(map(int, input().split())) a_set = set() for k in range(K): d = int(input()) A = list(map(int, input().split())) a_set |= set(A) people = a_set print(len(people))
N, K = list(map(int, input().split())) a_set = set() for k in range(K): d = int(input()) A = list(map(int, input().split())) a_set |= set(A) people = a_set print(N - len(people))
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
73
N,K = map(int, input().split()) d = [0] * K A = [] Nlist = [] B = 0 for n in range(101): Nlist.append(0) for i in range(K): d[i] = int(input()) A.append(list(map(int,input().split()))) for j in range(K): for k in range(d[j]): Nlist[A[j][k]] += 1 for l in range(N): if Nlist[l] == 0: ...
N,K = map(int, input().split()) d = [0] * K A = [] Nlist = [] B = 0 for _ in range(N): Nlist.append(0) for i in range(K): d[i] = int(input()) A.append(list(map(int,input().split()))) for j in range(K): for k in range(d[j]): Nlist[A[j][k]-1] += 1 for l in range(N): if Nlist[l] == 0: ...
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["...
5
145
n, k = map(int, input().split()) s = set() for _ in range(k): d = int(input()) a = tuple(map(int, input().split())) for _a in a: s.add(a) print(n - len(s))
n, k = map(int, input().split()) s = set() for _ in range(k): d = int(input()) a = tuple(map(int, input().split())) for _a in a: s.add(_a) print(n - len(s))
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
74
N, K = map(int, input().split()) A = list() B = list() for i in range(K): d = int(input()) A = A + list(map(int, input().split())) for j in range(1, K+1): if j in A: pass else: B.append(j) print(len(B))
N, K = map(int, input().split()) A = list() B = list() for i in range(K): d = int(input()) A = A + list(map(int, input().split())) for j in range(1, N+1): if j in A: pass else: B.append(j) print(len(B))
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
94
n,k=map(int,input().split()) x=[0]*n d=[0]*k sums=[] sums2=0 sums3=0 for i in range(k): d[i]=int(input()) a=[0]*d[i] a=list(map(int,input().split())) sums=sums+a sums2=sums2+d[i] for j in range(sums2): if sums.count(j+1)==0: sums3=sums3+1 print(sums3)
n,k=map(int,input().split()) x=[0]*n d=[0]*k sums=[] sums2=0 sums3=0 for i in range(k): d[i]=int(input()) a=[0]*d[i] a=list(map(int,input().split())) sums=sums+a sums2=sums2+d[i] for j in range(n): if sums.count(j+1)==0: sums3=sums3+1 print(sums3)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
128
N, K = map(int, input().split()) d = [] A = [] s0 = set([i for i in range(1,N)]) s1 = set() for i in range(K): d.append(int(input())) A.append(list(map(int, input().split()))) for j in range(d[i]): s1.add(A[i][j]) s_diff = s0 - s1 print(len(s_diff))
N, K = map(int, input().split()) d = [] A = [] s0 = set([i for i in range(1,N+1)]) s1 = set() for i in range(K): d.append(int(input())) A.append(list(map(int, input().split()))) for j in range(d[i]): s1.add(A[i][j]) s_diff = s0 - s1 print(len(s_diff))
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
120
n,k = map(int,input().split()) z = 0 l = [0] for i in range(k): d=int(input()) s =list(map(int,input().split())) l.extend(s) for i in range(n): if l.count(i)==0: z = z + 1 print(z)
n,k = map(int,input().split()) z = 0 l = [0] for i in range(k): d=int(input()) s =list(map(int,input().split())) l.extend(s) for i in range(n+1): if l.count(i)==0: z = z + 1 print(z)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
90
(n, k) = [int(s) for s in input().split()] data = arr = [[0 for i in range(k)] for j in range(n)] for i in range(0, k): d = int(input()) a = [int(s) for s in input().split()] for m in a: data[m - 1][d - 1] = 1 dd = [] for d in data: dd.append(sum(d)) ans = 0 for ddd in dd: if ddd == 0...
(n, k) = [int(s) for s in input().split()] data = [[0 for i in range(k)] for j in range(n)] for i in range(0, k): d = int(input()) a = [int(s) for s in input().split()] for m in a: data[m - 1][i] = 1 dd = [] for d in data: dd.append(sum(d)) ans = 0 for ddd in dd: if ddd == 0: ...
[["-", 0, 656, 0, 1, 0, 662, 12, 662, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 662, 0, 32], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22]]
5
137
N, K = input().split() d = [] x2 = [] count = 0 for i in range(0, int(N)): x2.append(0) for i in range(0, int(K)): d = int(input()) x = input().split() for j in x: if x2[int(j)-1] == 0: x2[int(j)-1] = 1 count += 1 print(count)
N, K = input().split() d = [] x2 = [] count = 0 for i in range(0, int(N)): x2.append(0) for i in range(0, int(K)): d = int(input()) x = input().split() for j in x: if x2[int(j)-1] == 0: x2[int(j)-1] = 1 count += 1 print(int(N)-count)
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
107
#include <bits/stdc++.h> using namespace std; #define ll long long #define P pair<int, int> #define rep(i, n) for (int i = 1; i <= (n); i++) #define asort(x) sort(x.begin(), x.end()) int main() { int n, k, d; int ans = 0, tmp; cin >> n >> k; vector<int> a(n); rep(i, k) { cin >> d; rep(i, d) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define P pair<int, int> #define rep(i, n) for (int i = 1; i <= (n); i++) #define asort(x) sort(x.begin(), x.end()) int main() { int n, k, d; int ans = 0, tmp; cin >> n >> k; vector<int> a(n + 1); rep(i, k) { cin >> d; rep(i, d) { ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
120
# coding: utf-8 a,b = map(int, input().split()) count=[0]*a for i in range(b): n = int(input()) num_list = list(map(int, input().split())) for j in num_list: count[j-1]+=1 c=0 for i in range(b): if count[i]==0: c+=1 print(c)
# coding: utf-8 a,b = map(int, input().split()) count=[0]*a for i in range(b): n = int(input()) num_list = list(map(int, input().split())) for j in num_list: count[j-1]+=1 c=0 for i in range(a): if count[i]==0: c+=1 print(c)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
96
nk = list(map(int, input().split())) dic={} for i in range(1,nk[0]): dic[str(i)]=0 for i in range(nk[1]): d=int(input()) a = list(map(int, input().split())) for j in range(len(a)): dic[str(a[j])]=1 keys= [k for k, v in dic.items() if v == 0] print(len(keys))
nk = list(map(int, input().split())) dic={} for i in range(1,nk[0]+1): dic[str(i)]=0 for i in range(nk[1]): d=int(input()) a = list(map(int, input().split())) for j in range(len(a)): dic[str(a[j])]=1 keys= [k for k, v in dic.items() if v == 0] print(len(keys))
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
128
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll long l...
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ll long l...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15...
1
170
#include <algorithm> #include <cstdio> #include <stdlib.h> using namespace std; int main() { int N, K; int A[110] = {0}; scanf("%d %d", &N, &K); for (int i = 0; i < K; i++) { int d; scanf("%d", &d); for (int j = 0; j < d; j++) { int a; scanf("%d", &a); A[a]++; } } int count...
#include <algorithm> #include <cstdio> #include <stdlib.h> using namespace std; int main() { int N, K; int A[110] = {0}; scanf("%d %d", &N, &K); for (int i = 0; i < K; i++) { int d; scanf("%d", &d); for (int j = 0; j < d; j++) { int a; scanf("%d", &a); A[a]++; } } int count...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
155
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k; cin >> n >> k; vector<int> a(k + 1, 1); rep(i, k) { int d; cin >> d; rep(j, d) { int b; cin >> b; if (a[b] == 1) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, k; cin >> n >> k; vector<int> a(n + 1, 1); rep(i, k) { int d; cin >> d; rep(j, d) { int b; cin >> b; if (a[b] == 1) ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]]
1
147
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <cstring> #include <deque> // deque #include ...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <cstring> #include <deque> // deque #include ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13]]
1
219
N,K = map(int,input().split()) c = 0 listA = [] for k in range(1,K+1): d = int(input()) listA += list(map(int,input().split())) for n in range(1,N+1): if n in listA: c += 1 print(c)
N,K = map(int,input().split()) c = 0 listA = [] for k in range(1,K+1): d = int(input()) listA += list(map(int,input().split())) for n in range(1,N+1): if n not in listA: c += 1 print(c)
[["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 699]]
5
84
#include <cstdio> #include <iostream> #define MAX 100 using namespace std; int main() { int N, K, d, A[MAX], x, count; count = 0; scanf("%d %d", &N, &K); for (int i = 0; i < N; i++) { A[i] = 0; } for (int i = 0; i < K; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &x); ...
#include <cstdio> #include <iostream> #define MAX 101 using namespace std; int main() { int N, K, d, A[MAX], x, count; count = 0; scanf("%d %d", &N, &K); for (int i = 0; i < N; i++) { A[i] = 0; } for (int i = 0; i < K; i++) { scanf("%d", &d); for (int j = 0; j < d; j++) { scanf("%d", &x); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
182
n,k = map(int,input().split()) a_list =[] for i in range(k): d = int(input()) a = list(map(int,input().split())) a_list = a_list + a t = 0 for i in range(1,n+1): if i in a_list: t += 1 print(t)
n,k = map(int,input().split()) a_list =[] for i in range(k): d = int(input()) a = list(map(int,input().split())) a_list = a_list + a t = 0 for i in range(1,n+1): if i in a_list: t += 1 print(n-t)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
85
n,k = (int(i) for i in input().split()) d = 0 a = [] c = set( [i for i in range(1,k+1)]) for i in range(k): d = int(input()) a.extend(int(i) for i in (input().split())) b = set(a) d = c-b print(len(d)) """" n,m = (int(i) for i in input().split()) h = [int(i) for i in input().split()] ab =[] for i in range(m): ab.a...
n,k = (int(i) for i in input().split()) d = 0 a = [] c = set( [i for i in range(1,n+1)]) for i in range(k): d = int(input()) a.extend(int(i) for i in (input().split())) b = set(a) d = c-b print(len(d)) """" n,m = (int(i) for i in input().split()) h = [int(i) for i in input().split()] ab =[] for i in range(m): ab.a...
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22]]
5
104
#include <cstdlib> #include <iostream> #include <vector> int main() { int N, K; std::cin >> N >> K; std::vector<int> okashi(N - 1, 0); for (int i = 0; i < K; i++) { int d; std::cin >> d; for (int j = 0; j < d; j++) { int A; std::cin >> A; okashi[A - 1]++; } } int ninzuu ...
#include <cstdlib> #include <iostream> #include <vector> int main() { int N, K; std::cin >> N >> K; std::vector<int> okashi(N, 0); for (int i = 0; i < K; i++) { int d; std::cin >> d; for (int j = 0; j < d; j++) { int A; std::cin >> A; okashi[A - 1]++; } } int ninzuu = 0;...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
143
#include <bits/stdc++.h> using namespace std; #define ios \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define ll lon...
#include <bits/stdc++.h> using namespace std; #define ios \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define ll lon...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13]]
1
130
#include <iostream> using namespace std; int main() { int n, k, d, p, ans = 0; cin >> n >> k; int a[n] = {}; a[0] = 0; for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> p; a[p]++; } } for (int i = 1; i < n; i++) { if (a[i] == 0) ans++; } cou...
#include <iostream> using namespace std; int main() { int n, k, d, p, ans = 0; cin >> n >> k; int a[n + 1] = {}; a[0] = 0; for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> p; a[p]++; } } for (int i = 1; i <= n; i++) { if (a[i] == 0) ans++; } ...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
130
#include <bits/stdc++.h> using namespace std; using ll = long long; #define FOR(i, a, b) for (ll i = a; (i) < (b); ++(i)) #define RFOR(i, a, b) for (ll i = a; (i) >= (b); --(i)) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, n, 0) #define ALL(v) v.begin(), v.end() #define UNIQ(v) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define FOR(i, a, b) for (ll i = a; (i) < (b); ++(i)) #define RFOR(i, a, b) for (ll i = a; (i) >= (b); --(i)) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, n, 0) #define ALL(v) v.begin(), v.end() #define UNIQ(v) ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
226
#include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> p; #define rep(i, n) fo...
#include <algorithm> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> p; #define rep(i, n) fo...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
270
#include <bits/stdc++.h> using namespace std; int main() { int n, k, d; int i = 0; cin >> n; cin >> k; std::vector<int> aa(n, 0); while (k > i) { int j = 0; int buf; cin >> d; while (d > j) { cin >> buf; aa[buf]++; j++; } i++; } i = 0; int count = 0; while...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, d; int i = 0; cin >> n; cin >> k; std::vector<int> aa(n, 0); while (k > i) { int j = 0; int buf; cin >> d; while (d > j) { cin >> buf; aa[buf - 1]++; j++; } i++; } i = 0; int count = 0; w...
[["+", 0, 27, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 27, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
133
N,K=map(int,input().split()) sunuke_list=[i+1 for i in range(N)] for i in range(K): d=int(input()) a=list(map(int,input().split())) b=set(sunuke_list)-set(a) sunuke_list=list(b) print(sunuke_list) print(len(sunuke_list))
N,K=map(int,input().split()) sunuke_list=[i+1 for i in range(N)] for i in range(K): d=int(input()) a=list(map(int,input().split())) b=set(sunuke_list)-set(a) sunuke_list=list(b) print(len(sunuke_list))
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
91
#include <iostream> #include <map> using namespace std; int main() { int N, K; int d; int a; map<int, int> S; int count = 0; cin >> N >> K; for (int i = 1; i <= K; i++) { cin >> d; for (int j = 1; j <= d; j++) { cin >> a; S[a] += 1; } } for (int i = 1; i <= K; i++) { if ...
#include <iostream> #include <map> using namespace std; int main() { int N, K; int d; int a; map<int, int> S; int count = 0; cin >> N >> K; for (int i = 1; i <= K; i++) { cin >> d; for (int j = 1; j <= d; j++) { cin >> a; S[a] += 1; } } for (int i = 1; i <= N; i++) { if ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
130