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
change_count
int64
0
100
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n, sum = 0; cin >> n; int S[10000]; for (int i = 0; i < n; i++) cin >> S[i]; int q; cin >> q; int T[500]; for (int i = 0; i < q; i++) { cin >> T[i]; for (int j = 0; j < n; j++) if (T[i] == S[...
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n, sum = 0; cin >> n; int S[10000]; for (int i = 0; i < n; i++) cin >> S[i]; int q; cin >> q; int T[500]; for (int i = 0; i < q; i++) { cin >> T[i]; for (int j = 0; j < n; j++) if (T[i] == S[...
[["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 7, 8, 57, 64, 9, 0, 46]]
1
125
4
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n, sum = 0; cin >> n; int S[10000]; for (int i = 0; i < n; i++) cin >> S[i]; int q; cin >> q; int T[500]; for (int i = 0; i < q; i++) { cin >> T[i]; S[n] = T[i]; int j = 0; while (S[j] != T...
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n, sum = 0; cin >> n; int S[10000]; for (int i = 0; i < n; i++) cin >> S[i]; int q; cin >> q; int T[500]; for (int i = 0; i < q; i++) { cin >> T[i]; S[n] = T[i]; int j = 0; while (S[j] != T...
[["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 52, 8, 9, 0, 46]]
1
137
2
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int search(int A[], int n, int key) { int i = 0; A[n] = key; while (A[i] != key) i++; return i != n; } int main() { int i, n, A[10000 + 1], q, key, sum = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &A[i]); scanf("&d", &q); for ...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int search(int A[], int n, int key) { int i = 0; A[n] = key; while (A[i] != key) i++; return i != n; } int main() { int i, n, A[10000 + 1], q, key, sum = 0; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &A[i]); scanf("%d", &q); for ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
173
2
#include <cstdio> using namespace std; int serch(int S[], int n, int key) { int i = 0; S[n] = key; while (S[i] != key) { i++; } return i != n; } int main() { int n, S[10000], q, key; int i, sum; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0;...
#include <cstdio> using namespace std; int serch(int S[], int n, int key) { int i = 0; S[n] = key; while (S[i] != key) { i++; } return i != n; } int main() { int n, S[10000], q, key; int i, sum = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i ...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
178
4
#include <stdio.h> int main() { int n, q, i, j, ans = 0; int S[10000], T[500]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &T[i]); for (j = 0; j < n; j++) { if (T[i] == S[j]) ans++; } } printf("%d\n...
#include <stdio.h> int main() { int n, q, i, j, ans = 0; int S[10000], T[500]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &T[i]); for (j = 0; j < n; j++) { if (T[i] == S[j]) { ans++; break; } ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
149
4
#include <stdio.h> #include <stdlib.h> int main() { int m, n, q, i, j, S[10000], T[500]; m = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &T[i]); } for (i = 0; i < n; i++) { for (j = 0; j < q; j++) { if ...
#include <stdio.h> #include <stdlib.h> int main() { int m, n, q, i, j, S[10000], T[500]; m = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &S[i]); } scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d", &T[i]); } for (i = 0; i < q; i++) { for (j = 0; j < n; j++) { if ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 0, 57,...
1
173
8
#include <iostream> using namespace std; int main() { int n, q; cin >> n; int S[n]; for (int i = 0; i < n; i++) { cin >> S[i]; } cin >> q; int T[q]; for (int i = 0; i < q; i++) { cin >> T[i]; } int k = 0; for (int j = 0; j < q; j++) for (int i = 0; i < n; i++) if (S[i] == T[j]) ...
#include <iostream> using namespace std; int main() { int n, q; cin >> n; int S[n]; for (int i = 0; i < n; i++) { cin >> S[i]; } cin >> q; int T[q]; for (int i = 0; i < q; i++) { cin >> T[i]; } int k = 0; for (int j = 0; j < q; j++) for (int i = 0; i < n; i++) if (S[i] == T[j]) {...
[["+", 0, 7, 8, 7, 8, 57, 64, 9, 0, 45], ["+", 8, 7, 8, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 7, 8, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 7, 8, 57, 64, 9, 0, 46]]
1
140
4
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <u...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <fstream> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <tuple> #include <u...
[["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22]]
1
378
2
#include <stdio.h> #define rep(i, n) for (i = 0; i < n; i++) int main() { int n, s[1000000000], q, t[1000000000]; int i, j, k; int count = 0; scanf("%d", &n); rep(i, n) scanf("%d", &s[i]); scanf("%d", &q); rep(i, q) scanf("%d", &t[i]); rep(i, q) { rep(j, n) { if (s[j] == t[i]) { co...
#include <stdio.h> #define rep(i, n) for (i = 0; i < n; i++) #define size 100000 int main() { int n, s[size], q, t[size]; int i, j, k; int count = 0; scanf("%d", &n); rep(i, n) scanf("%d", &s[i]); scanf("%d", &q); rep(i, q) scanf("%d", &t[i]); rep(i, q) { rep(j, n) { if (s[j] == t[i]) { ...
[["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
151
7
#include <iostream> #include <stdio.h> using namespace std; bool search(int S[], int n, int key) { int i = 0; S[n] = key; while (S[i++] != key) ; return i != n; } int main() { int n, q, S[10000 + 1], Q[500], count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &S[i]); } ...
#include <iostream> #include <stdio.h> using namespace std; bool search(int S[], int n, int key) { int i = 0; S[n] = key; while (S[i] != key) i++; return i != n; } int main() { int n, q, S[10000 + 1], Q[500], count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &S[i]); } ...
[["-", 51, 16, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 52, 8, 1, 0, 27, 17, 29]]
1
203
3
#include <iostream> using namespace std; int S[10000]; int T[500]; int main() { int N, Q, sum; cin >> N; for (int i = 0; i < N; i++) cin >> S[i]; cin >> Q; for (int i = 0; i < Q; i++) cin >> T[i]; sum = 0; for (int i = 0; i < Q; i++) { for (int j = 0; j < N; j++) { if (S[j] == T[i]) {...
#include <iostream> using namespace std; int S[10000]; int T[500]; int main() { int N, Q, sum; cin >> N; for (int i = 0; i < N; i++) cin >> S[i]; cin >> Q; for (int i = 0; i < Q; i++) cin >> T[i]; sum = 0; for (int i = 0; i < Q; i++) { for (int j = 0; j < N; j++) { if (S[j] == T[i]) {...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
143
2
#include <bits/stdc++.h> #define pout(n) printf("%d\n", n) #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, n, a) for (int i = n - 1; i >= a; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); const int d4x[4] = {1, 0, -1, 0}; const int d4y[4] = {0, 1, 0, -1}; const int...
#include <bits/stdc++.h> #define pout(n) printf("%d\n", n) #define rep(i, a, n) for (int i = a; i < n; i++) #define per(i, n, a) for (int i = n - 1; i >= a; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); const int d4x[4] = {1, 0, -1, 0}; const int d4y[4] = {0, 1, 0, -1}; const int...
[["-", 8, 9, 0, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 9, 0, 7, 15, 16, 12, 22]]
1
249
2
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <queue> #include <sstream> #include <stack> #include <stdio.h> using namespace std; bool find(int a[], int n, int num) { int i; for (i = 0; i < n; i++) { if (a[i] = num) return true; } return false;...
#include <algorithm> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <queue> #include <sstream> #include <stack> #include <stdio.h> using namespace std; bool find(int a[], int n, int num) { int i; for (i = 0; i < n; i++) { if (a[i] == num) { // printf("%d\n",i); re...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
227
8
#include <array> #include <iostream> using namespace std; static void inputArray(int A[], int num) { for (int i = 0; i < num; i++) { cin >> A[i]; } } static bool linearSearch(int A[], int sentinel) { int i = 0; for (; A[i] != sentinel; i++) ; return i; } int main() { array<int, 10000 + 1> N; a...
#include <array> #include <iostream> using namespace std; static void inputArray(int A[], int num) { for (int i = 0; i < num; i++) { cin >> A[i]; } } static int linearSearch(int A[], int sentinel) { int i = 0; for (; A[i] != sentinel; i++) ; return i; } int main() { array<int, 10000 + 1> N; ar...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40]]
1
204
2
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { int n, q; int s[10000], t[10000]; int cnt = 0; cin >> n; for (int i = 0; i < n; i++) cin >> s[n]; cin >> q; for (int i = 0; i < q; i++) cin >> t[q]; for (int i = 0; i < q; i++) { for (int j = 0; j <...
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { int n, q; int s[10000], t[10000]; int cnt = 0; cin >> n; for (int i = 0; i < n; i++) cin >> s[i]; cin >> q; for (int i = 0; i < q; i++) cin >> t[i]; for (int i = 0; i < q; i++) { for (int j = 0; j <...
[["-", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 8, 1, 0, 16, 12, 69, 341, 342, 0, 22]]
1
144
4
#include <bits/stdc++.h> using namespace std; int main() { int a, b, in, ans = 0; cin >> a; vector<int> c, d; for (int i = 0; i < a; i++) { cin >> in; c.push_back(in); } cin >> b; for (int i = 0; i < b; i++) { cin >> in; d.push_back(in); } for (int i : c) { if (find(d.begin(), d.en...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, in, ans = 0; cin >> a; vector<int> c, d; for (int i = 0; i < a; i++) { cin >> in; c.push_back(in); } cin >> b; for (int i = 0; i < b; i++) { cin >> in; d.push_back(in); } for (int i : d) { if (find(c.begin(), c.en...
[["-", 0, 30, 0, 14, 8, 9, 0, 338, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 12, 22], ["-", 31, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 31, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["-", 15, 339, 51, 16, 12, 2, 63, 118, 28, 22], ["+", 15, 339, 51, 16, 12, 2, 63, 118, 28, 22]]
1
136
8
#include <iostream> using namespace std; bool search(int arr[], int arr_len, int key) { arr[arr_len + 1] = key; int i = 0; while (arr[i] != key) ++i; if (i == arr_len) return false; // Not found return true; // Found } int main() { int n; cin >> n; int S[n + 1]; int s; for (int i = 0; i...
#include <iostream> using namespace std; bool search(int arr[], int arr_len, int key) { arr[arr_len + 1] = key; int i = 0; while (arr[i] != key) ++i; if (i == arr_len + 1) return false; // Not found else return true; // Found } int main() { int n; cin >> n; int S[n + 1]; int s; for (...
[["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
171
3
#include <iostream> using namespace std; int LinearSearch(int S[], int T[], int N, int M) { int C = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (S[i] == T[j]) { C++; } } } return C; } int main() { int n, m; cin >> n; int S[n]; for (int i = 0; i < n; i+...
#include <iostream> using namespace std; int LinearSearch(int S[], int T[], int N, int M) { int C = 0; for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { if (S[j] == T[i]) { C++; break; } } } return C; } int main() { int n, m; cin >> n; int S[n]; for (int i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", ...
1
176
10
#include <iostream> #define MAX_n 10000 #define MAX_q 500 int main() { int x; int n, q; int S[MAX_n], T[MAX_q]; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> x; S[i] = x; } std::cin >> q; for (int i = 0; i < q; i++) { std::cin >> x; T[i] = x; } int cnt = 0; for (int ...
#include <iostream> #define MAX_n 10000 #define MAX_q 500 int main() { int x; int n, q; int S[MAX_n], T[MAX_q]; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> x; S[i] = x; } std::cin >> q; for (int i = 0; i < q; i++) { std::cin >> x; T[i] = x; } int cnt = 0; for (int ...
[["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22]]
1
173
4
#include <iostream> #define N_MAX 10000 #define Q_MAX 500 int count = 0; void search(int array[], int n, int k) { for (int i = 0; i < n; i++) { if (array[i] == k) { count++; } } } int main() { int n, q; int s_array[N_MAX], t_array[Q_MAX]; std::cin >> n; for (int i = 0; i < n; i++) { std...
#include <iostream> #define N_MAX 10000 #define Q_MAX 500 int count = 0; void search(int array[], int n, int k) { for (int i = 0; i < n; i++) { if (array[i] == k) { count++; return; } } } int main() { int n, q; int s_array[N_MAX], t_array[Q_MAX]; std::cin >> n; for (int i = 0; i < n; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
168
2
#include <iostream> int main() { int n; int q; int s[10000] = {0}; int t[500] = {0}; int cnt = 0; int i, j; std::cin >> n; for (i = 0; i < n; i++) { std::cin >> s[i]; } std::cin >> q; for (i = 0; i < q; i++) { std::cin >> t[i]; } for (i = 0; i < n; i++) { for (j = 0; j < q; j++)...
#include <iostream> int main() { int n; int q; int s[10000] = {0}; int t[500] = {0}; int cnt = 0; int i, j; std::cin >> n; for (i = 0; i < n; i++) { std::cin >> s[i]; } std::cin >> q; for (i = 0; i < q; i++) { std::cin >> t[i]; } for (i = 0; i < q; i++) { for (j = 0; j < n; j++)...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", ...
1
166
8
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q, temp, count = 0; vector<int> line1, line2; cin >> n; for (int i = 0; i < n; i++) { cin >> temp; line1.push_back(temp); } cin >> q; for (int i = 0; i < n; i++) { cin >> temp; line2.push_...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q, temp, count = 0; vector<int> line1, line2; cin >> n; for (int i = 0; i < n; i++) { cin >> temp; line1.push_back(temp); } cin >> q; for (int i = 0; i < q; i++) { cin >> temp; line2.push_...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
163
2
#include <iostream> #include <vector> using namespace std; int main() { vector<int> o1(10000, 0); vector<int> o2(500, 0); int n1; int n2; int count = 0; cin >> n1; for (int i = 0; i < n1; i++) { cin >> o1[i]; } cin >> n2; for (int j = 0; j < n2; j++) { cin >> o2[j]; } for (int i = 0; i ...
#include <iostream> #include <vector> using namespace std; int main() { vector<int> o1(10000, 0); vector<int> o2(500, 0); int n1; int n2; int count = 0; cin >> n1; for (int i = 0; i < n1; i++) { cin >> o1[i]; } cin >> n2; for (int j = 0; j < n2; j++) { cin >> o2[j]; } for (int i = 0; i ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
159
2
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n, q, a, k = 0; cin >> n; vector<int> A; for (int i = 0; i < n; i++) { cin >> a; A.push_back(a); } cin >> q; for (int i = 0; i < q; i++) { cin >> a; for (int j = 0; j < n; j++) { if (A[j] =...
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n, q, a, k = 0; cin >> n; vector<int> A; for (int i = 0; i < n; i++) { cin >> a; A.push_back(a); } cin >> q; for (int i = 0; i < q; i++) { cin >> a; for (int j = 0; j < n; j++) { if (A[j] =...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
141
19
#include <iostream> int main() { int n, q; int S[10001]; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> S[i]; } std::cin >> q; int T[501]; int count = 0; for (int i = 0; i < q; i++) { std::cin >> T[i]; } for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { ...
#include <iostream> int main() { int n, q; int S[10001]; std::cin >> n; for (int i = 0; i < n; i++) { std::cin >> S[i]; } std::cin >> q; int T[501]; int count = 0; for (int i = 0; i < q; i++) { std::cin >> T[i]; } for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
154
2
#include <iostream> using namespace std; int D[10010]; int main() { int n, d, s, c = 0; cin >> n; for (int i = 0; i < n; i++) cin >> D[i]; cin >> d; for (int i = 0; i < d; i++) { cin >> s; D[n] = s; int j = 0; while (D[j] != s) j++; if (i != n) c++; } cout << c << end...
#include <iostream> using namespace std; int D[10010]; int main() { int n, d, s, c = 0; cin >> n; for (int i = 0; i < n; i++) cin >> D[i]; cin >> d; for (int i = 0; i < d; i++) { cin >> s; D[n] = s; int j = 0; while (D[j] != s) j++; if (j != n) c++; } cout << c << end...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
120
2
#include <iostream> using namespace std; int main() { int n, q, S[10010], T[510], C = 0; cin >> n; for (int i = 0; i < n; ++i) cin >> S[i]; cin >> q; for (int i = 0; i < q; ++i) cin >> T[i]; for (int i = 0; i < n; ++i) { for (int j = 0; j < q; ++j) { if (S[i] == T[j]) { ++C; ...
#include <iostream> using namespace std; int main() { int n, q, S[10010], T[510], C = 0; cin >> n; for (int i = 0; i < n; ++i) cin >> S[i]; cin >> q; for (int i = 0; i < q; ++i) cin >> T[i]; for (int i = 0; i < q; ++i) { for (int j = 0; j < n; ++j) { if (T[i] == S[j]) { ++C; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 0, 57,...
1
141
8
#include <cstdio> #include <iostream> using namespace std; // Aにkeyがあるなら1,ないなら0を返す int search(int A[], int n, int key) { A[n] = key; for (int i = 0; i < n; i++) { if (A[i] == key) { return 1; } } return 0; /* while(A[i]!=key){ i++; } return i!=n; */ } int main() { int n, q; sca...
#include <cstdio> #include <iostream> using namespace std; // Aにkeyがあるなら1,ないなら0を返す int search(int A[], int n, int key) { A[n] = key; for (int i = 0; i < n; i++) { if (A[i] == key) { return 1; } } return 0; /* while(A[i]!=key){ i++; } return i!=n; */ } int main() { int n, q; sca...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
193
26
#include <iostream> #include <vector> using namespace std; int linearSearch(vector<int> &A, int N, int key) { int i = 0; A[N] = key; while (A[i] != key) { i++; } return i != N; } int main() { vector<int> A; A.reserve(10000 + 1); int N; cin >> N; A.resize(N + 1); for (int i = 0; i < N; i++)...
#include <iostream> #include <vector> using namespace std; int linearSearch(vector<int> &A, int N, int key) { int i = 0; A[N] = key; while (A[i] != key) { i++; } return i != N; } int main() { vector<int> A; A.reserve(10000 + 1); int N; cin >> N; A.resize(N + 1); for (int i = 0; i < N; i++)...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
173
4
#include <stdio.h> #include <stdlib.h> using namespace std; int linear_search(const int n, int S[], const int q, int T[]) { int count = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < q; j++) { if (S[i] == T[j]) { count++; break; } } } return count; } int main(void) {...
#include <stdio.h> #include <stdlib.h> using namespace std; int linear_search(const int n, int S[], const int q, int T[]) { int count = 0; for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { if (S[j] == T[i]) { count++; break; } } } return count; } int main(void) {...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["+", ...
1
219
8
#include <cstdlib> #include <iostream> #include <vector> using namespace std; int main() { vector<int> s, t; int n, n2; cin >> n; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; s.push_back(tmp); } cin >> n2; for (int i = 0; i < n2; i++) { int tmp; cin >> tmp; t.push_back(tmp); ...
#include <cstdlib> #include <iostream> #include <vector> using namespace std; int main() { vector<int> s, t; int n, n2; cin >> n; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; s.push_back(tmp); } cin >> n2; for (int i = 0; i < n2; i++) { int tmp; cin >> tmp; t.push_back(tmp); ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
155
4
#include <cstdio> using namespace std; #define MAX_N 10000 #define MAX_Q 500 // 2つの数列から同じ要素を含んでいる数を出力する int linear_search(int n, unsigned int *S, int q, unsigned *T); int main() { unsigned int S[MAX_N]; unsigned int T[MAX_Q]; int n, q; int ans; // 初期化 scanf("%d", &n); for (int i = 0; i < n; i++) {...
#include <cstdio> using namespace std; #define MAX_N 10000 #define MAX_Q 500 // 2つの数列から同じ要素を含んでいる数を出力する int linear_search(int n, unsigned int *S, int q, unsigned *T); int main() { unsigned int S[MAX_N]; unsigned int T[MAX_Q]; int n, q; int ans; // 初期化 scanf("%d", &n); for (int i = 0; i < n; i++) {...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
243
2
#include <stdio.h> int main() { int n, q; scanf("%d", &n); int S[n]; for (int i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); int tmp, count = 0; for (int i = 0; i < q; i++) { scanf("%d", tmp); for (int j = 0; j > n; j++) { if (S[j] == tmp) count++; } } printf...
#include <stdio.h> int main() { int n, q; scanf("%d", &n); int S[n]; for (int i = 0; i < n; i++) scanf("%d", &S[i]); scanf("%d", &q); int tmp, count = 0; for (int i = 0; i < q; i++) { scanf("%d", &tmp); for (int j = 0; j < n; j++) { if (S[j] == tmp) { count++; break; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 47], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
139
7
#include <bits/stdc++.h> using namespace std; #define N 10000 int main(void) { int n, q, A[N], num; int cnt = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", A + i); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &q); for (int j = 0; j < n; j++) { if (q == A[j])...
#include <bits/stdc++.h> using namespace std; #define N 10000 int main(void) { int n, q, A[N], num; int cnt = 0; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", A + i); scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &num); for (int j = 0; j < n; j++) { if (num == A...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
149
4
#include <iostream> #include <map> using namespace std; int main() { map<int, int> m; int S[100000], T[100000], n, q, key, low = 0, upper = 0, mid, flag; int i = 0, cnt = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> S[i]; } cin >> q; for (int i = 0; i < q; i++) { cin >> T[i]; } for ...
#include <iostream> #include <map> using namespace std; int main() { map<int, int> m; int S[100000], T[100000], n, q, key, low = 0, upper = 0, mid, flag; int i = 0, cnt = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> S[i]; } cin >> q; for (int i = 0; i < q; i++) { cin >> T[i]; } for ...
[["+", 0, 57, 64, 1, 0, 2, 63, 118, 28, 22], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 17, 131], ["+", 0, 57, 64, 1, 0, 2, 63, 118, 119, 120], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
184
5
#include <iostream> using namespace std; #define N 1000 #define Q 500 int main() { int n[N]; int q[Q]; int num, num2, i, j, count = 0; cin >> num; for (i = 0; i < num; i++) { cin >> n[i]; } cin >> num2; for (i = 0; i < num2; i++) { cin >> q[i]; } for (i = 0; i < num; i++) { for ...
#include <iostream> using namespace std; #define N 10001 #define Q 501 int main() { int n[N]; int q[Q]; int num, num2, i, j, count = 0; cin >> num; for (i = 0; i < num; i++) { cin >> n[i]; } cin >> num2; for (i = 0; i < num2; i++) { cin >> q[i]; } for (i = 0; i < num2; i++) { fo...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+"...
1
153
10
#include <iostream> using namespace std; #define N 1000 #define Q 500 int main() { int n[N]; int q[Q]; int num, num2, i, j, count = 0; cin >> num; for (i = 0; i < num; i++) { cin >> n[i]; } cin >> num2; for (i = 0; i < num2; i++) { cin >> q[i]; } for (i = 0; i < num; i++) { for ...
#include <iostream> using namespace std; // MAX #define N 10001 #define Q 501 int main() { int n[N]; int q[Q]; int num, num2, i, j, count = 0; // load number cin >> num; // load data for (i = 0; i < num; i++) { cin >> n[i]; } // load number cin >> num2; // load data for (i = 0; i < num...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+"...
1
153
10
#include <iostream> using namespace std; int n, m; int s[10002]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } int c = 0; cin >> m; for (int i = 0; i < m; i++) { int x; cin >> x; for (int j = 0; j < n; j++) { if (s[j] == x) { c++; } } } ...
#include <iostream> using namespace std; int n, m; int s[10002]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } int c = 0; cin >> m; for (int i = 0; i < m; i++) { int x; cin >> x; for (int j = 0; j < n; j++) { if (s[j] == x) { c++; break; ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
118
2
#include <iostream> using namespace std; int main() { int numOfList; int numOfSerachList; unsigned int list[10000]; int counter = 0; cin >> numOfList; for (int i = 0; i < numOfList; i++) { cin >> list[i]; } cin >> numOfSerachList; for (int i = 0; i < numOfSerachList; i++) { unsigned int v...
#include <iostream> using namespace std; int main() { int numOfList; int numOfSerachList; unsigned int list[10000]; int counter = 0; cin >> numOfList; for (int i = 0; i < numOfList; i++) { cin >> list[i]; } cin >> numOfSerachList; for (int i = 0; i < numOfSerachList; i++) { unsigned int v...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
120
6
#include <algorithm> #include <cstdio> #include <iostream> #define NMAX 10000 #define QMAX 500 using namespace std; int main(void) { int n, q; long long S[NMAX], T; int cnt = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> S[i]; } sort(S, S + n); cin >> q; for (int i = 0; i < q; i++) { ...
#include <algorithm> #include <cstdio> #include <iostream> #define NMAX 10000 #define QMAX 500 using namespace std; int main(void) { int n, q; long long S[NMAX], T; int cnt = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> S[i]; } sort(S, S + n); cin >> q; for (int i = 0; i < q; i++) { ...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
150
4
#include <cstdio> int main() { int n, q; int S[10000], T[500]; int count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &(S[i])); } scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &(T[i])); } for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { i...
#include <cstdio> int main() { int n, q; int S[10000], T[500]; int count = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &(S[i])); } scanf("%d", &q); for (int i = 0; i < q; i++) { scanf("%d", &(T[i])); } for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { i...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
173
2
package main import ( "fmt" "log" ) func main() { var n int if _, err := fmt.Scanf("%d", &n); err != nil { log.Fatalln(err) } s := make([]int, n) for i := 0; i < n; i++ { if _, err := fmt.Scanf("%d", &s[i]); err != nil { log.Fatalln(err) } } var q int if _, err := fmt.Scanf("%d", &q); err != nil {...
package main import ( "fmt" "log" ) func main() { var n int if _, err := fmt.Scanf("%d", &n); err != nil { log.Fatalln(err) } s := make([]int, n) for i := 0; i < n; i++ { if _, err := fmt.Scanf("%d", &s[i]); err != nil { log.Fatalln(err) } } var q int if _, err := fmt.Scanf("%d", &q); err != nil {...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165]]
7
272
2
package main import ( "bufio" "fmt" "os" "strings" ) func linearSearch(a, b []string) int { var n int for _, v := range a { for _, v1 := range b { if v == v1 { n++ } } } return n } func main() { scan := bufio.NewScanner(os.Stdin) if scan.Scan() { scan.Text() } var nums []string if scan.S...
package main import ( "bufio" "fmt" "os" "strings" ) func linearSearch(a, b []string) int { var n int for _, v := range b { for _, v1 := range a { if v == v1 { // fmt.Printf("%s = %s\n", v, v1) n++ break } } } return n } func main() { scan := bufio.NewScanner(os.Stdin) if scan.Scan() ...
[["-", 0, 435, 8, 196, 0, 7, 0, 442, 12, 22], ["+", 0, 435, 8, 196, 0, 7, 0, 442, 12, 22], ["-", 0, 7, 8, 196, 0, 7, 0, 442, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 0, 442, 12, 22], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
7
196
6
package main import ( "fmt" "bufio" "os" "strings" "strconv" ) const MAX_LEN = 100000 var sc = bufio.NewScanner(os.Stdin) type Process struct { name string time int } type Queue struct { q [MAX_LEN]Process head int tail int } func GenQueue() Queue { return Queue{head: 0, tail: 0} } func (queue *Queue)...
package main import ( "fmt" "bufio" "os" "strings" "strconv" ) const MAX_LEN = 100000 var sc = bufio.NewScanner(os.Stdin) type Process struct { name string time int } type Queue struct { q [MAX_LEN]Process head int tail int } func GenQueue() Queue { return Queue{head: 0, tail: 0} } func (queue *Queue)...
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 19]]
7
437
2
function LinkedNode(element) { this.element = element; this.previous = null; this.next = null; } function LinkedList() { this.dummy = new LinkedNode(null); this.dummy.previous = this.dummy; this.dummy.next = this.dummy; } LinkedList.prototype.getFirst = function() { return this.dummy.next.element; }; Lin...
function LinkedNode(element) { this.element = element; this.previous = null; this.next = null; } function LinkedList() { this.dummy = new LinkedNode(null); this.dummy.previous = this.dummy; this.dummy.next = this.dummy; } LinkedList.prototype.getFirst = function() { return this.dummy.next.element; }; Lin...
[["+", 36, 36, 36, 36, 0, 493, 0, 1, 0, 35]]
2
600
3
const readline = require('readline'); class Node { constructor(val) { this.prev = null; this.next = null; this.val = val; } } class DoublyLinkedList { constructor() { this.first = null; this.last = null; this.size = 0; } insert(val) { let n = new Node(val); if (this.first) {...
const readline = require('readline'); class Node { constructor(val) { this.prev = null; this.next = null; this.val = val; } } class DoublyLinkedList { constructor() { this.first = null; this.last = null; this.size = 0; } insert(val) { let n = new Node(val); if (this.first) {...
[["-", 75, 76, 0, 57, 75, 76, 0, 556, 0, 46], ["+", 75, 76, 0, 57, 75, 76, 0, 556, 0, 46]]
2
522
2
<?php class Simulator { public $line = array(); public $n_operations; public $quantum; public $dll2; public function __construct() { fscanf(STDIN, '%d', $this->n_operations); $dll = new \SplDoublyLinkedList(); for ($i = 0; $i < $this->n_operations; $i++) { ...
<?php class Simulator { public $line = array(); public $n_operations; public $quantum; public $dll2; public function __construct() { fscanf(STDIN, '%d', $this->n_operations); $dll = new \SplDoublyLinkedList(); for ($i = 0; $i < $this->n_operations; $i++) { ...
[["-", 15, 23, 0, 16, 31, 69, 0, 606, 0, 141], ["+", 15, 23, 0, 16, 31, 69, 0, 606, 0, 141]]
6
324
2
<?php class Operator { private $operations; private $operations_count; public function doOperations() { fscanf(STDIN, '%d', $this->operations_count); $this->operations = new \SplDoublyLinkedList(); for (;$this->operations_count > 0;$this->operations_count -= 1) { $o...
<?php class Operator { private $operations; private $operations_count; public function doOperations() { fscanf(STDIN, '%d', $this->operations_count); $this->operations = new \SplDoublyLinkedList(); for (;$this->operations_count > 0;$this->operations_count -= 1) { $o...
[["+", 0, 57, 15, 23, 0, 16, 31, 69, 0, 70], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 0, 612], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 0, 73], ["-", 0, 57, 15, 23, 0, 16, 12, 557, 0, 610], ["+", 0, 57, 15, 23, 0, 16, 12, 557, 0, 610]]
6
282
5
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; class Elem { Elem next; Elem prev; int key; Elem(int key) { this.key = key; } } class DoubleyLinkedList { Elem head; DoubleyLinkedList() { head = new Elem(-1); head.next = head; head.prev = head; } ...
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; class Elem { Elem next; Elem prev; int key; Elem(int key) { this.key = key; } } class DoubleyLinkedList { Elem head; DoubleyLinkedList() { head = new Elem(-1); head.next = head; head.prev = head; } ...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
535
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; public class Main { class List { class Cell { Cell prev, next; int v; Cell(int value) { this.v = value; } } Cell cell, lastCell; void insert(int value) { i...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; public class Main { class List { class Cell { Cell prev, next; int v; Cell(int value) { this.v = value; } } Cell cell, lastCell; void insert(int value) { i...
[["+", 75, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 75, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 75, 57, 64, 196, 0, 1, 0, 35]]
3
691
4
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int key; struct node *next; struct node *prev; }; typedef struct node *Node; Node head; void delete (Node); int main() { int n, i, flag, key; char inst[12]; Node index; scanf("%d", &n); head = (Node *)malloc(sizeof(Node)); head->...
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int key; struct node *next; struct node *prev; }; typedef struct node *Node; Node head; void delete (Node); int main() { int n, i, flag, key; char inst[12]; Node index; scanf("%d", &n); head = (Node *)malloc(sizeof(Node)); head->...
[["-", 0, 57, 15, 23, 0, 16, 12, 69, 71, 13], ["+", 0, 57, 15, 23, 0, 16, 12, 69, 71, 13]]
0
395
2
#include <stdio.h> int main() { int n, a, b = 0, e, f, g, i, j; scanf("%d", &n); int x[n]; char c[12]; for (i = 0; i < n; i++) { scanf("%s %d", c, &a); if (c[0] == 'i') { x[i] = a; } else if (c[6] == 'F') { i -= 2; n -= 2; } else if (c[6] == 'L') { i--; n--; ...
#include <stdio.h> int main() { int n, a, b = 0, e, f, g, i, j; scanf("%d", &n); int x[n]; char c[12]; for (i = 0; i < n; i++) { scanf("%s %d", c, &a); if (c[0] == 'i') { x[i] = a; } else if (c[6] == 'F') { i -= 2; n -= 2; } else if (c[6] == 'L') { i--; n--; ...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22]]
0
302
4
def main(): n = int(input()) S = [int(i) for i in input().split()] q = int(input()) T = [int(i) for i in input().split()] return len(set(S) & set(T)) main()
def main(): n = int(input()) S = [int(i) for i in input().split()] q = int(input()) T = [int(i) for i in input().split()] print(len(set(S) & set(T))) main()
[["-", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]]
5
73
4
n = int(input()) S = list(map(int,input().split())) q = int(input()) T = list(map(int,input().split())) C = 0 for i in T: for j in S: if i == j: C += 1 continue print(C)
n = int(input()) S = list(map(int,input().split())) q = int(input()) T = list(map(int,input().split())) C = 0 for i in T: for j in S: if i == j: C += 1 break print(C)
[["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
76
2
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A # Linear Search # Result: import sys ### main ary_s_len = int(sys.stdin.readline().rstrip()) ary_s = [int(x) for x in sys.stdin.readline().rstrip().split(' ')] ary_t_len = int(sys.stdin.readline().rstrip()) ary_t = [int(x) for x in sys.stdin.readlin...
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A # Linear Search # Result: import sys ### main ary_s_len = int(sys.stdin.readline().rstrip()) ary_s = [int(x) for x in sys.stdin.readline().rstrip().split(' ')] ary_t_len = int(sys.stdin.readline().rstrip()) ary_t = [int(x) for x in sys.stdin.readlin...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
135
1
n = int(input()) S = list(map(int,input().split())) q = int(input()) T = list(map(int,input().split())) c = 0 for t in T: for s in S: if(t == s): c+=1 print(c)
n = int(input()) S = list(map(int,input().split())) q = int(input()) T = list(map(int,input().split())) c = 0 for t in T: for s in S: if(t == s): c+=1 break print(c)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
77
1
# encoding: utf-8 def main(): n = eval(input()) t = list(map(int, input().split())) q = eval(input()) s = list(map(int, input().split())) sum = 0 for a in t: sum += 1 if a in s else 0 print(sum) main()
# encoding: utf-8 def main(): n = eval(input()) t = list(map(int, input().split())) q = eval(input()) s = list(map(int, input().split())) sum = 0 for a in s: sum += 1 if a in t else 0 print(sum) main()
[["-", 0, 656, 0, 14, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 14, 8, 196, 0, 7, 12, 22], ["-", 0, 1, 0, 677, 12, 41, 0, 666, 0, 22], ["+", 0, 1, 0, 677, 12, 41, 0, 666, 0, 22]]
5
80
4
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) def linearSearch(A, n, key): i = 0 A.append(key) # ?????? while A[i] != key: i += 1 A.pop() return i != n count = 0 for i in range(q): if linearSearch(S, n, T[i]): print(...
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) def linearSearch(A, n, key): i = 0 A.append(key) # ?????? while A[i] != key: i += 1 A.pop() return i != n count = 0 for i in range(q): if linearSearch(S, n, T[i]): count ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
125
4
# -*- coding: utf-8 -*- def linerSearch(S, key): i = 0 S.append(key) while S[i] != key: i += 1 if i == len(S)-1: S.pop() return False S.pop() return True n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) count = ...
# -*- coding: utf-8 -*- def linerSearch(S, key): i = 0 S.append(key) while S[i] != key: i += 1 if i == len(S)-1: S.pop() return False S.pop() return True n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) count = ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 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
136
4
n = int(input()) a = input() s=list(map(int,a.split())) q = int(input()) a = input() t=list(map(int,a.split())) i = 0 for it in t: if it in t: i = i+1 print(i)
n = int(input()) a = input() s=list(map(int,a.split())) q = int(input()) a = input() t=list(map(int,a.split())) i = 0 for it in t: if it in s: i = i+1 print(i)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
78
2
n = int(input()) S = [int(s) for s in str(input()).split()] q = int(input()) T = [int(t) for t in str(input()).split()] #print(n, S, q, T) print(len([i for i in S if i in T]))
n = int(input()) S = [int(s) for s in str(input()).split()] q = int(input()) T = [int(t) for t in str(input()).split()] #print(n, S, q, T) print(len([i for i in T if i in S]))
[["-", 0, 652, 3, 4, 0, 658, 0, 659, 12, 22], ["+", 0, 652, 3, 4, 0, 658, 0, 659, 12, 22], ["-", 3, 4, 0, 658, 0, 678, 0, 666, 0, 22], ["+", 3, 4, 0, 658, 0, 678, 0, 666, 0, 22]]
5
76
4
def linearSearch(S, key): i = 0 S.append(key) while S[i] != key: i += 1 if i == len(S): return False return True def main(): n = int(input()) S = [int(_) for _ in input().split()] q = int(input()) T = [int(_) for _ in input().split()] Sum = 0 for t in T: ...
def linearSearch(S, key): i = 0 S.append(key) while S[i] != key: i += 1 if i == len(S)-1: return False return True def main(): n = int(input()) S = [int(_) for _ in input().split()] q = int(input()) T = [int(_) for _ in input().split()] Sum = 0 for t in T: ...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
128
2
n = eval(input()) S = list(map(int, input().split())) q = eval(input()) T = list(map(int, input().split())) count = 0 for i in range(n): Search = T[i] for j in range(q): if S[j] == Search: count = count + 1 break print(count)
n = eval(input()) S = list(map(int, input().split())) q = eval(input()) T = list(map(int, input().split())) count = 0 for i in range(q): Search = T[i] for j in range(n): if S[j] == Search: count = count + 1 break print(count)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
93
4
def linearSearch(S,t): L = S + [t] i = 0 while L[i] != t: i += 1 if i == len(L)-1: return 0 else : return 1 if __name__=='__main__': n=input() S=input().split() q=input() T=int,input().split() cnt = 0 for t in T: cnt += linearSearch(S,t) print(cnt)
def linearSearch(S,t): L = S + [t] i = 0 while L[i] != t: i += 1 if i == len(L)-1: return 0 else : return 1 if __name__=='__main__': n=input() S=input().split() q=input() T=input().split() cnt = 0 for t in T: cnt += linearSearch(S,t) print(cnt)
[["-", 64, 196, 0, 1, 0, 662, 12, 432, 0, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 432, 0, 21]]
5
102
2
input() s = input().split() input() t = input().split() cnt = 0 for t1 in t: for s1 in s: if t1 == s1: cnt += 1 print(cnt)
input() s = input().split() input() t = input().split() cnt = 0 for t1 in t: for s1 in s: if t1 == s1: cnt += 1 break print(cnt)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
49
1
#coding:UTF-8 def LS(n,S,q,T): count=0 if n>q: for i in q: if T[i] in S: count+=1 else: for i in n: if S[i] in T: count+=1 print(count) if __name__=="__main__": n=int(input()) S=input().split(" ") q=int(input()) T...
#coding:UTF-8 def LS(n,S,q,T): count=0 if n>q: for i in range(q): if T[i] in S: count+=1 else: for i in range(n): if S[i] in T: count+=1 print(count) if __name__=="__main__": n=int(input()) S=input().split(" ") q=int(...
[["+", 0, 57, 64, 196, 0, 7, 12, 652, 63, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 75, 76, 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, 25]]
5
116
6
# encoding: utf-8 import sys class Solution: def __init__(self): """ init input array """ self.__input = sys.stdin.readlines() @property def solution(self): length_1 = int(self.__input[0]) array_1 = list(map(int, self.__input[1].split())) length_2...
# encoding: utf-8 import sys class Solution: def __init__(self): """ init input array """ self.__input = sys.stdin.readlines() @property def solution(self): length_1 = int(self.__input[0]) array_1 = list(map(int, self.__input[1].split())) length_2...
[["+", 698, 14, 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, 25]]
5
192
3
def linearSearch(A, n, key): i = 0 A.append(key) while A[i] != key: i += 1 del A[n] return i != n if __name__ == '__main__': n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) cnt = 0 for i in q: if lin...
def linearSearch(A, n, key): i = 0 A.append(key) while A[i] != key: i += 1 del A[n] return i != n if __name__ == '__main__': n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) cnt = 0 for i in range(q): ...
[["+", 0, 57, 64, 196, 0, 7, 12, 652, 63, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 25]]
5
124
3
input() s = set(map(int,input().split())) n = int(input()) t = set(map(int,input().split())) c = 0 for i in range(n): if t[i] in s: c += 1 print(c)
input() s = set(map(int,input().split())) n = int(input()) t = tuple(map(int,input().split())) c = 0 for i in range(n): if t[i] in s: c += 1 print(c)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
71
2
n = int(input()) S = [int(i) for i in input().split()] q = int(input()) T = [int(i) for i in input().split()] C = 0 for i in T: for j in S: if j == i: C += 1 print(C)
n = int(input()) S = [int(i) for i in input().split()] q = int(input()) T = [int(i) for i in input().split()] C = 0 for i in T: for j in S: if j == i: C += 1 break print(C)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
77
1
n = int(input()) s = set(input().split()) q = int(input()) t = set(input().split()) print(len(s) - len(s & t))
n = int(input()) s = set(input().split()) q = int(input()) t = set(input().split()) print(len(s & t))
[["-", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 24], ["-", 0, 657, 12, 652, 3, 4, 0, 657, 31, 22]]
5
54
5
n = input() S = input().split() q = input() T = input().split() cnt = 0 for i in range(T): if T[i] in S: cnt += 1 print(cnt)
n = input() S = input().split() q = input() T = input().split() cnt = 0 for i in range(len(T)): if T[i] in S: cnt += 1 print(cnt)
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
54
3
n = int(input()) S = [int(x) for x in input().split()] q = int(input()) T = [int(x) for x in input().split()] res = 0 for num in S: if num in T: res += 1 print(res)
n = int(input()) S = [int(x) for x in input().split()] q = int(input()) T = [int(x) for x in input().split()] res = 0 for num in T: if num in S: res += 1 print(res)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
72
4
n1 = int(input()) s = (input()).split() n2 = int(input()) t = (input()).split() m = [] for i in range(0, n1): key = s[i] for j in range(0, n2): if t[j] == s[i]: m.append(t[j]) break print(len(m))
n1 = int(input()) s = (input()).split() n2 = int(input()) t = (input()).split() m = [] for i in range(0, n2): key = t[i] for j in range(0, n1): if s[j] == t[i]: m.append(s[j]) break print(len(m))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8,...
5
96
12
n = int(input()) S = map(int, input().split()) q = int(input()) T = map(int, input().split()) def ls(A, k): for a in A: if k == a: return True return False print(sum([ls(S, t) for t in T]))
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = map(int, input().split()) def ls(A, k): for a in A: if k == a: return True return False print(sum([ls(S, t) for t in T]))
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
84
3
import sys n = int(sys.stdin.readline().strip()) S = list(map(int, sys.stdin.readline().strip().split(" "))) n = int(sys.stdin.readline().strip()) T = list(map(int, sys.stdin.readline().strip().split(" "))) res = [] for t in T: res.append(S.count(t)) print(sum(res))
import sys n = int(sys.stdin.readline().strip()) S = list(map(int, sys.stdin.readline().strip().split(" "))) n = int(sys.stdin.readline().strip()) T = list(map(int, sys.stdin.readline().strip().split(" "))) res = [] for t in T: res.append(int(S.count(t) != 0)) print(sum(res))
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 666, 0, 652, 3, 4, 0, 25], ["+", 3, 4, 0, 652, 3, 4, 0, 666, 667, 79], ["+", 3, 4, 0, 652, 3, 4, 0, 666, 0, 612]]
5
117
5
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) print(len(S & T))
n = int(input()) S = set(map(int, input().split())) q = int(input()) T = set(map(int, input().split())) print(len(S & T))
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
59
4
input() l = [int(i) for i in input().split()] input() c = 0 for i in input().split(): for j in l: if int(i) == l: c += 1 print(c)
input() l = [int(i) for i in input().split()] input() c = 0 for i in input().split(): for j in l: if int(i) == j: c += 1 break print(c)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
58
3
n=int(input()) S=input().split(' ') q=int(input()) T=input().split(' ') def equal_element(S,T): m=0 for i in range(len(T)): for j in range(len(S)): if S[j]==T[i]: m+=1 return(m) print(equal_element(S,T))
n=int(input()) S=input().split(' ') q=int(input()) T=input().split(' ') def equal_element(S,T): m=0 for i in range(len(T)): for j in range(len(S)): if S[j]==T[i]: m+=1 break return(m) print(equal_element(S,T))
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
100
1
n = int(input()) s = list(map(int, input().split())) q = int(input()) t = list(map(int, input().split())) count = 0 j=0 for i in range(q): s.append(t[i]) while t[i] != s[j]: j += 1 if j != n: count += 1 del s[n] print(count)
n = int(input()) s = list(map(int, input().split())) q = int(input()) t = list(map(int, input().split())) count = 0 for i in range(q): s.append(t[i]) j = 0 while t[i] != s[j]: j += 1 if j != n: count += 1 del s[n] print(count)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
104
6
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) Sset = set(S) Tset = set(T) print(len(Sset and Tset))
n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) Sset = set(S) Tset = set(T) print(len(Sset & Tset))
[["-", 3, 4, 0, 652, 3, 4, 0, 679, 17, 355], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 67]]
5
71
2
ns = int(input()) s = list(map(int, input().split())) nt = int(input()) t = list(map(int, input().split())) count = 0 for i in t: # 配列に番兵を追加 s += [i] print(s) j = 0 while s[j] != i: j += 1 s.pop() if j == ns: continue count += 1 print(count)
ns = int(input()) s = list(map(int, input().split())) nt = int(input()) t = list(map(int, input().split())) count = 0 for i in t: # 配列に番兵を追加 s += [i] j = 0 while s[j] != i: j += 1 s.pop() if j == ns: continue count += 1 print(count)
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
100
4
S=[] T=[] S_num=int(input()) S=input().split() T_num=int(input()) T=input().split() cnt=0 for i in range(S_num): for j in range(T_num): if(S[i]==T[j]): cnt+=1 print(cnt)
S=[] T=[] S_num=int(input()) S=input().split() T_num=int(input()) T=input().split() cnt=0 for i in range(T_num): for j in range(S_num): if(S[j]==T[i]): cnt+=1 break print(cnt)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
81
9
n = int(input()) s = input().split() q = int(input()) t = input().split() c = 0 for i in s: for j in t: if i == j: c += 1 print(c)
n = int(input()) s = input().split() q = int(input()) t = input().split() c = 0 for i in t: for j in s: if i == j: c += 1 break print(c)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
59
5
n1=int(input()) l1=list(input().split()) n2=int(input()) l2=list(input().split()) cnt=0 for x in l1: if x in l2: cnt+=1 print(cnt)
n1=int(input()) l1=list(input().split()) n2=int(input()) l2=list(input().split()) cnt=0 for x in l2: if x in l1: cnt=cnt+1 print(cnt)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", ...
5
60
8
n=int(input()) s=input().split() q=int(input()) t=input().split() cnt=0 for i in range(q): for j in range(n): if s[i]==t[j]: cnt+=1 break print(cnt)
n=int(input()) s=input().split() q=int(input()) t=input().split() cnt=0 for i in range(q): for j in range(n): if s[j]==t[i]: cnt+=1 break print(cnt)
[["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22]]
5
72
4
n = int(input()) s = list(map(int,input().split())) q = int(input()) r = list(map(int,input().split())) cou = 0 for i in range(q): for j in range(n): if(s[i] == r[j]): cou += 1 break print(cou)
n = int(input()) s = list(map(int,input().split())) q = int(input()) r = list(map(int,input().split())) cou = 0 for i in range(q): for j in range(n): if(s[j] == r[i]): cou += 1 break print(cou)
[["-", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22], ["+", 0, 57, 15, 23, 0, 666, 0, 206, 206, 22]]
5
90
4
#coding:utf-8 n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) cnt = 0 for t in T: for s in S: if t == s: cnt += 1 print(cnt)
#coding:utf-8 n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) cnt = 0 for t in T: for s in S: if t == s: cnt += 1 break print(cnt)
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
76
1
#coding:utf-8 n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) def search_banpei(array, target, cnt): tmp = array[len(array)-1] array[len(array)-1] = target n = 0 while array[n] != target: n += 1 array[len(array)-1] = tmp if n <...
#coding:utf-8 n = int(input()) S = list(map(int, input().split())) q = int(input()) T = list(map(int, input().split())) def search_banpei(array, target, cnt): tmp = array[len(array)-1] array[len(array)-1] = target n = 0 while array[n] != target: n += 1 array[len(array)-1] = tmp if n <...
[["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 22]]
5
188
2
def linearSearch(key, list): for e in list: if key == e: return 1 return 0 N1 = int(input()) arr1 = [int(n) for n in input().split()] N2 = int(input()) arr2 = [int(n) for n in input().split()] print(sum([linearSearch(key, arr2) for key in arr1]))
def linearSearch(key, list): for e in list: if key == e: return 1 return 0 N1 = int(input()) arr1 = [int(n) for n in input().split()] N2 = int(input()) arr2 = [int(n) for n in input().split()] print(sum([linearSearch(key, arr1) for key in arr2]))
[["-", 3, 4, 0, 658, 8, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 658, 8, 652, 3, 4, 0, 22], ["-", 0, 652, 3, 4, 0, 658, 0, 659, 12, 22], ["+", 0, 652, 3, 4, 0, 658, 0, 659, 12, 22]]
5
92
4
def linearSearch(key, list, N): list[N] = key i = 0 while l[i] != key: i += 1 return int(i != N) N1 = int(input()) arr1 = [int(n) for n in input().split()] + [0] N2 = int(input()) arr2 = [int(n) for n in input().split()] print(sum([linearSearch(key, arr1, N1) for key in arr2]))
def linearSearch(key, list, N): list[N] = key i = 0 while list[i] != key: i += 1 return int(i != N) N1 = int(input()) arr1 = [int(n) for n in input().split()] + [0] N2 = int(input()) arr2 = [int(n) for n in input().split()] print(sum([linearSearch(key, arr1, N1) for key in arr2]))
[["-", 8, 196, 0, 52, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 52, 15, 666, 0, 206, 51, 22]]
5
113
2
from collections import deque if __name__ == '__main__': n = int(input()) dll = deque() for _ in range(n): command = input().split() if command[0] == 'insert': dll.appendleft(command[1]) elif command[0] == 'delete': dll.remove(command[1]) elif command...
from collections import deque if __name__ == '__main__': n = int(input()) dll = deque() for _ in range(n): command = input().split() if command[0] == 'insert': dll.appendleft(command[1]) elif command[0] == 'delete': try: dll.remove(command[1])...
[["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 247], ["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 102], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 672], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 22], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 674, 0, 675]]
5
114
6
import sys from collections import deque def main(): line = sys.stdin.readlines() deq = deque() for i in range(1, int(line[0]) + 1): input_command = line[i] if input_command[0] == 'i': # 'insert index' deq.appendleft(input_command[7:]) elif input_command[0] == ...
import sys from collections import deque def main(): line = sys.stdin.readlines() deq = deque() for i in range(1, int(line[0]) + 1): input_command = line[i] if input_command[0] == 'i': # 'insert index' deq.appendleft(input_command[7:-1]) elif input_command[0] =...
[["+", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["+", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612], ["+", 0, 662, 12, 206, 206, 663, 0, 664, 17, 33], ["+", 0, 662, 12, 206, 206, 663, 0, 664, 28, 612]]
5
156
4
from collections import deque n = int(input()) commands = [input() for _ in range(n)] # splitとかしてると間に合わない l = deque() for com in commands: if com[0]=='i': l.appendleft(com[6:-1]) elif com[6]=='F': l.popleft() elif com[6]=='L': l.pop() else: try: l.remove(com...
from collections import deque n = int(input()) commands = [input() for _ in range(n)] # splitとかしてると間に合わない l = deque() for com in commands: if com[0]=='i': l.appendleft(com[7:]) elif com[6]=='F': l.popleft() elif com[6]=='L': l.pop() else: try: l.remove(com[7...
[["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612]]
5
122
6
from collections import deque l=deque() for _ in range(eval(input())): a=input().split() c=a[0][-4] if c=="i": l.popleft() elif c=="L": l.pop() elif c=="s": l.extendleft(a[1]) else: try: l.remove(a[1]) except: pass print(" ".join(l))
from collections import deque l=deque() for _ in range(eval(input())): a=input().split() c=a[0][-4] if c=="i": l.popleft() elif c=="L": l.pop() elif c=="s": l.appendleft(a[1]) else: try: l.remove(a[1]) except: pass print(" ".join(l))
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
108
2
from collections import deque n=int(input()) que = deque() for i in range(n): o = input() if o == 'deleteFirst': del que[0] elif o == 'deleteLast': del que[-1] else: c,p = o.split() p = int(p) if c == 'insert': que.appendleft(p) elif c == 'dele...
# -*- coding: utf-8 -*- from collections import deque n=int(input()) que = deque() for i in range(n): o = input() if o == 'deleteFirst': del que[0] elif o == 'deleteLast': del que[-1] else: c,p = o.split() p = int(p) if c == 'insert': que.appendleft(p)...
[["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 247], ["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 102], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 672], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 674, 0, 675]]
5
114
5
import sys from collections import deque n = int( sys.stdin.readline( ) ) que = deque( ) lines = sys.stdin.readlines() for line in lines: op = line.split( " " ) if "insert" == op[0]: que.appendleft( op[1] ) elif "delete" == op[0]: if op[1] in que: que.remove( op[1] ) elif "deleteFirst" == op[0] : que.popl...
import sys from collections import deque n = int( sys.stdin.readline( ) ) que = deque( ) lines = sys.stdin.readlines() for line in lines: op = line.rstrip().split( " " ) if "insert" == op[0]: que.appendleft( op[1] ) elif "delete" == op[0]: if op[1] in que: que.remove( op[1] ) elif "deleteFirst" == op[0] : ...
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131]]
5
134
4
import sys import collections n=int(input()) ans=collections.deque() while n: n-=1 s=sys.stdin.readline().rstrip().split(' ') if s[0][0]=='i': ans.appendleft(s[1]) elif s[0][-3]=='r': ans.popleft() elif s[0][-3]=='a': ans.pop() else: ans.remove(s[1]) sys.stdout.wr...
import sys import collections n=int(input()) ans=collections.deque() while n: n-=1 s=sys.stdin.readline().rstrip().split(' ') if s[0][0]=='i': ans.appendleft(s[1]) elif s[0][-3]=='r': ans.popleft() elif s[0][-3]=='a': ans.pop() else: try: ans.remove(s[...
[["+", 0, 57, 75, 76, 8, 196, 0, 246, 0, 247], ["+", 0, 57, 75, 76, 8, 196, 0, 246, 0, 102], ["+", 75, 76, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 75, 76, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 674, 0, 675]]
5
134
5
from collections import deque n = int(input()) stack = deque() for i in range(n): i = input() if "insert" in i: stack.insert(0, int(i[7:])) elif "delete " in i: if int(i[7:]) in stack: stack.remove(int(i[7:])) elif "deleteFirst" in i: stack.pop(0) elif "deleteLast" in i: stack.pop() print(" ".join(ma...
from collections import deque n = int(input()) stack = deque() for i in range(n): i = input() if "insert" in i: stack.appendleft(int(i[7:])) elif "delete " in i: if int(i[7:]) in stack: stack.remove(int(i[7:])) elif "deleteFirst" in i: stack.popleft() elif "deleteLast" in i: stack.pop() print(" ".joi...
[["-", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21]]
5
125
7
# -*- coding: utf-8 -*- n = eval(input()) l = [] tail = 0 for i in range(n): cmd = input().split() if cmd[0] == "insert": l.append(cmd[1]) elif cmd[0] == "delete": l.pop(len(l) - l[::-1].index(cmd[1]) -1) elif cmd[0] == "deleteFirst": l.pop() elif cmd[0] == "deleteLast": ...
# -*- coding: utf-8 -*- n = eval(input()) l = [] tail = 0 for i in range(n): cmd = input().split() if cmd[0] == "insert": l.append(cmd[1]) elif cmd[0] == "delete": try: l.pop(len(l) - l[::-1].index(cmd[1]) -1) except ValueError: pass elif cmd[0] == "delete...
[["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 247], ["+", 0, 57, 75, 665, 64, 196, 0, 246, 0, 102], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 672], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 22], ["+", 75, 665, 64, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 674, 0, 675]]
5
138
6