node_ids
sequencelengths 4
1.4k
| edge_index
sequencelengths 1
2.22k
| text
sequencelengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
17,
12,
13,
30,
0,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
9,
30,
0,
13,
2,
13,
17,
9,
29,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
165,
5
],
[
165,
6
],
[
6,
7
],
[
165,
8
],
[
8,
9
],
[
8,
10
],
[
165,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
13,
22
],
[
22,
23
],
[
22,
24
],
[
13,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
13,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
13,
51
],
[
51,
52
],
[
51,
53
],
[
13,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
13,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
13,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
11,
100
],
[
100,
101
],
[
165,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
104,
115
],
[
115,
116
],
[
104,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
139,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
152,
158
],
[
104,
159
],
[
102,
160
],
[
160,
161
],
[
102,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n static Scanner scan;\n static int count = 0;\n\n public static void main(String[] args) {\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }\n\n public static void binarySearch(int[] s, int t){\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n static Scanner scan;\n static int count = 0;\n\n public static void main(String[] args) {\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }\n\n public static void binarySearch(int[] s, int t){\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }\n}",
"Main",
"static Scanner scan;",
"scan",
"static int count = 0;",
"count",
"0",
"public static void main(String[] args) {\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }",
"main",
"{\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }",
"scan = new Scanner(System.in)",
"scan",
"new Scanner(System.in)",
"final int slen = scan.nextInt();",
"slen",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] s = new int[slen];",
"s",
"new int[slen]",
"slen",
"for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < slen",
"i",
"slen",
"i++",
"i++",
"i",
"{\n s[i] = scan.nextInt();\n }",
"{\n s[i] = scan.nextInt();\n }",
"s[i] = scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"final int tlen = scan.nextInt();",
"tlen",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] t = new int[tlen];",
"t",
"new int[tlen]",
"tlen",
"for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < tlen",
"i",
"tlen",
"i++",
"i++",
"i",
"{\n t[i] = scan.nextInt();\n }",
"{\n t[i] = scan.nextInt();\n }",
"t[i] = scan.nextInt()",
"t[i]",
"t",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < tlen",
"i",
"tlen",
"i++",
"i++",
"i",
"{\n binarySearch(s, t[i]);\n }",
"{\n binarySearch(s, t[i]);\n }",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static void binarySearch(int[] s, int t){\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }",
"binarySearch",
"{\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }",
"int hi = 0;",
"hi",
"0",
"int ti = s.length-1;",
"ti",
"s.length-1",
"s.length",
"s",
"s.length",
"1",
"int p;",
"p",
"while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }",
"hi <= ti",
"hi",
"ti",
"{\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }",
"p = (hi + ti) / 2",
"p",
"(hi + ti) / 2",
"(hi + ti)",
"hi",
"ti",
"2",
"if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }",
"s[p] == t",
"s[p]",
"s",
"p",
"t",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }",
"s[p] < t",
"s[p]",
"s",
"p",
"t",
"{\n hi = p + 1;\n continue;\n }",
"hi = p + 1",
"hi",
"p + 1",
"p",
"1",
"continue;",
"{\n ti = p - 1;\n continue;\n }",
"ti = p - 1",
"ti",
"p - 1",
"p",
"1",
"continue;",
"return;",
"int[] s",
"s",
"int t",
"t",
"public class Main {\n\n static Scanner scan;\n static int count = 0;\n\n public static void main(String[] args) {\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }\n\n public static void binarySearch(int[] s, int t){\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }\n}",
"public class Main {\n\n static Scanner scan;\n static int count = 0;\n\n public static void main(String[] args) {\n scan = new Scanner(System.in);\n\n // get input\n final int slen = scan.nextInt();\n int[] s = new int[slen];\n for(int i = 0; i < slen; i++) {\n s[i] = scan.nextInt();\n }\n\n final int tlen = scan.nextInt();\n int[] t = new int[tlen];\n for(int i = 0; i < tlen; i++){\n t[i] = scan.nextInt();\n }\n\n // carry out binary search\n for(int i = 0; i < tlen; i++) {\n binarySearch(s, t[i]);\n }\n\n System.out.println(count);\n }\n\n public static void binarySearch(int[] s, int t){\n int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;\n int p;\n\n while(hi <= ti) {\n p = (hi + ti) / 2; //探索対象インデックス\n if(s[p] == t) {\n count++;\n break;\n } else if(s[p] < t) {\n hi = p + 1;\n continue;\n } else {\n ti = p - 1;\n continue;\n }\n }\n\n return;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static Scanner scan;
static int count = 0;
public static void main(String[] args) {
scan = new Scanner(System.in);
// get input
final int slen = scan.nextInt();
int[] s = new int[slen];
for(int i = 0; i < slen; i++) {
s[i] = scan.nextInt();
}
final int tlen = scan.nextInt();
int[] t = new int[tlen];
for(int i = 0; i < tlen; i++){
t[i] = scan.nextInt();
}
// carry out binary search
for(int i = 0; i < tlen; i++) {
binarySearch(s, t[i]);
}
System.out.println(count);
}
public static void binarySearch(int[] s, int t){
int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;
int p;
while(hi <= ti) {
p = (hi + ti) / 2; //探索対象インデックス
if(s[p] == t) {
count++;
break;
} else if(s[p] < t) {
hi = p + 1;
continue;
} else {
ti = p - 1;
continue;
}
}
return;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
52
],
[
52,
53
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
8,
74
],
[
74,
75
],
[
74,
76
],
[
8,
77
],
[
77,
78
],
[
8,
79
],
[
79,
80
],
[
8,
81
],
[
81,
82
],
[
8,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
114,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
126,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
8,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
6,
150
],
[
150,
151
]
] | [
"import java.util.Scanner;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint S[] = new int[n];\n\t\tint i;\n\t\tfor(i=0; i<n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint T[] = new int[n];\n\t\tint j;\n\t\tfor(j=0; j<q; j++){\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tint C=0;\n\t\tint left, right, mid;\n\t\tfor(j=0; j<q; j++){\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint S[] = new int[n];\n\t\tint i;\n\t\tfor(i=0; i<n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint T[] = new int[n];\n\t\tint j;\n\t\tfor(j=0; j<q; j++){\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tint C=0;\n\t\tint left, right, mid;\n\t\tfor(j=0; j<q; j++){\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint S[] = new int[n];\n\t\tint i;\n\t\tfor(i=0; i<n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint T[] = new int[n];\n\t\tint j;\n\t\tfor(j=0; j<q; j++){\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tint C=0;\n\t\tint left, right, mid;\n\t\tfor(j=0; j<q; j++){\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint S[] = new int[n];\n\t\tint i;\n\t\tfor(i=0; i<n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint T[] = new int[n];\n\t\tint j;\n\t\tfor(j=0; j<q; j++){\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tint C=0;\n\t\tint left, right, mid;\n\t\tfor(j=0; j<q; j++){\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int S[] = new int[n];",
"S",
"new int[n]",
"n",
"int i;",
"i",
"for(i=0; i<n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int T[] = new int[n];",
"T",
"new int[n]",
"n",
"int j;",
"j",
"for(j=0; j<q; j++){\n\t\t\tT[j] = sc.nextInt();\n\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tT[j] = sc.nextInt();\n\t\t}",
"{\n\t\t\tT[j] = sc.nextInt();\n\t\t}",
"T[j] = sc.nextInt()",
"T[j]",
"T",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int C=0;",
"C",
"0",
"int left",
"left",
"right",
"right",
"mid;",
"mid",
"for(j=0; j<q; j++){\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tleft = 0;\n\t\t\tright = n;\n\t\t\twhile(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"left = 0",
"left",
"0",
"right = n",
"right",
"n",
"while(left < right){\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tif(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(T[j] == S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"T[j] == S[mid]",
"T[j]",
"T",
"j",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C++",
"C",
"break;",
"if(T[j] < S[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t} else{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"T[j] < S[mid]",
"T[j]",
"T",
"j",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int S[] = new int[n];
int i;
for(i=0; i<n; i++){
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int T[] = new int[n];
int j;
for(j=0; j<q; j++){
T[j] = sc.nextInt();
}
int C=0;
int left, right, mid;
for(j=0; j<q; j++){
left = 0;
right = n;
while(left < right){
mid = (left + right) / 2;
if(T[j] == S[mid]){
C++;
break;
} else if(T[j] < S[mid]){
right = mid;
} else{
left = mid + 1;
}
}
}
System.out.println(C);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
40,
4,
18,
13,
18,
13,
13,
30,
4,
18,
13,
18,
13,
13,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
18,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
119,
14
],
[
119,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
34,
39
],
[
17,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
62,
65
],
[
65,
66
],
[
65,
67
],
[
17,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
74,
75
],
[
17,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
78,
83
],
[
17,
84
],
[
84,
85
],
[
84,
86
],
[
17,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
100,
107
],
[
107,
108
],
[
108,
109
],
[
17,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
15,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int size = Integer.parseInt(br.readLine());",
"size",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"Set<String> set = new HashSet<String>();",
"set",
"new HashSet<String>()",
"String[] strInputNums = br.readLine().split(\" \");",
"strInputNums",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}",
"if (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}",
"!set.contains(strInputNums[i])",
"set.contains(strInputNums[i])",
"set.contains",
"set",
"strInputNums[i]",
"strInputNums",
"i",
"{\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}",
"set.add(strInputNums[i])",
"set.add",
"set",
"strInputNums[i]",
"strInputNums",
"i",
"size = Integer.parseInt(br.readLine())",
"size",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"strInputNums = br.readLine().split(\" \")",
"strInputNums",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int matchCnt = 0;",
"matchCnt",
"0",
"for (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}",
"if (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}",
"set.contains(strInputNums[i])",
"set.contains",
"set",
"strInputNums[i]",
"strInputNums",
"i",
"{\n\t\t\t\tmatchCnt++;\n\t\t\t}",
"matchCnt++",
"matchCnt",
"System.out.println(matchCnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"matchCnt",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint size = Integer.parseInt(br.readLine());\n\t\tSet<String> set = new HashSet<String>();\n\t\tString[] strInputNums = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (!set.contains(strInputNums[i])) {\n\t\t\t\tset.add(strInputNums[i]);\n\t\t\t}\n\t\t}\n\t\tsize = Integer.parseInt(br.readLine());\n\t\tstrInputNums = br.readLine().split(\" \");\n\t\tint matchCnt = 0;\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (set.contains(strInputNums[i])) {\n\t\t\t\tmatchCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(matchCnt);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(br.readLine());
Set<String> set = new HashSet<String>();
String[] strInputNums = br.readLine().split(" ");
for (int i = 0; i < size; i++) {
if (!set.contains(strInputNums[i])) {
set.add(strInputNums[i]);
}
}
size = Integer.parseInt(br.readLine());
strInputNums = br.readLine().split(" ");
int matchCnt = 0;
for (int i = 0; i < size; i++) {
if (set.contains(strInputNums[i])) {
matchCnt++;
}
}
System.out.println(matchCnt);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
30,
40,
13,
29,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
176,
5
],
[
176,
6
],
[
6,
7
],
[
176,
8
],
[
8,
9
],
[
176,
10
],
[
10,
11
],
[
176,
12
],
[
12,
13
],
[
176,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
16,
22
],
[
22,
23
],
[
22,
24
],
[
16,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
16,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
16,
51
],
[
51,
52
],
[
51,
53
],
[
16,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
14,
75
],
[
75,
76
],
[
176,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
79,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
102,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
111,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
79,
129
],
[
129,
130
],
[
77,
131
],
[
131,
132
],
[
176,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
139,
141
],
[
139,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
149,
150
],
[
135,
151
],
[
151,
152
],
[
176,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
159,
161
],
[
155,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
155,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
153,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.util.Scanner;\n\n/**\n * Created by zhangrunfeng on 2/17/20\n */\n\npublic class Main {\n private int N;\n private int[] increArr;\n\n private int Q;\n private int[] arrQ;\n\n public Main (Scanner sc) {\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }\n\n private boolean binarySearch(int targetVal) {\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }\n\n public int countQinN() {\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n private int N;\n private int[] increArr;\n\n private int Q;\n private int[] arrQ;\n\n public Main (Scanner sc) {\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }\n\n private boolean binarySearch(int targetVal) {\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }\n\n public int countQinN() {\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }\n}",
"Main",
"private int N;",
"N",
"private int[] increArr;",
"increArr",
"private int Q;",
"Q",
"private int[] arrQ;",
"arrQ",
"public Main (Scanner sc) {\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }",
"Main",
"{\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }",
"N = sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"increArr = new int[N]",
"increArr",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n increArr[i] = sc.nextInt();\n }",
"{\n increArr[i] = sc.nextInt();\n }",
"increArr[i] = sc.nextInt()",
"increArr[i]",
"increArr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Q = sc.nextInt()",
"Q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"arrQ = new int[Q]",
"arrQ",
"new int[Q]",
"Q",
"for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < Q",
"i",
"Q",
"i++",
"i++",
"i",
"{\n arrQ[i] = sc.nextInt();\n }",
"{\n arrQ[i] = sc.nextInt();\n }",
"arrQ[i] = sc.nextInt()",
"arrQ[i]",
"arrQ",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Scanner sc",
"sc",
"private boolean binarySearch(int targetVal) {\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }",
"int leftIx = 0",
"leftIx",
"0",
"rightIdx = N-1;",
"rightIdx",
"N-1",
"N",
"1",
"while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }",
"leftIx <= rightIdx",
"leftIx",
"rightIdx",
"{\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }",
"int midIx = leftIx + (rightIdx - leftIx) / 2;",
"midIx",
"leftIx + (rightIdx - leftIx) / 2",
"leftIx",
"(rightIdx - leftIx) / 2",
"(rightIdx - leftIx)",
"rightIdx",
"leftIx",
"2",
"if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }",
"increArr[midIx] == targetVal",
"increArr[midIx]",
"increArr",
"midIx",
"targetVal",
"{\n return true;\n }",
"return true;",
"true",
"if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }",
"increArr[midIx] > targetVal",
"increArr[midIx]",
"increArr",
"midIx",
"targetVal",
"{\n rightIdx = midIx - 1;\n }",
"rightIdx = midIx - 1",
"rightIdx",
"midIx - 1",
"midIx",
"1",
"{\n leftIx = midIx + 1;\n }",
"leftIx = midIx + 1",
"leftIx",
"midIx + 1",
"midIx",
"1",
"return false;",
"false",
"int targetVal",
"targetVal",
"public int countQinN() {\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }",
"countQinN",
"{\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }",
"int count = 0;",
"count",
"0",
"for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }",
"int targetVal",
"arrQ",
"{\n if (binarySearch(targetVal)) {\n count++;\n }\n }",
"{\n if (binarySearch(targetVal)) {\n count++;\n }\n }",
"if (binarySearch(targetVal)) {\n count++;\n }",
"binarySearch(targetVal)",
"binarySearch",
"targetVal",
"{\n count++;\n }",
"count++",
"count",
"return count;",
"count",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Main m = new Main(sc);",
"m",
"new Main(sc)",
"int res = m.countQinN();",
"res",
"m.countQinN()",
"m.countQinN",
"m",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n private int N;\n private int[] increArr;\n\n private int Q;\n private int[] arrQ;\n\n public Main (Scanner sc) {\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }\n\n private boolean binarySearch(int targetVal) {\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }\n\n public int countQinN() {\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }\n}",
"public class Main {\n private int N;\n private int[] increArr;\n\n private int Q;\n private int[] arrQ;\n\n public Main (Scanner sc) {\n N = sc.nextInt();\n increArr = new int[N];\n for (int i = 0; i < N; i++) {\n increArr[i] = sc.nextInt();\n }\n\n Q = sc.nextInt();\n arrQ = new int[Q];\n for (int i = 0; i < Q; i++) {\n arrQ[i] = sc.nextInt();\n }\n }\n\n private boolean binarySearch(int targetVal) {\n int leftIx = 0, rightIdx = N-1;\n while (leftIx <= rightIdx) {\n int midIx = leftIx + (rightIdx - leftIx) / 2;\n if (increArr[midIx] == targetVal) {\n return true;\n } else if (increArr[midIx] > targetVal) {\n rightIdx = midIx - 1;\n } else {\n leftIx = midIx + 1;\n }\n }\n return false;\n }\n\n public int countQinN() {\n int count = 0;\n for (int targetVal : arrQ) {\n if (binarySearch(targetVal)) {\n count++;\n }\n }\n return count;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Main m = new Main(sc);\n int res = m.countQinN();\n System.out.println(res);\n }\n}",
"Main"
] | import java.util.Scanner;
/**
* Created by zhangrunfeng on 2/17/20
*/
public class Main {
private int N;
private int[] increArr;
private int Q;
private int[] arrQ;
public Main (Scanner sc) {
N = sc.nextInt();
increArr = new int[N];
for (int i = 0; i < N; i++) {
increArr[i] = sc.nextInt();
}
Q = sc.nextInt();
arrQ = new int[Q];
for (int i = 0; i < Q; i++) {
arrQ[i] = sc.nextInt();
}
}
private boolean binarySearch(int targetVal) {
int leftIx = 0, rightIdx = N-1;
while (leftIx <= rightIdx) {
int midIx = leftIx + (rightIdx - leftIx) / 2;
if (increArr[midIx] == targetVal) {
return true;
} else if (increArr[midIx] > targetVal) {
rightIdx = midIx - 1;
} else {
leftIx = midIx + 1;
}
}
return false;
}
public int countQinN() {
int count = 0;
for (int targetVal : arrQ) {
if (binarySearch(targetVal)) {
count++;
}
}
return count;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Main m = new Main(sc);
int res = m.countQinN();
System.out.println(res);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
41,
13,
17,
0,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
2,
13,
17,
4,
18,
13,
0,
18,
13,
17,
40,
17,
0,
18,
13,
2,
13,
17,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
2,
13,
17,
41,
13,
2,
13,
17,
41,
13,
40,
17,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
13,
41,
13,
13,
0,
13,
2,
13,
17,
0,
13,
40,
17,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
13,
41,
13,
13,
14,
2,
2,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
186,
8
],
[
186,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
11,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
11,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
11,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
11,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
82,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
82,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
82,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
82,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
116,
122
],
[
122,
123
],
[
122,
124
],
[
116,
125
],
[
125,
126
],
[
125,
127
],
[
82,
128
],
[
128,
129
],
[
128,
130
],
[
82,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
82,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
82,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
146,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
154,
160
],
[
160,
161
],
[
160,
162
],
[
154,
163
],
[
163,
164
],
[
163,
165
],
[
82,
166
],
[
166,
167
],
[
166,
168
],
[
82,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
169,
175
],
[
175,
176
],
[
11,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
9,
183
],
[
183,
184
],
[
0,
185
],
[
185,
186
],
[
185,
187
]
] | [
"import java.util.*;\nimport java.lang.Math;\npublic class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math;",
"Math",
"java.lang",
"public class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N=sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int A[];",
"A",
"int ans=0;",
"ans",
"0",
"A=new int[N+2]",
"A",
"new int[N+2]",
"N+2",
"N",
"2",
"for(int i=0;i<N;i++) A[i+1]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"A[i+1]=sc.nextInt();",
"A[i+1]=sc.nextInt()",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"sc.nextInt()",
"sc.nextInt",
"sc",
"A[0]=-2000000000",
"A[0]",
"A",
"0",
"-2000000000",
"2000000000",
"A[N+1]=2000000000",
"A[N+1]",
"A",
"N+1",
"N",
"1",
"2000000000",
"int q=sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }",
"{\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }",
"int key1=sc.nextInt();",
"key1",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int key2=key1+1;",
"key2",
"key1+1",
"key1",
"1",
"int hi=N+1;",
"hi",
"N+1",
"N",
"1",
"int lo=-1;",
"lo",
"-1",
"1",
"while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }",
"hi-lo>1",
"hi-lo",
"hi",
"lo",
"1",
"{\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }",
"int mid=(hi+lo)/2;",
"mid",
"(hi+lo)/2",
"(hi+lo)",
"hi",
"lo",
"2",
"if(A[mid]>=key1) hi=mid;\n else lo=mid;",
"A[mid]>=key1",
"A[mid]",
"A",
"mid",
"key1",
"hi=mid",
"hi",
"mid",
"lo=mid",
"lo",
"mid",
"int res1=hi;",
"res1",
"hi",
"hi=N+1",
"hi",
"N+1",
"N",
"1",
"lo=-1",
"lo",
"-1",
"1",
"while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }",
"hi-lo>1",
"hi-lo",
"hi",
"lo",
"1",
"{\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }",
"int mid=(hi+lo)/2;",
"mid",
"(hi+lo)/2",
"(hi+lo)",
"hi",
"lo",
"2",
"if(A[mid]>=key2) hi=mid;\n else lo=mid;",
"A[mid]>=key2",
"A[mid]",
"A",
"mid",
"key2",
"hi=mid",
"hi",
"mid",
"lo=mid",
"lo",
"mid",
"int res2=hi;",
"res2",
"hi",
"if(res2-res1>0) ans++;",
"res2-res1>0",
"res2-res1",
"res2",
"res1",
"0",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int A[];\n int ans=0;\n A=new int[N+2];\n for(int i=0;i<N;i++) A[i+1]=sc.nextInt();\n A[0]=-2000000000;\n A[N+1]=2000000000;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n int key1=sc.nextInt();\n int key2=key1+1;\n int hi=N+1;\n int lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key1) hi=mid;\n else lo=mid;\n }\n int res1=hi;\n hi=N+1;\n lo=-1;\n while(hi-lo>1){\n int mid=(hi+lo)/2;\n if(A[mid]>=key2) hi=mid;\n else lo=mid;\n }\n int res2=hi;\n if(res2-res1>0) ans++;\n }\n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.*;
import java.lang.Math;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int A[];
int ans=0;
A=new int[N+2];
for(int i=0;i<N;i++) A[i+1]=sc.nextInt();
A[0]=-2000000000;
A[N+1]=2000000000;
int q=sc.nextInt();
for(int i=0;i<q;i++){
int key1=sc.nextInt();
int key2=key1+1;
int hi=N+1;
int lo=-1;
while(hi-lo>1){
int mid=(hi+lo)/2;
if(A[mid]>=key1) hi=mid;
else lo=mid;
}
int res1=hi;
hi=N+1;
lo=-1;
while(hi-lo>1){
int mid=(hi+lo)/2;
if(A[mid]>=key2) hi=mid;
else lo=mid;
}
int res2=hi;
if(res2-res1>0) ans++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
77,
79
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
104,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
122,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
14,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
12,
136
],
[
136,
137
],
[
10,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
153,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
162,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
175,
177
],
[
140,
178
],
[
178,
179
],
[
138,
180
],
[
180,
181
],
[
138,
182
],
[
182,
183
],
[
138,
184
],
[
184,
185
],
[
138,
186
],
[
186,
187
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\nclass Main {\n\n\n public static void main(String args[]) throws IOException{\n\n\t BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t int n = Integer.parseInt( br.readLine() );\n\t String[] string = br.readLine().split(\" \");\n int[] S = new int[n];\n\n\n for(int i = 0; i < n; i++ ){\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }\n\n int q = Integer.parseInt( br.readLine() );\n\t String[] stringq = br.readLine().split(\" \");\n int[] T = new int[q];\n\n\n for(int i = 0; i < q; i++ ){\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }\n\n\n int answer = 0;\n\n\n for(int i = 0; i < q ; i++ ){\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }\n\n System.out.println(answer);\n\n\n }\n\n\n\n\n public static int binarysearch(int[] S, int right, int left, int key){\n\n\n\t while(left < right){\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }\n\n\n\t return 0;\n }\n\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Main {\n\n\n public static void main(String args[]) throws IOException{\n\n\t BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t int n = Integer.parseInt( br.readLine() );\n\t String[] string = br.readLine().split(\" \");\n int[] S = new int[n];\n\n\n for(int i = 0; i < n; i++ ){\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }\n\n int q = Integer.parseInt( br.readLine() );\n\t String[] stringq = br.readLine().split(\" \");\n int[] T = new int[q];\n\n\n for(int i = 0; i < q; i++ ){\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }\n\n\n int answer = 0;\n\n\n for(int i = 0; i < q ; i++ ){\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }\n\n System.out.println(answer);\n\n\n }\n\n\n\n\n public static int binarysearch(int[] S, int right, int left, int key){\n\n\n\t while(left < right){\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }\n\n\n\t return 0;\n }\n\n\n}",
"Main",
"public static void main(String args[]) throws IOException{\n\n\t BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t int n = Integer.parseInt( br.readLine() );\n\t String[] string = br.readLine().split(\" \");\n int[] S = new int[n];\n\n\n for(int i = 0; i < n; i++ ){\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }\n\n int q = Integer.parseInt( br.readLine() );\n\t String[] stringq = br.readLine().split(\" \");\n int[] T = new int[q];\n\n\n for(int i = 0; i < q; i++ ){\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }\n\n\n int answer = 0;\n\n\n for(int i = 0; i < q ; i++ ){\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }\n\n System.out.println(answer);\n\n\n }",
"main",
"{\n\n\t BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t int n = Integer.parseInt( br.readLine() );\n\t String[] string = br.readLine().split(\" \");\n int[] S = new int[n];\n\n\n for(int i = 0; i < n; i++ ){\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }\n\n int q = Integer.parseInt( br.readLine() );\n\t String[] stringq = br.readLine().split(\" \");\n int[] T = new int[q];\n\n\n for(int i = 0; i < q; i++ ){\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }\n\n\n int answer = 0;\n\n\n for(int i = 0; i < q ; i++ ){\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }\n\n System.out.println(answer);\n\n\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt( br.readLine() );",
"n",
"Integer.parseInt( br.readLine() )",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] string = br.readLine().split(\" \");",
"string",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++ ){\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }",
"{\n\n \t S[i] = Integer.parseInt( string[i] );\n\n }",
"S[i] = Integer.parseInt( string[i] )",
"S[i]",
"S",
"i",
"Integer.parseInt( string[i] )",
"Integer.parseInt",
"Integer",
"string[i]",
"string",
"i",
"int q = Integer.parseInt( br.readLine() );",
"q",
"Integer.parseInt( br.readLine() )",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] stringq = br.readLine().split(\" \");",
"stringq",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0; i < q; i++ ){\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }",
"{\n\n \t T[i] = Integer.parseInt( stringq[i] );\n\n }",
"T[i] = Integer.parseInt( stringq[i] )",
"T[i]",
"T",
"i",
"Integer.parseInt( stringq[i] )",
"Integer.parseInt",
"Integer",
"stringq[i]",
"stringq",
"i",
"int answer = 0;",
"answer",
"0",
"for(int i = 0; i < q ; i++ ){\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }",
"{\n\n answer += binarysearch(S , n, 0, T[i] );\n\n }",
"answer += binarysearch(S , n, 0, T[i] )",
"answer",
"binarysearch(S , n, 0, T[i] )",
"binarysearch",
"S",
"n",
"0",
"T[i]",
"T",
"i",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String args[]",
"args",
"public static int binarysearch(int[] S, int right, int left, int key){\n\n\n\t while(left < right){\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }\n\n\n\t return 0;\n }",
"binarysearch",
"{\n\n\n\t while(left < right){\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }\n\n\n\t return 0;\n }",
"while(left < right){\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }",
"left < right",
"left",
"right",
"{\n\t\t int mid = (right + left)/2;\n if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }\n\t }",
"int mid = (right + left)/2;",
"mid",
"(right + left)/2",
"(right + left)",
"right",
"left",
"2",
"if( S[mid] == key ){\n return 1;\n }\n else if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n return 1;\n }",
"return 1;",
"1",
"if(key < S[mid] ){\n \t right = mid;\n }\n else{\n \t left = mid + 1;\n }",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n \t right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n \t left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int[] S",
"S",
"int right",
"right",
"int left",
"left",
"int key",
"key"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt( br.readLine() );
String[] string = br.readLine().split(" ");
int[] S = new int[n];
for(int i = 0; i < n; i++ ){
S[i] = Integer.parseInt( string[i] );
}
int q = Integer.parseInt( br.readLine() );
String[] stringq = br.readLine().split(" ");
int[] T = new int[q];
for(int i = 0; i < q; i++ ){
T[i] = Integer.parseInt( stringq[i] );
}
int answer = 0;
for(int i = 0; i < q ; i++ ){
answer += binarysearch(S , n, 0, T[i] );
}
System.out.println(answer);
}
public static int binarysearch(int[] S, int right, int left, int key){
while(left < right){
int mid = (right + left)/2;
if( S[mid] == key ){
return 1;
}
else if(key < S[mid] ){
right = mid;
}
else{
left = mid + 1;
}
}
return 0;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
29,
8,
2,
13,
17,
4,
13,
13,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
135,
20
],
[
135,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
29,
31
],
[
29,
32
],
[
32,
33
],
[
32,
34
],
[
25,
35
],
[
21,
36
],
[
36,
37
],
[
21,
38
],
[
38,
39
],
[
135,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
48,
50
],
[
48,
51
],
[
40,
52
],
[
52,
53
],
[
40,
54
],
[
54,
55
],
[
135,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
62,
64
],
[
58,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
58,
92
],
[
92,
93
],
[
92,
94
],
[
58,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
58,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
118,
123
],
[
123,
124
],
[
124,
125
],
[
58,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
56,
132
],
[
132,
133
],
[
0,
134
],
[
134,
135
],
[
134,
136
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.sql.Array;\nimport java.util.*;\n\npublic class Main {\n\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n\n public static void main(String[] args){\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }\n}\n",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.sql.Array;",
"Array",
"java.sql",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n\n public static void main(String[] args){\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }\n}",
"Main",
"static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}",
"gcd",
"{return b>0?gcd(b,a%b):a;}",
"return b>0?gcd(b,a%b):a;",
"b>0?gcd(b,a%b):a",
"b>0",
"b",
"0",
"gcd(b,a%b)",
"gcd",
"b",
"a%b",
"a",
"b",
"a",
"long a",
"a",
"long b",
"b",
"static long lcm (long a, long b) {return a*b/gcd(a,b);}",
"lcm",
"{return a*b/gcd(a,b);}",
"return a*b/gcd(a,b);",
"a*b/gcd(a,b)",
"a*b",
"a",
"b",
"gcd(a,b)",
"gcd",
"a",
"b",
"long a",
"a",
"long b",
"b",
"public static void main(String[] args){\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }",
"main",
"{\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Set<Long> set = new HashSet<Long>();",
"set",
"new HashSet<Long>()",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long S=sc.nextLong();\n set.add(S);\n }",
"{\n long S=sc.nextLong();\n set.add(S);\n }",
"long S=sc.nextLong();",
"S",
"sc.nextLong()",
"sc.nextLong",
"sc",
"set.add(S)",
"set.add",
"set",
"S",
"long ans=0;",
"ans",
"0",
"int q=sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }",
"{\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }",
"long T = sc.nextLong();",
"T",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (set.contains(T)) {\n ans++;\n }",
"set.contains(T)",
"set.contains",
"set",
"T",
"{\n ans++;\n }",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n\n public static void main(String[] args){\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }\n}",
"public class Main {\n\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n\n public static void main(String[] args){\n\t// write your code here\n Scanner sc=new Scanner(System.in);\n Set<Long> set = new HashSet<Long>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n long S=sc.nextLong();\n set.add(S);\n }\n long ans=0;\n int q=sc.nextInt();\n for(int i=0;i<q;i++){\n long T = sc.nextLong();\n if (set.contains(T)) {\n ans++;\n }\n }\n System.out.println(ans);\n\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;
public class Main {
static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
static long lcm (long a, long b) {return a*b/gcd(a,b);}
public static void main(String[] args){
// write your code here
Scanner sc=new Scanner(System.in);
Set<Long> set = new HashSet<Long>();
int n=sc.nextInt();
for(int i=0;i<n;i++){
long S=sc.nextLong();
set.add(S);
}
long ans=0;
int q=sc.nextInt();
for(int i=0;i<q;i++){
long T = sc.nextLong();
if (set.contains(T)) {
ans++;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
162,
5
],
[
162,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
8,
72
],
[
72,
73
],
[
72,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
162,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
107,
114
],
[
114,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
128,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
107,
153
],
[
153,
154
],
[
105,
155
],
[
155,
156
],
[
105,
157
],
[
157,
158
],
[
105,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}\n\t\n\tpublic static int binarySearch(int n, int[] A, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}\n\t\n\tpublic static int binarySearch(int n, int[] A, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int num1 = scan.nextInt();",
"num1",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] array1 = new int[num1+1];",
"array1",
"new int[num1+1]",
"num1+1",
"num1",
"1",
"for(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num1",
"i",
"num1",
"i++",
"i++",
"i",
"{\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}",
"array1[i] = scan.nextInt()",
"array1[i]",
"array1",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int num2 = scan.nextInt();",
"num2",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] array2 = new int[num2];",
"array2",
"new int[num2]",
"num2",
"for(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num2",
"i",
"num2",
"i++",
"i++",
"i",
"{\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}",
"array2[i] = scan.nextInt()",
"array2[i]",
"array2",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num2",
"i",
"num2",
"i++",
"i++",
"i",
"{\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}",
"{\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}",
"count += binarySearch(num1, array1, array2[i])",
"count",
"binarySearch(num1, array1, array2[i])",
"binarySearch",
"num1",
"array1",
"array2[i]",
"array2",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int binarySearch(int n, int[] A, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}",
"A[mid] == key",
"A[mid]",
"A",
"mid",
"key",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int n",
"n",
"int[] A",
"A",
"int key",
"key",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}\n\t\n\tpublic static int binarySearch(int n, int[] A, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num1 = scan.nextInt();\n\t\tint[] array1 = new int[num1+1];\n\t\t //配列1個目\n\t\tfor(int i = 0; i < num1; i++) {\n\t\t\tarray1[i] = scan.nextInt();\n\t\t}\n\t\t//配列2個目\n\t\tint num2 = scan.nextInt();\n\t\tint[] array2 = new int[num2];\n\t\tfor(int i = 0; i < num2; i++) {\n\t\t\tarray2[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint count = 0; //2つの配列の共通の個数\n\t\t\n\t\tfor(int i = 0; i < num2; i++) {\n\t\tcount += binarySearch(num1, array1, array2[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n}\n\t\n\tpublic static int binarySearch(int n, int[] A, int key) {\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid;\n\t\twhile(left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(A[mid] == key) {\n\t\t\t\treturn 1;\n\t\t\t} else if(key < A[mid]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner scan = new Scanner(System.in);
int num1 = scan.nextInt();
int[] array1 = new int[num1+1];
//配列1個目
for(int i = 0; i < num1; i++) {
array1[i] = scan.nextInt();
}
//配列2個目
int num2 = scan.nextInt();
int[] array2 = new int[num2];
for(int i = 0; i < num2; i++) {
array2[i] = scan.nextInt();
}
int count = 0; //2つの配列の共通の個数
for(int i = 0; i < num2; i++) {
count += binarySearch(num1, array1, array2[i]);
}
System.out.println(count);
}
public static int binarySearch(int n, int[] A, int key) {
int left = 0;
int right = n;
int mid;
while(left < right) {
mid = (left + right) / 2;
if(A[mid] == key) {
return 1;
} else if(key < A[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return 0;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
38,
5,
13,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
37,
20,
0,
13,
20,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
37,
20,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
22,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
30,
36
],
[
36,
37
],
[
37,
38
],
[
30,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
39,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
11,
55
],
[
55,
56
],
[
9,
57
],
[
57,
58
],
[
9,
59
],
[
59,
60
],
[
9,
61
],
[
61,
62
],
[
7,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
65,
70
],
[
70,
71
],
[
65,
72
],
[
72,
73
],
[
65,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
87,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
87,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
87,
109
],
[
109,
110
],
[
109,
111
],
[
87,
113
],
[
113,
114
],
[
113,
115
],
[
87,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
117,
127
],
[
127,
128
],
[
128,
129
],
[
117,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
87,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
87,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
87,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
87,
163
],
[
163,
164
],
[
163,
165
],
[
87,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
167,
177
],
[
177,
178
],
[
178,
179
],
[
167,
180
],
[
181,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
181,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
87,
195
],
[
195,
196
],
[
195,
197
],
[
87,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
198,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
205,
207
],
[
198,
208
],
[
208,
209
],
[
209,
210
],
[
198,
211
],
[
212,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
215,
217
],
[
215,
218
],
[
218,
219
],
[
218,
220
],
[
215,
221
],
[
221,
222
],
[
221,
223
],
[
87,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
224,
229
],
[
63,
230
],
[
230,
231
]
] | [
"import java.util.*;\nimport java.io.*;\n\nclass Main{\n static int binarySearch(int[] tempArray, int n, int key){\n int left = 0;\n int right = n;\n\n while(left < right){\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return 0;\n }\n\n public static void main(String[] args){\n int count;\n int[] array1;\n int[] array2;\n int[] array3;\n int flag = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main{\n static int binarySearch(int[] tempArray, int n, int key){\n int left = 0;\n int right = n;\n\n while(left < right){\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return 0;\n }\n\n public static void main(String[] args){\n int count;\n int[] array1;\n int[] array2;\n int[] array3;\n int flag = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }\n}",
"Main",
"static int binarySearch(int[] tempArray, int n, int key){\n int left = 0;\n int right = n;\n\n while(left < right){\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return 0;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n\n while(left < right){\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n return 0;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right){\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(tempArray[mid] == key){\n return 1;\n }else if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }",
"tempArray[mid] == key",
"tempArray[mid]",
"tempArray",
"mid",
"key",
"{\n return 1;\n }",
"return 1;",
"1",
"if(key < tempArray[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }",
"key < tempArray[mid]",
"key",
"tempArray[mid]",
"tempArray",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int[] tempArray",
"tempArray",
"int n",
"n",
"int key",
"key",
"public static void main(String[] args){\n int count;\n int[] array1;\n int[] array2;\n int[] array3;\n int flag = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }",
"main",
"{\n int count;\n int[] array1;\n int[] array2;\n int[] array3;\n int flag = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }",
"int count;",
"count",
"int[] array1;",
"array1",
"int[] array2;",
"array2",
"int[] array3;",
"array3",
"int flag = 0;",
"flag",
"0",
"try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }",
"catch(Exception e){\n System.out.println(\"ERROR\");\n }",
"Exception e",
"{\n System.out.println(\"ERROR\");\n }",
"System.out.println(\"ERROR\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"ERROR\"",
"{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n if(count > 100000){\n throw new Exception(\"ERROE\");\n }\n array1 = new int[count];\n array3 = new int[count];\n\n for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }\n\n str = scan.next();\n count = Integer.parseInt(str);\n\n if(count > 50000){\n throw new Exception(\"ERROE\");\n }\n array2 = new int[count];\n for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }\n\n\n //配列の確認部分\n // for(int i = 0; i < array1.length; i++){\n // System.out.print(array1[i] + \" \");\n // }\n // System.out.println();\n // for(int i = 0; i < array2.length; i++){\n // System.out.print(array2[i] + \" \");\n // }\n // System.out.println();\n\n //線形探索\n // count = 0;\n // for(int i = 0; i < array2.length; i++){\n // for(int j = 0; j < array1.length; j++){\n // flag = 0;\n // if(array2[i] == array1[j]){\n // for(int k = 0; k < count; k++){\n // if(array2[i] == array3[k]){\n // flag = -1;\n // break;\n // }\n // }\n // if(flag != -1){\n // array3[count] = array2[i];\n // count++;\n // }\n // }\n // }\n // }\n\n count = 0;\n for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }\n\n System.out.println(count);\n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"String str = scan.next();",
"str",
"scan.next()",
"scan.next",
"scan",
"count = Integer.parseInt(str)",
"count",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"if(count > 100000){\n throw new Exception(\"ERROE\");\n }",
"count > 100000",
"count",
"100000",
"{\n throw new Exception(\"ERROE\");\n }",
"throw new Exception(\"ERROE\");",
"new Exception(\"ERROE\")",
"array1 = new int[count]",
"array1",
"new int[count]",
"count",
"array3 = new int[count]",
"array3",
"new int[count]",
"count",
"for(int i = 0; i < array1.length; i++){\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array1.length",
"i",
"array1.length",
"array1",
"array1.length",
"i++",
"i++",
"i",
"{\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }",
"{\n str = scan.next();\n array1[i] = Integer.parseInt(str);\n }",
"str = scan.next()",
"str",
"scan.next()",
"scan.next",
"scan",
"array1[i] = Integer.parseInt(str)",
"array1[i]",
"array1",
"i",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"str = scan.next()",
"str",
"scan.next()",
"scan.next",
"scan",
"count = Integer.parseInt(str)",
"count",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"if(count > 50000){\n throw new Exception(\"ERROE\");\n }",
"count > 50000",
"count",
"50000",
"{\n throw new Exception(\"ERROE\");\n }",
"throw new Exception(\"ERROE\");",
"new Exception(\"ERROE\")",
"array2 = new int[count]",
"array2",
"new int[count]",
"count",
"for(int i = 0; i < array2.length; i++){\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array2.length",
"i",
"array2.length",
"array2",
"array2.length",
"i++",
"i++",
"i",
"{\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }",
"{\n str = scan.next();\n array2[i] = Integer.parseInt(str);\n }",
"str = scan.next()",
"str",
"scan.next()",
"scan.next",
"scan",
"array2[i] = Integer.parseInt(str)",
"array2[i]",
"array2",
"i",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"count = 0",
"count",
"0",
"for(int i = 0; i < array2.length; i++){\n count += binarySearch(array1, array1.length, array2[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array2.length",
"i",
"array2.length",
"array2",
"array2.length",
"i++",
"i++",
"i",
"{\n count += binarySearch(array1, array1.length, array2[i]);\n }",
"{\n count += binarySearch(array1, array1.length, array2[i]);\n }",
"count += binarySearch(array1, array1.length, array2[i])",
"count",
"binarySearch(array1, array1.length, array2[i])",
"binarySearch",
"array1",
"array1.length",
"array1",
"array1.length",
"array2[i]",
"array2",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.*;
import java.io.*;
class Main{
static int binarySearch(int[] tempArray, int n, int key){
int left = 0;
int right = n;
while(left < right){
int mid = (left + right) / 2;
if(tempArray[mid] == key){
return 1;
}else if(key < tempArray[mid]){
right = mid;
}else{
left = mid + 1;
}
}
return 0;
}
public static void main(String[] args){
int count;
int[] array1;
int[] array2;
int[] array3;
int flag = 0;
try{
Scanner scan = new Scanner(System.in);
String str = scan.next();
count = Integer.parseInt(str);
if(count > 100000){
throw new Exception("ERROE");
}
array1 = new int[count];
array3 = new int[count];
for(int i = 0; i < array1.length; i++){
str = scan.next();
array1[i] = Integer.parseInt(str);
}
str = scan.next();
count = Integer.parseInt(str);
if(count > 50000){
throw new Exception("ERROE");
}
array2 = new int[count];
for(int i = 0; i < array2.length; i++){
str = scan.next();
array2[i] = Integer.parseInt(str);
}
//配列の確認部分
// for(int i = 0; i < array1.length; i++){
// System.out.print(array1[i] + " ");
// }
// System.out.println();
// for(int i = 0; i < array2.length; i++){
// System.out.print(array2[i] + " ");
// }
// System.out.println();
//線形探索
// count = 0;
// for(int i = 0; i < array2.length; i++){
// for(int j = 0; j < array1.length; j++){
// flag = 0;
// if(array2[i] == array1[j]){
// for(int k = 0; k < count; k++){
// if(array2[i] == array3[k]){
// flag = -1;
// break;
// }
// }
// if(flag != -1){
// array3[count] = array2[i];
// count++;
// }
// }
// }
// }
count = 0;
for(int i = 0; i < array2.length; i++){
count += binarySearch(array1, array1.length, array2[i]);
}
System.out.println(count);
}catch(Exception e){
System.out.println("ERROR");
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
41,
13,
17,
2,
2,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
81,
96
],
[
96,
97
],
[
97,
98
],
[
81,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
101,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
8,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
6,
133
],
[
133,
134
]
] | [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tint[] l1 = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tl1[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l1);\n\t\t\n\t\tint q = sc.nextInt();\n\t\tint[] l2 = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tl2[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l2);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0, j = 0; i<n && j<q; i++) {\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\t\n\t\t\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tint[] l1 = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tl1[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l1);\n\t\t\n\t\tint q = sc.nextInt();\n\t\tint[] l2 = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tl2[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l2);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0, j = 0; i<n && j<q; i++) {\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\t\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tint[] l1 = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tl1[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l1);\n\t\t\n\t\tint q = sc.nextInt();\n\t\tint[] l2 = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tl2[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l2);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0, j = 0; i<n && j<q; i++) {\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\t\n\t\t\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tint[] l1 = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tl1[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l1);\n\t\t\n\t\tint q = sc.nextInt();\n\t\tint[] l2 = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tl2[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(l2);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0, j = 0; i<n && j<q; i++) {\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\t\n\t\t\n\t\t\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] l1 = new int[n];",
"l1",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tl1[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tl1[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tl1[i] = sc.nextInt();\n\t\t}",
"l1[i] = sc.nextInt()",
"l1[i]",
"l1",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(l1)",
"Arrays.sort",
"Arrays",
"l1",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] l2 = new int[q];",
"l2",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tl2[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tl2[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tl2[i] = sc.nextInt();\n\t\t}",
"l2[i] = sc.nextInt()",
"l2[i]",
"l2",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(l2)",
"Arrays.sort",
"Arrays",
"l2",
"int count = 0;",
"count",
"0",
"for (int i = 0, j = 0; i<n && j<q; i++) {\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}",
"int i = 0, j = 0;",
"int i = 0",
"i",
"0",
"j = 0;",
"j",
"0",
"i<n && j<q",
"i<n",
"i",
"n",
"j<q",
"j",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}",
"if (l1[i] == l2[j]) {\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}else if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}",
"l1[i] == l2[j]",
"l1[i]",
"l1",
"i",
"l2[j]",
"l2",
"j",
"{\n\t\t\t\tcount++;\n\t\t\t\tj++;\n\t\t\t}",
"count++",
"count",
"j++",
"j",
"if (l1[i]>l2[j]) {\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}",
"l1[i]>l2[j]",
"l1[i]",
"l1",
"i",
"l2[j]",
"l2",
"j",
"{\n\t\t\t\ti--;\n\t\t\t\tj++;\n\t\t\t}",
"i--",
"i",
"j++",
"j",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] l1 = new int[n];
for (int i = 0; i < n; i++) {
l1[i] = sc.nextInt();
}
Arrays.sort(l1);
int q = sc.nextInt();
int[] l2 = new int[q];
for (int i = 0; i < q; i++) {
l2[i] = sc.nextInt();
}
Arrays.sort(l2);
int count = 0;
for (int i = 0, j = 0; i<n && j<q; i++) {
if (l1[i] == l2[j]) {
count++;
j++;
}else if (l1[i]>l2[j]) {
i--;
j++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
29,
40,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
4,
18,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
146,
5
],
[
146,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
8,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
31,
37
],
[
37,
38
],
[
38,
39
],
[
31,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
40,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
40,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
52,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
8,
62
],
[
62,
63
],
[
63,
64
],
[
6,
65
],
[
65,
66
],
[
6,
67
],
[
67,
68
],
[
146,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
71,
80
],
[
80,
81
],
[
80,
82
],
[
71,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
71,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
71,
109
],
[
109,
110
],
[
109,
111
],
[
71,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
112,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
127,
130
],
[
130,
131
],
[
131,
132
],
[
126,
133
],
[
125,
134
],
[
134,
135
],
[
135,
136
],
[
71,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
69,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] | [
"import java.util.*;\n\npublic class Main{\n\tstatic int search(int[] l,int key){\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}\n\n\tpublic static void main(String[] args){\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tstatic int search(int[] l,int key){\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}\n\n\tpublic static void main(String[] args){\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}\n}",
"Main",
"static int search(int[] l,int key){\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}",
"search",
"{\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}",
"int left = 0 ;",
"left",
"0",
"int right = l.length;",
"right",
"l.length",
"l",
"l.length",
"int mid ;",
"mid",
"while(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}",
"l[mid] == key",
"l[mid]",
"l",
"mid",
"key",
"{\n\t\t\t\treturn mid;\n\t\t\t}",
"return mid;",
"mid",
"if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}",
"l[mid] < key",
"l[mid]",
"l",
"mid",
"key",
"{\n\t\t\t\tleft = mid +1 ;\n\t\t\t}",
"left = mid +1",
"left",
"mid +1",
"mid",
"1",
"if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}",
"key < l[mid]",
"key",
"l[mid]",
"l",
"mid",
"{\n\t\t\t\tright = mid;\n\t\t\t}",
"right = mid",
"right",
"mid",
"return -1 ;",
"-1",
"1",
"int[] l",
"l",
"int key",
"key",
"public static void main(String[] args){\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}",
"main",
"{\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] l = new int[n];",
"l",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}",
"{\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}",
"l[i]=scanner.nextInt()",
"l[i]",
"l",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int sum = 0;",
"sum",
"0",
"for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }",
"{\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }",
"if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}",
"search(l, scanner.nextInt() ) >= 0",
"search(l, scanner.nextInt() )",
"search",
"l",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"0",
"{\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main{\n\tstatic int search(int[] l,int key){\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}\n\n\tpublic static void main(String[] args){\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}\n}",
"public class Main{\n\tstatic int search(int[] l,int key){\n\t\tint left = 0 ;\n\t\tint right = l.length;\n\t\tint mid ;\n\t\t\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2 ;\n\t\t\tif(l[mid] == key){\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse if(l[mid] < key){\n\t\t\t\tleft = mid +1 ;\n\t\t\t}\n\t\t\telse if(key < l[mid]){\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1 ;\n\t}\n\n\tpublic static void main(String[] args){\n\t Scanner scanner = new Scanner(System.in);\n\n\t int n = scanner.nextInt();\n\t int[] l = new int[n];\n\t for(int i = 0; i < n; i++){\n\t\t\t\tl[i]=scanner.nextInt();\n\t\t\t}\n\n\t int q = scanner.nextInt();\n\t int sum = 0;\n\n\t for(int i = 0; i < q; i++){\n\t if(search(l, scanner.nextInt() ) >= 0){\n\t\t\t\t\t\tsum++;\n\t\t\t\t\t}\n\t }\n\n\t System.out.println(sum);\n\t}\n}",
"Main"
] | import java.util.*;
public class Main{
static int search(int[] l,int key){
int left = 0 ;
int right = l.length;
int mid ;
while(left < right){
mid = (left + right) / 2 ;
if(l[mid] == key){
return mid;
}
else if(l[mid] < key){
left = mid +1 ;
}
else if(key < l[mid]){
right = mid;
}
}
return -1 ;
}
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] l = new int[n];
for(int i = 0; i < n; i++){
l[i]=scanner.nextInt();
}
int q = scanner.nextInt();
int sum = 0;
for(int i = 0; i < q; i++){
if(search(l, scanner.nextInt() ) >= 0){
sum++;
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
41,
13,
20,
4,
18,
13,
41,
13,
17,
28,
13,
4,
18,
4,
18,
13,
17,
30,
30,
14,
4,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
57,
11
],
[
57,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
19,
20
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
25,
26
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
30,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
40,
45
],
[
45,
46
],
[
46,
47
],
[
14,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
12,
54
],
[
54,
55
],
[
0,
56
],
[
56,
57
],
[
56,
58
]
] | [
"import java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}\n\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));",
"set1",
"new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")))",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"int count=0;",
"count",
"0",
"for(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"String str",
"scanner.nextLine().split(\" \")",
"scanner.nextLine().split",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"\" \"",
"{\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"if(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}",
"set1.contains(str)",
"set1.contains",
"set1",
"str",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tscanner.nextLine();\n\t\tHashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(\" \")));\n\t\tscanner.nextLine();\n\t\tint count=0;\n\t\tfor(String str: scanner.nextLine().split(\" \")) {\n\t\t\tif(set1.contains(str)) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}\n\n}",
"Main"
] | import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
scanner.nextLine();
HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
scanner.nextLine();
int count=0;
for(String str: scanner.nextLine().split(" ")) {
if(set1.contains(str)) {
count++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
4,
18,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
20,
13,
42,
2,
40,
13,
17,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
20,
13,
42,
2,
40,
13,
17,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
249,
14
],
[
249,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
17,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
17,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
17,
49
],
[
49,
50
],
[
49,
51
],
[
17,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
66,
69
],
[
69,
70
],
[
69,
71
],
[
65,
72
],
[
72,
73
],
[
73,
74
],
[
17,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
15,
81
],
[
81,
82
],
[
249,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
85,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
106,
112
],
[
112,
113
],
[
113,
114
],
[
106,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
85,
131
],
[
131,
132
],
[
83,
133
],
[
133,
134
],
[
83,
135
],
[
135,
136
],
[
249,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
143,
149
],
[
137,
150
],
[
150,
151
],
[
249,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
154,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
154,
166
],
[
166,
167
],
[
166,
168
],
[
154,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
170,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
183,
184
],
[
183,
185
],
[
154,
186
],
[
186,
187
],
[
152,
188
],
[
188,
189
],
[
249,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
196,
197
],
[
195,
198
],
[
192,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
201,
203
],
[
192,
204
],
[
204,
205
],
[
204,
206
],
[
192,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
208,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
214,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
221,
222
],
[
221,
223
],
[
192,
224
],
[
224,
225
],
[
190,
226
],
[
226,
227
],
[
249,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
232,
235
],
[
228,
236
],
[
236,
237
],
[
249,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
242,
245
],
[
238,
246
],
[
246,
247
],
[
0,
248
],
[
248,
249
],
[
248,
250
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.regex.Pattern;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean binarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n\n static boolean isNumber(String num) {\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.regex.Pattern;",
"Pattern",
"java.util.regex",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean binarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n\n static boolean isNumber(String num) {\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = ip(br.readLine());",
"n",
"ip(br.readLine())",
"ip",
"br.readLine()",
"br.readLine",
"br",
"int[] s = createListInt(br.readLine());",
"s",
"createListInt(br.readLine())",
"createListInt",
"br.readLine()",
"br.readLine",
"br",
"int q = ip(br.readLine());",
"q",
"ip(br.readLine())",
"ip",
"br.readLine()",
"br.readLine",
"br",
"int[] t = createListInt(br.readLine());",
"t",
"createListInt(br.readLine())",
"createListInt",
"br.readLine()",
"br.readLine",
"br",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(s, t[i])) {\n count++;\n }\n }",
"{\n if (binarySearch(s, t[i])) {\n count++;\n }\n }",
"if (binarySearch(s, t[i])) {\n count++;\n }",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static boolean binarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = a.length;",
"right",
"a.length",
"a",
"a.length",
"while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"a[mid] == key",
"a[mid]",
"a",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"key < a[mid]",
"key",
"a[mid]",
"a",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] a",
"a",
"int key",
"key",
"static boolean isNumber(String num) {\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }",
"isNumber",
"{\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }",
"return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();",
"Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find()",
"Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find",
"Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num)",
"Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher",
"Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\")",
"Pattern.compile",
"Pattern",
"\"^\\\\-?[0-9]*\\\\.?[0-9]+$\"",
"num",
"String num",
"num",
"static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }",
"createListInt",
"{\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }",
"String[] lines = line.split(\" \");",
"lines",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int n = lines.length;",
"n",
"lines.length",
"lines",
"lines.length",
"int[] list = new int[n];",
"list",
"new int[n]",
"n",
"while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }",
"n-- > 0",
"n--",
"n",
"0",
"{\n list[n] = Integer.parseInt(lines[n]);\n }",
"list[n] = Integer.parseInt(lines[n])",
"list[n]",
"list",
"n",
"Integer.parseInt(lines[n])",
"Integer.parseInt",
"Integer",
"lines[n]",
"lines",
"n",
"return list;",
"list",
"String line",
"line",
"static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }",
"createListLong",
"{\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }",
"String[] lines = line.split(\" \");",
"lines",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int n = lines.length;",
"n",
"lines.length",
"lines",
"lines.length",
"long[] list = new long[n];",
"list",
"new long[n]",
"n",
"while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }",
"n-- > 0",
"n--",
"n",
"0",
"{\n list[n] = Long.parseLong(lines[n]);\n }",
"list[n] = Long.parseLong(lines[n])",
"list[n]",
"list",
"n",
"Long.parseLong(lines[n])",
"Long.parseLong",
"Long",
"lines[n]",
"lines",
"n",
"return list;",
"list",
"String line",
"line",
"static int ip(String s) {\n return Integer.parseInt(s);\n }",
"ip",
"{\n return Integer.parseInt(s);\n }",
"return Integer.parseInt(s);",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"String s",
"s",
"static long lp(String s) {\n return Long.parseLong(s);\n }",
"lp",
"{\n return Long.parseLong(s);\n }",
"return Long.parseLong(s);",
"Long.parseLong(s)",
"Long.parseLong",
"Long",
"s",
"String s",
"s",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean binarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n\n static boolean isNumber(String num) {\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] s = createListInt(br.readLine());\n int q = ip(br.readLine());\n int[] t = createListInt(br.readLine());\n int count = 0;\n // Arrays.sort(s);\n for (int i = 0; i < q; i++) {\n if (binarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean binarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n } else if (key < a[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n\n static boolean isNumber(String num) {\n return Pattern.compile(\"^\\\\-?[0-9]*\\\\.?[0-9]+$\").matcher(num).find();\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = ip(br.readLine());
int[] s = createListInt(br.readLine());
int q = ip(br.readLine());
int[] t = createListInt(br.readLine());
int count = 0;
// Arrays.sort(s);
for (int i = 0; i < q; i++) {
if (binarySearch(s, t[i])) {
count++;
}
}
System.out.println(count);
}
static boolean binarySearch(int[] a, int key) {
int left = 0;
int right = a.length;
while (left < right) {
int mid = (left + right) / 2;
if (a[mid] == key) {
return true;
} else if (key < a[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return false;
}
static boolean isNumber(String num) {
return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
}
static int[] createListInt(String line) {
String[] lines = line.split(" ");
int n = lines.length;
int[] list = new int[n];
while (n-- > 0) {
list[n] = Integer.parseInt(lines[n]);
}
return list;
}
static long[] createListLong(String line) {
String[] lines = line.split(" ");
int n = lines.length;
long[] list = new long[n];
while (n-- > 0) {
list[n] = Long.parseLong(lines[n]);
}
return list;
}
static int ip(String s) {
return Integer.parseInt(s);
}
static long lp(String s) {
return Long.parseLong(s);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
18,
13,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
40,
13,
29,
13,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
77,
79
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
12,
113
],
[
113,
114
],
[
10,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
117,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
130,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
151,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
168,
170
],
[
163,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
163,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
130,
181
],
[
181,
182
],
[
117,
183
],
[
183,
184
],
[
115,
185
],
[
185,
186
],
[
115,
187
],
[
187,
188
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\nclass Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] ss = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tString[] qq = br.readLine().split(\" \");\n\n\t\tint[] Q = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S, Q));\n\n\t}\n\n\tstatic int binarySearch(int[] nums, int[] key) {\n\n\t\tint i = 0;\n\n\t\tint count = 0;\n\n\t\twhile (i != key.length) {\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}\n\n\t\treturn count;\n\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] ss = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tString[] qq = br.readLine().split(\" \");\n\n\t\tint[] Q = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S, Q));\n\n\t}\n\n\tstatic int binarySearch(int[] nums, int[] key) {\n\n\t\tint i = 0;\n\n\t\tint count = 0;\n\n\t\twhile (i != key.length) {\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}\n\n\t\treturn count;\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] ss = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tString[] qq = br.readLine().split(\" \");\n\n\t\tint[] Q = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S, Q));\n\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] ss = br.readLine().split(\" \");\n\n\t\tint[] S = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tString[] qq = br.readLine().split(\" \");\n\n\t\tint[] Q = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}\n\n\t\tSystem.out.println(binarySearch(S, Q));\n\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] ss = br.readLine().split(\" \");",
"ss",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(ss[i]);\n\t\t}",
"S[i] = Integer.parseInt(ss[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(ss[i])",
"Integer.parseInt",
"Integer",
"ss[i]",
"ss",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] qq = br.readLine().split(\" \");",
"qq",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] Q = new int[q];",
"Q",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}",
"{\n\t\t\tQ[i] = Integer.parseInt(qq[i]);\n\t\t}",
"Q[i] = Integer.parseInt(qq[i])",
"Q[i]",
"Q",
"i",
"Integer.parseInt(qq[i])",
"Integer.parseInt",
"Integer",
"qq[i]",
"qq",
"i",
"System.out.println(binarySearch(S, Q))",
"System.out.println",
"System.out",
"System",
"System.out",
"binarySearch(S, Q)",
"binarySearch",
"S",
"Q",
"String[] args",
"args",
"static int binarySearch(int[] nums, int[] key) {\n\n\t\tint i = 0;\n\n\t\tint count = 0;\n\n\t\twhile (i != key.length) {\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}\n\n\t\treturn count;\n\n\t}",
"binarySearch",
"{\n\n\t\tint i = 0;\n\n\t\tint count = 0;\n\n\t\twhile (i != key.length) {\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}\n\n\t\treturn count;\n\n\t}",
"int i = 0;",
"i",
"0",
"int count = 0;",
"count",
"0",
"while (i != key.length) {\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}",
"i != key.length",
"i",
"key.length",
"key",
"key.length",
"{\n\n\t\t\tint left = 0;\n\n\t\t\tint right = nums.length;\n\n\t\t\twhile (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = nums.length;",
"right",
"nums.length",
"nums",
"nums.length",
"while (left < right) {\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}",
"left < right",
"left",
"right",
"{\n\n\t\t\t\tint mid = (left + right) / 2;\n\n\t\t\t\tif (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}\n\t\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (nums[mid] == key[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"nums[mid] == key[i]",
"nums[mid]",
"nums",
"mid",
"key[i]",
"key",
"i",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if (nums[mid] > key[i]) {\n\t\t\t\t\tright = mid;\n\t\t\t\t} else {\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"nums[mid] > key[i]",
"nums[mid]",
"nums",
"mid",
"key[i]",
"key",
"i",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"{\n\t\t\t\t\tleft = mid + 1;\n\t\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"i++",
"i",
"return count;",
"count",
"int[] nums",
"nums",
"int[] key",
"key"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] ss = br.readLine().split(" ");
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = Integer.parseInt(ss[i]);
}
int q = Integer.parseInt(br.readLine());
String[] qq = br.readLine().split(" ");
int[] Q = new int[q];
for (int i = 0; i < q; i++) {
Q[i] = Integer.parseInt(qq[i]);
}
System.out.println(binarySearch(S, Q));
}
static int binarySearch(int[] nums, int[] key) {
int i = 0;
int count = 0;
while (i != key.length) {
int left = 0;
int right = nums.length;
while (left < right) {
int mid = (left + right) / 2;
if (nums[mid] == key[i]) {
count++;
break;
} else if (nums[mid] > key[i]) {
right = mid;
} else {
left = mid + 1;
}
}
i++;
}
return count;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
163,
5
],
[
163,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
22,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
30,
36
],
[
36,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
38,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
6,
54
],
[
54,
55
],
[
6,
56
],
[
56,
57
],
[
6,
58
],
[
58,
59
],
[
163,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
62,
74
],
[
74,
75
],
[
74,
76
],
[
77,
78
],
[
77,
79
],
[
62,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
62,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
62,
105
],
[
105,
106
],
[
105,
107
],
[
62,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
62,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
129,
140
],
[
141,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
144,
150
],
[
62,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
62,
157
],
[
157,
158
],
[
158,
159
],
[
60,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.Scanner;\npublic class Main {\n\tpublic static int search(int[] a,int key,int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static int search(int[] a,int key,int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}\n\n}",
"Main",
"public static int search(int[] a,int key,int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}",
"search",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid = 0;",
"mid",
"0",
"while(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}",
"left<right",
"left",
"right",
"{\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}",
"mid = (left + right)/2",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;",
"a[mid]==key",
"a[mid]",
"a",
"mid",
"key",
"return 1;",
"1",
"if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;",
"key<a[mid]",
"key",
"a[mid]",
"a",
"mid",
"right = mid",
"right",
"mid",
"left = mid +1",
"left",
"mid +1",
"mid",
"1",
"return 0;",
"0",
"int[] a",
"a",
"int key",
"key",
"int n",
"n",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int result=0;",
"result",
"0",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] S = new int[n+1];",
"S",
"new int[n+1]",
"n+1",
"n",
"1",
"for(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i ++",
"i ++",
"i",
"{\n\t\t\tS[i]=scan.nextInt();\n\t\t}",
"{\n\t\t\tS[i]=scan.nextInt();\n\t\t}",
"S[i]=scan.nextInt()",
"S[i]",
"S",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < q",
"i",
"q",
"i ++",
"i ++",
"i",
"{\n\t\t\tT[i]=scan.nextInt();\n\t\t}",
"{\n\t\t\tT[i]=scan.nextInt();\n\t\t}",
"T[i]=scan.nextInt()",
"T[i]",
"T",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i ++",
"i ++",
"i",
"{\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}",
"{\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}",
"result += search(S,T[i],n)",
"result",
"search(S,T[i],n)",
"search",
"S",
"T[i]",
"T",
"i",
"n",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\tpublic static int search(int[] a,int key,int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}\n\n}",
"public class Main {\n\tpublic static int search(int[] a,int key,int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\tint mid = 0;\n\t\twhile(left<right){\n\t\t\tmid = (left + right)/2;\n\t\t\tif(a[mid]==key)\n\t\t\t\treturn 1;\n\t\t\telse if(key<a[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid +1;\n\t\t}\n\t\treturn 0;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint result=0;\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n+1];\n\t\tfor(int i = 0 ; i < n ; i ++){\n\t\t\tS[i]=scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i ++){\n\t\t\tT[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q ; i ++){\n\t\t\tresult += search(S,T[i],n);\t\n\t\t}\n\t\tSystem.out.println(result);\n\t\tscan.close();\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static int search(int[] a,int key,int n){
int left = 0;
int right = n;
int mid = 0;
while(left<right){
mid = (left + right)/2;
if(a[mid]==key)
return 1;
else if(key<a[mid])
right = mid;
else
left = mid +1;
}
return 0;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int result=0;
int n = scan.nextInt();
int[] S = new int[n+1];
for(int i = 0 ; i < n ; i ++){
S[i]=scan.nextInt();
}
int q = scan.nextInt();
int[] T = new int[q];
for(int i = 0 ; i < q ; i ++){
T[i]=scan.nextInt();
}
for(int i = 0; i < q ; i ++){
result += search(S,T[i],n);
}
System.out.println(result);
scan.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
17,
41,
13,
20,
17,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
14,
4,
13,
13,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
13,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
179,
11
],
[
179,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
36,
41
],
[
14,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
54,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
62,
64
],
[
14,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
14,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
75,
80
],
[
14,
81
],
[
81,
82
],
[
81,
83
],
[
14,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
96,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
108,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
14,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
12,
123
],
[
123,
124
],
[
179,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
127,
134
],
[
134,
135
],
[
127,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
148,
154
],
[
154,
155
],
[
148,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
156,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
156,
167
],
[
167,
168
],
[
167,
169
],
[
127,
170
],
[
170,
171
],
[
125,
172
],
[
172,
173
],
[
125,
174
],
[
174,
175
],
[
125,
176
],
[
176,
177
],
[
0,
178
],
[
178,
179
],
[
178,
180
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }\n\n public static boolean binarySearch(int[] A, int n, int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }\n\n public static boolean binarySearch(int[] A, int n, int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }\n\n}",
"Main",
"public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] S = new int[100000];",
"S",
"new int[100000]",
"100000",
"int[] T = new int[50000];",
"T",
"new int[50000]",
"50000",
"String[] in_S = br.readLine().split(\" \");",
"in_S",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = Integer.parseInt(in_S[i]);\n }",
"{\n S[i] = Integer.parseInt(in_S[i]);\n }",
"S[i] = Integer.parseInt(in_S[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(in_S[i])",
"Integer.parseInt",
"Integer",
"in_S[i]",
"in_S",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] in_T = br.readLine().split(\" \");",
"in_T",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int sum = 0;",
"sum",
"0",
"for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }",
"{\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }",
"T[i] = Integer.parseInt(in_T[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(in_T[i])",
"Integer.parseInt",
"Integer",
"in_T[i]",
"in_T",
"i",
"if( binarySearch(S, n, T[i])) sum++;",
"binarySearch(S, n, T[i])",
"binarySearch",
"S",
"n",
"T[i]",
"T",
"i",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public static boolean binarySearch(int[] A, int n, int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;",
"A[mid] == key",
"A[mid]",
"A",
"mid",
"key",
"return true;",
"true",
"if(A[mid] < key) left = mid + 1;\n else right = mid;",
"A[mid] < key",
"A[mid]",
"A",
"mid",
"key",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int[] A",
"A",
"int n",
"n",
"int key",
"key",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }\n\n public static boolean binarySearch(int[] A, int n, int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }\n\n}",
"public class Main{\n\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] S = new int[100000];\n int[] T = new int[50000];\n String[] in_S = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n S[i] = Integer.parseInt(in_S[i]);\n }\n int q = Integer.parseInt(br.readLine());\n String[] in_T = br.readLine().split(\" \");\n int sum = 0;\n for(int i = 0; i < q; i++){\n T[i] = Integer.parseInt(in_T[i]);\n if( binarySearch(S, n, T[i])) sum++;\n }\n System.out.println(sum);\n }\n\n public static boolean binarySearch(int[] A, int n, int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(A[mid] == key) return true;\n else if(A[mid] < key) left = mid + 1;\n else right = mid;\n }\n return false;\n }\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] S = new int[100000];
int[] T = new int[50000];
String[] in_S = br.readLine().split(" ");
for(int i = 0; i < n; i++){
S[i] = Integer.parseInt(in_S[i]);
}
int q = Integer.parseInt(br.readLine());
String[] in_T = br.readLine().split(" ");
int sum = 0;
for(int i = 0; i < q; i++){
T[i] = Integer.parseInt(in_T[i]);
if( binarySearch(S, n, T[i])) sum++;
}
System.out.println(sum);
}
public static boolean binarySearch(int[] A, int n, int key){
int left = 0;
int right = n;
int mid;
while(left < right){
mid = (left + right) / 2;
if(A[mid] == key) return true;
else if(A[mid] < key) left = mid + 1;
else right = mid;
}
return false;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
4,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
10,
17
],
[
17,
18
],
[
17,
19
],
[
10,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
10,
25
],
[
25,
26
],
[
25,
27
],
[
10,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
10,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
10,
54
],
[
54,
55
],
[
10,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
68,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
76,
79
],
[
10,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
8,
86
],
[
86,
87
],
[
4,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
90,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
117,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
125,
126
],
[
125,
127
],
[
119,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
90,
133
],
[
133,
134
],
[
88,
135
],
[
135,
136
],
[
88,
137
],
[
137,
138
]
] | [
"import java.util.*;\nclass Main{\n static int n;\n public static void main(String args[])throws Exception{\n Scanner sc = new Scanner(System.in);\n int count = 0;\n int number = 0;\n n = sc.nextInt();\n int array_s [] = new int[n];\n for(int i =0; i<n; i++){\n array_s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int t;\n for(int i = 0; i<q; i++){\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }\n System.out.println(count);\n }\n\n static int binarysearch(int k , int a[]){\n int left = 0;\n int right = n;\n int mid;\n while(left<right){\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }\n return 0;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n static int n;\n public static void main(String args[])throws Exception{\n Scanner sc = new Scanner(System.in);\n int count = 0;\n int number = 0;\n n = sc.nextInt();\n int array_s [] = new int[n];\n for(int i =0; i<n; i++){\n array_s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int t;\n for(int i = 0; i<q; i++){\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }\n System.out.println(count);\n }\n\n static int binarysearch(int k , int a[]){\n int left = 0;\n int right = n;\n int mid;\n while(left<right){\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }\n return 0;\n }\n}",
"Main",
"static int n;",
"n",
"public static void main(String args[])throws Exception{\n Scanner sc = new Scanner(System.in);\n int count = 0;\n int number = 0;\n n = sc.nextInt();\n int array_s [] = new int[n];\n for(int i =0; i<n; i++){\n array_s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int t;\n for(int i = 0; i<q; i++){\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int count = 0;\n int number = 0;\n n = sc.nextInt();\n int array_s [] = new int[n];\n for(int i =0; i<n; i++){\n array_s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int t;\n for(int i = 0; i<q; i++){\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int number = 0;",
"number",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array_s [] = new int[n];",
"array_s",
"new int[n]",
"n",
"for(int i =0; i<n; i++){\n array_s[i] = sc.nextInt();\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n array_s[i] = sc.nextInt();\n }",
"{\n array_s[i] = sc.nextInt();\n }",
"array_s[i] = sc.nextInt()",
"array_s[i]",
"array_s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int t;",
"t",
"for(int i = 0; i<q; i++){\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }",
"{\n t = sc.nextInt();\n //二分探索\n count += binarysearch(t, array_s);\n }",
"t = sc.nextInt()",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"count += binarysearch(t, array_s)",
"count",
"binarysearch(t, array_s)",
"binarysearch",
"t",
"array_s",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args",
"static int binarysearch(int k , int a[]){\n int left = 0;\n int right = n;\n int mid;\n while(left<right){\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }\n return 0;\n }",
"binarysearch",
"{\n int left = 0;\n int right = n;\n int mid;\n while(left<right){\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }\n return 0;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left<right){\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }",
"left<right",
"left",
"right",
"{\n mid = (left+right)/2;\n if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;\n }",
"mid = (left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(k==a[mid])return 1;\n else if(k<a[mid])right=mid;\n else left = mid+1;",
"k==a[mid]",
"k",
"a[mid]",
"a",
"mid",
"return 1;",
"1",
"if(k<a[mid])right=mid;\n else left = mid+1;",
"k<a[mid]",
"k",
"a[mid]",
"a",
"mid",
"right=mid",
"right",
"mid",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"return 0;",
"0",
"int k",
"k",
"int a[]",
"a"
] | import java.util.*;
class Main{
static int n;
public static void main(String args[])throws Exception{
Scanner sc = new Scanner(System.in);
int count = 0;
int number = 0;
n = sc.nextInt();
int array_s [] = new int[n];
for(int i =0; i<n; i++){
array_s[i] = sc.nextInt();
}
int q = sc.nextInt();
int t;
for(int i = 0; i<q; i++){
t = sc.nextInt();
//二分探索
count += binarysearch(t, array_s);
}
System.out.println(count);
}
static int binarysearch(int k , int a[]){
int left = 0;
int right = n;
int mid;
while(left<right){
mid = (left+right)/2;
if(k==a[mid])return 1;
else if(k<a[mid])right=mid;
else left = mid+1;
}
return 0;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
40,
17,
41,
13,
18,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
2,
13,
13,
2,
18,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
378,
11
],
[
378,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
14,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
14,
51
],
[
51,
52
],
[
51,
53
],
[
14,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
66,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
66,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
66,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
95,
104
],
[
104,
105
],
[
104,
106
],
[
66,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
107,
117
],
[
117,
118
],
[
14,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
12,
125
],
[
125,
126
],
[
0,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
127,
134
],
[
134,
135
],
[
134,
136
],
[
127,
138
],
[
138,
139
],
[
138,
140
],
[
127,
141
],
[
141,
142
],
[
141,
143
],
[
127,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
152,
153
],
[
147,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
158,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
154,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
177,
178
],
[
146,
179
],
[
179,
180
],
[
127,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
184,
192
],
[
192,
193
],
[
193,
194
],
[
127,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
203
],
[
203,
204
],
[
203,
205
],
[
195,
206
],
[
206,
207
],
[
127,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
218,
219
],
[
218,
220
],
[
211,
221
],
[
221,
222
],
[
210,
223
],
[
223,
224
],
[
224,
225
],
[
127,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
231,
232
],
[
229,
233
],
[
233,
234
],
[
228,
235
],
[
235,
236
],
[
235,
237
],
[
228,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
228,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
242,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
247,
250
],
[
246,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
228,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
127,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
262,
266
],
[
266,
267
],
[
261,
268
],
[
268,
269
],
[
268,
270
],
[
261,
271
],
[
271,
272
],
[
271,
273
],
[
261,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
261,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
261,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
291,
295
],
[
295,
296
],
[
295,
297
],
[
290,
298
],
[
298,
299
],
[
299,
300
],
[
261,
301
],
[
301,
302
],
[
301,
303
],
[
303,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
309
],
[
309,
310
],
[
309,
311
],
[
304,
312
],
[
312,
313
],
[
313,
314
],
[
313,
315
],
[
312,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
318,
320
],
[
304,
321
],
[
321,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
322,
327
],
[
327,
328
],
[
328,
329
],
[
328,
330
],
[
321,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
333,
337
],
[
321,
338
],
[
338,
339
],
[
339,
340
],
[
303,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
127,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
348,
349
],
[
348,
350
],
[
350,
351
],
[
347,
352
],
[
352,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
356,
358
],
[
353,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
361,
363
],
[
352,
364
],
[
364,
365
],
[
347,
366
],
[
366,
367
],
[
127,
368
],
[
368,
369
],
[
368,
370
],
[
370,
371
],
[
371,
372
],
[
372,
373
],
[
373,
374
],
[
372,
375
],
[
375,
376
],
[
0,
377
],
[
377,
378
],
[
377,
379
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() { return Double.parseDouble(next());}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }\n}",
"Main",
"public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }",
"main",
"{\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }",
"FastScanner fs = new FastScanner();",
"fs",
"new FastScanner()",
"int n = fs.nextInt();",
"n",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int[] arr1 = new int[n];",
"arr1",
"new int[n]",
"n",
"for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"arr1[i] = fs.nextInt();",
"arr1[i] = fs.nextInt()",
"arr1[i]",
"arr1",
"i",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int q = fs.nextInt();",
"q",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int res = 0;",
"res",
"0",
"for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }",
"{\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }",
"int key = fs.nextInt();",
"key",
"fs.nextInt()",
"fs.nextInt",
"fs",
"int left = -1;",
"left",
"-1",
"1",
"int right = arr1.length;",
"right",
"arr1.length",
"arr1",
"arr1.length",
"while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }",
"right - left > 1",
"right - left",
"right",
"left",
"1",
"{\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }",
"int mid = (right + left) / 2;",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"if (key<= arr1[mid]) right = mid;\n else left = mid;",
"key<= arr1[mid]",
"key",
"arr1[mid]",
"arr1",
"mid",
"right = mid",
"right",
"mid",
"left = mid",
"left",
"mid",
"if (right < n && arr1[right] == key) ++res;",
"right < n && arr1[right] == key",
"right < n",
"right",
"n",
"arr1[right] == key",
"arr1[right]",
"arr1",
"right",
"key",
"++res",
"res",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() { return Double.parseDouble(next());}\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"hasNextByte",
"{\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }",
"if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr < buflen",
"ptr",
"buflen",
"{\n return true;\n }",
"return true;",
"true",
"{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }",
"ptr = 0",
"ptr",
"0",
"try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n buflen = in.read(buffer);\n }",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n return false;\n }",
"buflen <= 0",
"buflen",
"0",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"readByte",
"{ if (hasNextByte()) return buffer[ptr++]; else return -1;}",
"if (hasNextByte()) return buffer[ptr++]; else return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}",
"isPrintableChar",
"{ return 33 <= c && c <= 126;}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"hasNext",
"{ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}",
"while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"next",
"{\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n sb.appendCodePoint(b);\n b = readByte();\n }",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"nextLong",
"{\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n minus = true;\n b = readByte();\n }",
"b == '-'",
"b",
"'-'",
"{\n minus = true;\n b = readByte();\n }",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"true",
"{\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }",
"if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n n *= 10;\n n += b - '0';\n }",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n return minus ? -n : n;\n }",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n throw new NumberFormatException();\n }",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() { return Double.parseDouble(next());}",
"nextDouble",
"{ return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n FastScanner fs = new FastScanner();\n int n = fs.nextInt();\n int[] arr1 = new int[n];\n for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();\n\n int q = fs.nextInt();\n int res = 0;\n for (int i = 0; i < q; ++i) {\n int key = fs.nextInt();\n int left = -1;\n int right = arr1.length;\n while (right - left > 1) {\n int mid = (right + left) / 2;\n if (key<= arr1[mid]) right = mid;\n else left = mid;\n }\n if (right < n && arr1[right] == key) ++res;\n }\n\n System.out.println(res);\n }\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int n = fs.nextInt();
int[] arr1 = new int[n];
for (int i = 0; i < n; ++i) arr1[i] = fs.nextInt();
int q = fs.nextInt();
int res = 0;
for (int i = 0; i < q; ++i) {
int key = fs.nextInt();
int left = -1;
int right = arr1.length;
while (right - left > 1) {
int mid = (right + left) / 2;
if (key<= arr1[mid]) right = mid;
else left = mid;
}
if (right < n && arr1[right] == key) ++res;
}
System.out.println(res);
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
}else{
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true){
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
}else if(b == -1 || !isPrintableChar(b)){
return minus ? -n : n;
}else{
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() { return Double.parseDouble(next());}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
41,
13,
17,
2,
2,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
137,
8
],
[
137,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
13,
22
],
[
22,
23
],
[
22,
24
],
[
13,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
13,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
13,
51
],
[
51,
52
],
[
51,
53
],
[
13,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
13,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
13,
79
],
[
79,
80
],
[
79,
81
],
[
13,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
82,
97
],
[
97,
98
],
[
98,
99
],
[
82,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
102,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
123,
126
],
[
126,
127
],
[
13,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
9,
134
],
[
134,
135
],
[
0,
136
],
[
136,
137
],
[
136,
138
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\t\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\t\n}",
"Main",
"public static void main(String[] args) {\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"main",
"{\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"try(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"{\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}",
"{\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}",
"{\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int ans = 0;",
"ans",
"0",
"for(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}",
"int i=0, j=0;",
"int i=0",
"i",
"0",
"j=0;",
"j",
"0",
"i<n && j<q",
"i<n",
"i",
"n",
"j<q",
"j",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}",
"if(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}",
"S[i] == T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}",
"ans++",
"ans",
"j++",
"j",
"if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}",
"S[i] > T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}",
"i--",
"i",
"j++",
"j",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\t\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] S = new int[n];\n\t\t\tfor(int i=0; i<n; i++) {\n\t\t\t\tS[i] = sc.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint q = sc.nextInt();\n\t\t\tint[] T = new int[q];\n\t\t\tfor(int i=0; i<q; i++) {\n\t\t\t\tT[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(T);\n\t\t\t\n\t\t\tint ans = 0;\n\t\t\tfor(int i=0, j=0; i<n && j<q; i++) {\n\t\t\t\tif(S[i] == T[j]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse if(S[i] > T[j]) {\n\t\t\t\t\ti--;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\t\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
int[] S = new int[n];
for(int i=0; i<n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[q];
for(int i=0; i<q; i++) {
T[i] = sc.nextInt();
}
Arrays.sort(T);
int ans = 0;
for(int i=0, j=0; i<n && j<q; i++) {
if(S[i] == T[j]) {
ans++;
j++;
}
else if(S[i] > T[j]) {
i--;
j++;
}
}
System.out.println(ans);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
188,
5
],
[
188,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
15,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
15,
25
],
[
25,
26
],
[
26,
27
],
[
15,
28
],
[
29,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
29,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
52,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
64,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
6,
94
],
[
94,
95
],
[
6,
96
],
[
96,
97
],
[
188,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
100,
109
],
[
109,
110
],
[
100,
111
],
[
111,
112
],
[
111,
113
],
[
100,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
115,
128
],
[
129,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
135,
136
],
[
100,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
100,
142
],
[
142,
143
],
[
100,
144
],
[
144,
145
],
[
144,
146
],
[
100,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
148,
158
],
[
158,
159
],
[
159,
160
],
[
148,
161
],
[
162,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
100,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
172,
175
],
[
100,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
100,
182
],
[
182,
183
],
[
183,
184
],
[
98,
185
],
[
185,
186
],
[
0,
187
],
[
187,
188
],
[
187,
189
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\tstatic int binarySearch(int[] a, int[] b) {\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}\n\t\n public static void main(String argv[]) {\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tstatic int binarySearch(int[] a, int[] b) {\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}\n\t\n public static void main(String argv[]) {\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }\n}",
"Main",
"static int binarySearch(int[] a, int[] b) {\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}",
"binarySearch",
"{\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}",
"int counter = 0;",
"counter",
"0",
"int mid = 0;",
"mid",
"0",
"for(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<b.length",
"i",
"b.length",
"b",
"b.length",
"i++",
"i++",
"i",
"{\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}",
"{\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}",
"int L = 0;",
"L",
"0",
"int R = a.length-1;",
"R",
"a.length-1",
"a.length",
"a",
"a.length",
"1",
"while(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}",
"L<=R",
"L",
"R",
"{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}",
"mid = (L+R)/2",
"mid",
"(L+R)/2",
"(L+R)",
"L",
"R",
"2",
"if(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}",
"b[i]==a[mid]",
"b[i]",
"b",
"i",
"a[mid]",
"a",
"mid",
"{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"counter++",
"counter",
"break;",
"if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}",
"b[i]<a[mid]",
"b[i]",
"b",
"i",
"a[mid]",
"a",
"mid",
"{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}",
"R = mid-1",
"R",
"mid-1",
"mid",
"1",
"if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}",
"b[i]>a[mid]",
"b[i]",
"b",
"i",
"a[mid]",
"a",
"mid",
"{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}",
"L = mid+1",
"L",
"mid+1",
"mid",
"1",
"return counter;",
"counter",
"int[] a",
"a",
"int[] b",
"b",
"public static void main(String argv[]) {\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }",
"main",
"{\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int num1 = in.nextInt();",
"num1",
"in.nextInt()",
"in.nextInt",
"in",
"int intArray1[];",
"intArray1",
"intArray1 = new int[num1]",
"intArray1",
"new int[num1]",
"num1",
"for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < intArray1.length",
"i",
"intArray1.length",
"intArray1",
"intArray1.length",
"i++",
"i++",
"i",
"{\n \tintArray1[i] = in.nextInt();\n }",
"{\n \tintArray1[i] = in.nextInt();\n }",
"intArray1[i] = in.nextInt()",
"intArray1[i]",
"intArray1",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int num2 = in.nextInt();",
"num2",
"in.nextInt()",
"in.nextInt",
"in",
"int intArray2[];",
"intArray2",
"intArray2 = new int[num2]",
"intArray2",
"new int[num2]",
"num2",
"for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < intArray2.length",
"i",
"intArray2.length",
"intArray2",
"intArray2.length",
"i++",
"i++",
"i",
"{\n \tintArray2[i] = in.nextInt();\n }",
"{\n \tintArray2[i] = in.nextInt();\n }",
"intArray2[i] = in.nextInt()",
"intArray2[i]",
"intArray2",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int res = binarySearch(intArray1, intArray2);",
"res",
"binarySearch(intArray1, intArray2)",
"binarySearch",
"intArray1",
"intArray2",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"in.close()",
"in.close",
"in",
"String argv[]",
"argv",
"public class Main {\n\t\n\tstatic int binarySearch(int[] a, int[] b) {\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}\n\t\n public static void main(String argv[]) {\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }\n}",
"public class Main {\n\t\n\tstatic int binarySearch(int[] a, int[] b) {\n\t\tint counter = 0;\n\t\tint mid = 0;\n\t\tfor(int i=0; i<b.length; i++){\n\t\t\tint L = 0;\n\t\t\tint R = a.length-1;\n\t\t\t\n\t\t\twhile(L<=R)\n\t\t\t{\n\t\t\t\tmid = (L+R)/2;\n//\t\t\t\tSystem.out.println(\"mid: \"+ mid);\n\t\t\t\tif(b[i]==a[mid])\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(b[i]<a[mid])\n\t\t\t\t{\n\t\t\t\t\tR = mid-1;\n\t\t\t\t}\n\t\t\t\telse if(b[i]>a[mid])\n\t\t\t\t{\n\t\t\t\t\tL = mid+1;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\treturn counter;\n\t}\n\t\n public static void main(String argv[]) {\n\n Scanner in = new Scanner(System.in);\n int num1 = in.nextInt();\n\n int intArray1[]; //declaring array\n intArray1 = new int[num1]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray1.length; i++){\n \tintArray1[i] = in.nextInt();\n }\n \n int num2 = in.nextInt();\n int intArray2[]; //declaring array\n intArray2 = new int[num2]; // allocating memory to array\n \n // accessing the numbers in the second line\n for (int i = 0; i < intArray2.length; i++){\n \tintArray2[i] = in.nextInt();\n }\n \n int res = binarySearch(intArray1, intArray2);\n\n System.out.println(res);\n in.close();\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int binarySearch(int[] a, int[] b) {
int counter = 0;
int mid = 0;
for(int i=0; i<b.length; i++){
int L = 0;
int R = a.length-1;
while(L<=R)
{
mid = (L+R)/2;
// System.out.println("mid: "+ mid);
if(b[i]==a[mid])
{
counter++;
break;
}
else if(b[i]<a[mid])
{
R = mid-1;
}
else if(b[i]>a[mid])
{
L = mid+1;
}
}
}
return counter;
}
public static void main(String argv[]) {
Scanner in = new Scanner(System.in);
int num1 = in.nextInt();
int intArray1[]; //declaring array
intArray1 = new int[num1]; // allocating memory to array
// accessing the numbers in the second line
for (int i = 0; i < intArray1.length; i++){
intArray1[i] = in.nextInt();
}
int num2 = in.nextInt();
int intArray2[]; //declaring array
intArray2 = new int[num2]; // allocating memory to array
// accessing the numbers in the second line
for (int i = 0; i < intArray2.length; i++){
intArray2[i] = in.nextInt();
}
int res = binarySearch(intArray1, intArray2);
System.out.println(res);
in.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
4,
13,
18,
13,
13,
13,
30,
40,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
3,
14,
2,
18,
13,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
30,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
4,
18,
13,
13,
29,
4,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
6,
13,
12,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
404,
26
],
[
404,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
43
],
[
43,
44
],
[
43,
45
],
[
29,
46
],
[
46,
47
],
[
46,
48
],
[
29,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
49,
54
],
[
29,
55
],
[
55,
56
],
[
56,
57
],
[
27,
58
],
[
58,
59
],
[
404,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
64,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
64,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
64,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
64,
102
],
[
102,
103
],
[
102,
104
],
[
64,
106
],
[
106,
107
],
[
106,
108
],
[
64,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
129,
136
],
[
136,
137
],
[
137,
138
],
[
64,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
62,
143
],
[
143,
144
],
[
62,
145
],
[
145,
146
],
[
62,
147
],
[
147,
148
],
[
60,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
151,
162
],
[
162,
163
],
[
162,
164
],
[
151,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
169,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
177,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
177,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
189,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
197,
199
],
[
189,
200
],
[
151,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
201,
207
],
[
207,
208
],
[
151,
209
],
[
209,
210
],
[
149,
211
],
[
211,
212
],
[
149,
213
],
[
213,
214
],
[
404,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
215,
219
],
[
219,
220
],
[
219,
221
],
[
215,
223
],
[
223,
224
],
[
215,
225
],
[
225,
226
],
[
215,
227
],
[
227,
228
],
[
215,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
229,
237
],
[
237,
238
],
[
215,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
242,
247
],
[
247,
248
],
[
248,
249
],
[
241,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
250,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
262,
263
],
[
258,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
267,
270
],
[
254,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
241,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
215,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
286,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
291,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
286,
300
],
[
300,
301
],
[
300,
302
],
[
286,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
303,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
310,
311
],
[
307,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
286,
316
],
[
316,
317
],
[
316,
318
],
[
286,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
319,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
327,
328
],
[
327,
329
],
[
326,
330
],
[
330,
331
],
[
330,
332
],
[
325,
333
],
[
333,
334
],
[
334,
335
],
[
324,
336
],
[
336,
337
],
[
336,
338
],
[
324,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
341,
343
],
[
324,
344
],
[
344,
345
],
[
344,
346
],
[
346,
347
],
[
286,
348
],
[
348,
349
],
[
349,
350
],
[
349,
351
],
[
215,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
355,
356
],
[
356,
357
],
[
356,
358
],
[
355,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
361,
364
],
[
354,
365
],
[
365,
366
],
[
366,
367
],
[
366,
368
],
[
352,
369
],
[
369,
370
],
[
215,
371
],
[
371,
372
],
[
371,
373
],
[
373,
374
],
[
374,
375
],
[
378,
376
],
[
388,
377
],
[
385,
378
],
[
378,
379
],
[
379,
380
],
[
379,
381
],
[
378,
382
],
[
382,
383
],
[
382,
384
],
[
385,
385
],
[
385,
386
],
[
385,
387
],
[
388,
388
],
[
388,
389
],
[
388,
390
],
[
378,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
371,
395
],
[
395,
396
],
[
215,
397
],
[
397,
398
],
[
397,
399
],
[
399,
400
],
[
399,
401
],
[
401,
402
],
[
0,
403
],
[
403,
404
],
[
403,
405
]
] | [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Vishal Burman\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }\n\n private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }\n\n private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"Task solver = new Task();",
"solver",
"new Task()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Task {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }\n\n private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }\n\n }",
"Task",
"public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }",
"solve",
"{\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int a[] = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n a[i] = in.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = in.nextInt();",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int b[] = new int[n];",
"b",
"new int[n]",
"n",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }",
"{\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }",
"b[i] = in.nextInt()",
"b[i]",
"b",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"if (search(b[i], a)) {\n count++;\n }",
"search(b[i], a)",
"search",
"b[i]",
"b",
"i",
"a",
"{\n count++;\n }",
"count++",
"count",
"out.println(count)",
"out.println",
"out",
"count",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"PrintWriter out",
"out",
"private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }",
"search",
"{\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }",
"int min = 0;",
"min",
"0",
"int max = a.length - 1;",
"max",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"int mid = 0;",
"mid",
"0",
"while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }",
"min <= max",
"min",
"max",
"{\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }",
"mid = (max + min) / 2",
"mid",
"(max + min) / 2",
"(max + min)",
"max",
"min",
"2",
"if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;",
"a[mid] < i",
"a[mid]",
"a",
"mid",
"i",
"{\n min = mid + 1;\n }",
"min = mid + 1",
"min",
"mid + 1",
"mid",
"1",
"if (a[mid] > i)\n max = mid - 1;\n else\n break;",
"a[mid] > i",
"a[mid]",
"a",
"mid",
"i",
"max = mid - 1",
"max",
"mid - 1",
"mid",
"1",
"break;",
"if (a[mid] == i)\n return true;",
"a[mid] == i",
"a[mid]",
"a",
"mid",
"i",
"return true;",
"true",
"return false;",
"false",
"int i",
"i",
"int[] a",
"a",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private InputReader.SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"if (numChars == -1) {\n throw new InputMismatchException();\n }",
"numChars == -1",
"numChars",
"-1",
"1",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0) {\n return -1;\n }",
"numChars <= 0",
"numChars",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"isSpaceChar",
"{\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"if (filter != null) {\n return filter.isSpaceChar(c);\n }",
"filter != null",
"filter",
"null",
"{\n return filter.isSpaceChar(c);\n }",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return isWhitespace(c);",
"isWhitespace(c)",
"isWhitespace",
"c",
"int c",
"c",
"public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }\n\n private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n int q = in.nextInt();\n int b[] = new int[n];\n int count = 0;\n for (int i = 0; i < q; i++) {\n b[i] = in.nextInt();\n if (search(b[i], a)) {\n count++;\n }\n }\n out.println(count);\n }\n\n private boolean search(int i, int[] a) {\n int min = 0;\n int max = a.length - 1;\n int mid = 0;\n while (min <= max) {\n mid = (max + min) / 2;\n if (a[mid] < i) {\n min = mid + 1;\n } else if (a[mid] > i)\n max = mid - 1;\n else\n break;\n }\n if (a[mid] == i)\n return true;\n return false;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}",
"Main"
] | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Vishal Burman
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++)
a[i] = in.nextInt();
Arrays.sort(a);
int q = in.nextInt();
int b[] = new int[n];
int count = 0;
for (int i = 0; i < q; i++) {
b[i] = in.nextInt();
if (search(b[i], a)) {
count++;
}
}
out.println(count);
}
private boolean search(int i, int[] a) {
int min = 0;
int max = a.length - 1;
int mid = 0;
while (min <= max) {
mid = (max + min) / 2;
if (a[mid] < i) {
min = mid + 1;
} else if (a[mid] > i)
max = mid - 1;
else
break;
}
if (a[mid] == i)
return true;
return false;
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
17,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
14,
4,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
153,
5
],
[
153,
6
],
[
6,
7
],
[
6,
8
],
[
153,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
14,
15
],
[
15,
16
],
[
153,
17
],
[
17,
18
],
[
17,
19
],
[
153,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
52,
53
],
[
23,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
23,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
77,
80
],
[
80,
81
],
[
81,
82
],
[
74,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
23,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
21,
95
],
[
95,
96
],
[
153,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
99,
106
],
[
106,
107
],
[
99,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
126,
127
],
[
112,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
128,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
145,
147
],
[
99,
148
],
[
148,
149
],
[
97,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n static Scanner sc = new Scanner(System.in);\n static int n = Integer.parseInt(sc.next());\n static int[] a = new int[100000];\n\n public static void main(String[] args){\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }\n\n static boolean binarySearch(int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static int n = Integer.parseInt(sc.next());\n static int[] a = new int[100000];\n\n public static void main(String[] args){\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }\n\n static boolean binarySearch(int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"static int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"static int[] a = new int[100000];",
"a",
"new int[100000]",
"100000",
"public static void main(String[] args){\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }",
"main",
"{\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }",
"int q",
"q",
"key",
"key",
"sum = 0;",
"sum",
"0",
"for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Integer.parseInt(sc.next());\n }",
"{\n a[i] = Integer.parseInt(sc.next());\n }",
"a[i] = Integer.parseInt(sc.next())",
"a[i]",
"a",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"q = Integer.parseInt(sc.next())",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }",
"{\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }",
"key = Integer.parseInt(sc.next())",
"key",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"if(binarySearch(key)) sum++;",
"binarySearch(key)",
"binarySearch",
"key",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"static boolean binarySearch(int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }",
"mid = (left + right)/2",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(key == a[mid]) return true;",
"key == a[mid]",
"key",
"a[mid]",
"a",
"mid",
"return true;",
"true",
"if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;",
"key > a[mid]",
"key",
"a[mid]",
"a",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if (key < a[mid]) right = mid;",
"key < a[mid]",
"key",
"a[mid]",
"a",
"mid",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int key",
"key",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static int n = Integer.parseInt(sc.next());\n static int[] a = new int[100000];\n\n public static void main(String[] args){\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }\n\n static boolean binarySearch(int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }\n}",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static int n = Integer.parseInt(sc.next());\n static int[] a = new int[100000];\n\n public static void main(String[] args){\n int q,key,sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n }\n q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n key = Integer.parseInt(sc.next());\n if(binarySearch(key)) sum++;\n }\n System.out.println(sum);\n }\n\n static boolean binarySearch(int key){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right)/2;\n if(key == a[mid]) return true;\n if (key > a[mid]) left = mid + 1;\n else if (key < a[mid]) right = mid;\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static int n = Integer.parseInt(sc.next());
static int[] a = new int[100000];
public static void main(String[] args){
int q,key,sum = 0;
for (int i = 0; i < n; i++) {
a[i] = Integer.parseInt(sc.next());
}
q = Integer.parseInt(sc.next());
for (int i = 0; i < q; i++) {
key = Integer.parseInt(sc.next());
if(binarySearch(key)) sum++;
}
System.out.println(sum);
}
static boolean binarySearch(int key){
int left = 0;
int right = n;
int mid;
while(left < right){
mid = (left + right)/2;
if(key == a[mid]) return true;
if (key > a[mid]) left = mid + 1;
else if (key < a[mid]) right = mid;
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
14,
4,
18,
36,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
2,
13,
13,
2,
13,
13,
30,
29,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
14,
2,
13,
18,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
6,
12
],
[
12,
13
],
[
4,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
25,
26
],
[
26,
27
],
[
16,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
30,
35
],
[
30,
36
],
[
16,
37
],
[
37,
38
],
[
37,
39
],
[
16,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
16,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
69,
70
],
[
70,
71
],
[
16,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
74,
79
],
[
74,
80
],
[
16,
81
],
[
81,
82
],
[
81,
83
],
[
16,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
84,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
96,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
16,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
4,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
122,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
148,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
153,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
135,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
164,
170
],
[
170,
171
],
[
171,
172
],
[
164,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
176,
178
],
[
173,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
173,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
120,
187
],
[
187,
188
],
[
120,
189
],
[
189,
190
]
] | [
"import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n new Main().main();\n }\n\n public void main() {\n Scanner scanner = new Scanner(System.in);\n\n int sNum = Integer.parseInt(scanner.nextLine());\n String[] sLine = scanner.nextLine().split(\" \", sNum);\n int[] s = new int[sNum];\n for (int i = 0; i < sNum; i++) {\n s[i] = Integer.parseInt(sLine[i]);\n }\n\n int tNum = Integer.parseInt(scanner.nextLine());\n String[] tLine = scanner.nextLine().split(\" \", tNum);\n\n int result = 0;\n for (int i = 0; i < tNum; i++) {\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }\n System.out.println(result);\n }\n\n private boolean binarySearch(int key, int[] arr) {\n int left = 0;\n int right = arr.length - 1;\n\n while (true) {\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n new Main().main();\n }\n\n public void main() {\n Scanner scanner = new Scanner(System.in);\n\n int sNum = Integer.parseInt(scanner.nextLine());\n String[] sLine = scanner.nextLine().split(\" \", sNum);\n int[] s = new int[sNum];\n for (int i = 0; i < sNum; i++) {\n s[i] = Integer.parseInt(sLine[i]);\n }\n\n int tNum = Integer.parseInt(scanner.nextLine());\n String[] tLine = scanner.nextLine().split(\" \", tNum);\n\n int result = 0;\n for (int i = 0; i < tNum; i++) {\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }\n System.out.println(result);\n }\n\n private boolean binarySearch(int key, int[] arr) {\n int left = 0;\n int right = arr.length - 1;\n\n while (true) {\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n new Main().main();\n }",
"main",
"{\n new Main().main();\n }",
"new Main().main()",
"new Main().main",
"new Main()",
"String[] args",
"args",
"public void main() {\n Scanner scanner = new Scanner(System.in);\n\n int sNum = Integer.parseInt(scanner.nextLine());\n String[] sLine = scanner.nextLine().split(\" \", sNum);\n int[] s = new int[sNum];\n for (int i = 0; i < sNum; i++) {\n s[i] = Integer.parseInt(sLine[i]);\n }\n\n int tNum = Integer.parseInt(scanner.nextLine());\n String[] tLine = scanner.nextLine().split(\" \", tNum);\n\n int result = 0;\n for (int i = 0; i < tNum; i++) {\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }\n System.out.println(result);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n\n int sNum = Integer.parseInt(scanner.nextLine());\n String[] sLine = scanner.nextLine().split(\" \", sNum);\n int[] s = new int[sNum];\n for (int i = 0; i < sNum; i++) {\n s[i] = Integer.parseInt(sLine[i]);\n }\n\n int tNum = Integer.parseInt(scanner.nextLine());\n String[] tLine = scanner.nextLine().split(\" \", tNum);\n\n int result = 0;\n for (int i = 0; i < tNum; i++) {\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }\n System.out.println(result);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int sNum = Integer.parseInt(scanner.nextLine());",
"sNum",
"Integer.parseInt(scanner.nextLine())",
"Integer.parseInt",
"Integer",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"String[] sLine = scanner.nextLine().split(\" \", sNum);",
"sLine",
"scanner.nextLine().split(\" \", sNum)",
"scanner.nextLine().split",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"\" \"",
"sNum",
"int[] s = new int[sNum];",
"s",
"new int[sNum]",
"sNum",
"for (int i = 0; i < sNum; i++) {\n s[i] = Integer.parseInt(sLine[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sNum",
"i",
"sNum",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(sLine[i]);\n }",
"{\n s[i] = Integer.parseInt(sLine[i]);\n }",
"s[i] = Integer.parseInt(sLine[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(sLine[i])",
"Integer.parseInt",
"Integer",
"sLine[i]",
"sLine",
"i",
"int tNum = Integer.parseInt(scanner.nextLine());",
"tNum",
"Integer.parseInt(scanner.nextLine())",
"Integer.parseInt",
"Integer",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"String[] tLine = scanner.nextLine().split(\" \", tNum);",
"tLine",
"scanner.nextLine().split(\" \", tNum)",
"scanner.nextLine().split",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"\" \"",
"tNum",
"int result = 0;",
"result",
"0",
"for (int i = 0; i < tNum; i++) {\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < tNum",
"i",
"tNum",
"i++",
"i++",
"i",
"{\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }",
"{\n int t = Integer.parseInt(tLine[i]);\n if (this.binarySearch(t, s)) {\n result++;\n }\n }",
"int t = Integer.parseInt(tLine[i]);",
"t",
"Integer.parseInt(tLine[i])",
"Integer.parseInt",
"Integer",
"tLine[i]",
"tLine",
"i",
"if (this.binarySearch(t, s)) {\n result++;\n }",
"this.binarySearch(t, s)",
"this.binarySearch",
"this",
"t",
"s",
"{\n result++;\n }",
"result++",
"result",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"private boolean binarySearch(int key, int[] arr) {\n int left = 0;\n int right = arr.length - 1;\n\n while (true) {\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }\n }",
"binarySearch",
"{\n int left = 0;\n int right = arr.length - 1;\n\n while (true) {\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }\n }",
"int left = 0;",
"left",
"0",
"int right = arr.length - 1;",
"right",
"arr.length - 1",
"arr.length",
"arr",
"arr.length",
"1",
"while (true) {\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }",
"true",
"{\n int middle = (left + right) / 2;\n if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }\n\n if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }\n }",
"int middle = (left + right) / 2;",
"middle",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (middle == left || middle == right) {\n return key == arr[left] || key == arr[right];\n }",
"middle == left || middle == right",
"middle == left",
"middle",
"left",
"middle == right",
"middle",
"right",
"{\n return key == arr[left] || key == arr[right];\n }",
"return key == arr[left] || key == arr[right];",
"key == arr[left] || key == arr[right]",
"key == arr[left]",
"key",
"arr[left]",
"arr",
"left",
"key == arr[right]",
"key",
"arr[right]",
"arr",
"right",
"if (key == arr[middle]) {\n return true;\n } else if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }",
"key == arr[middle]",
"key",
"arr[middle]",
"arr",
"middle",
"{\n return true;\n }",
"return true;",
"true",
"if (key < arr[middle]) {\n right = middle;\n } else {\n left = middle;\n }",
"key < arr[middle]",
"key",
"arr[middle]",
"arr",
"middle",
"{\n right = middle;\n }",
"right = middle",
"right",
"middle",
"{\n left = middle;\n }",
"left = middle",
"left",
"middle",
"int key",
"key",
"int[] arr",
"arr"
] | import java.util.*;
class Main {
public static void main(String[] args) {
new Main().main();
}
public void main() {
Scanner scanner = new Scanner(System.in);
int sNum = Integer.parseInt(scanner.nextLine());
String[] sLine = scanner.nextLine().split(" ", sNum);
int[] s = new int[sNum];
for (int i = 0; i < sNum; i++) {
s[i] = Integer.parseInt(sLine[i]);
}
int tNum = Integer.parseInt(scanner.nextLine());
String[] tLine = scanner.nextLine().split(" ", tNum);
int result = 0;
for (int i = 0; i < tNum; i++) {
int t = Integer.parseInt(tLine[i]);
if (this.binarySearch(t, s)) {
result++;
}
}
System.out.println(result);
}
private boolean binarySearch(int key, int[] arr) {
int left = 0;
int right = arr.length - 1;
while (true) {
int middle = (left + right) / 2;
if (middle == left || middle == right) {
return key == arr[left] || key == arr[right];
}
if (key == arr[middle]) {
return true;
} else if (key < arr[middle]) {
right = middle;
} else {
left = middle;
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
13,
4,
13,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
136,
5
],
[
136,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
19,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
27,
33
],
[
33,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
35,
41
],
[
41,
42
],
[
41,
43
],
[
35,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
6,
51
],
[
51,
52
],
[
6,
53
],
[
53,
54
],
[
6,
55
],
[
55,
56
],
[
136,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
59,
68
],
[
68,
69
],
[
68,
70
],
[
59,
71
],
[
71,
72
],
[
59,
73
],
[
73,
74
],
[
73,
75
],
[
59,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
59,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
59,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
102,
113
],
[
114,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
114,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
122,
126
],
[
59,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
57,
133
],
[
133,
134
],
[
0,
135
],
[
135,
136
],
[
135,
137
]
] | [
"import java.util.*;\n\npublic class Main {\n static int binarySearch(int n, int A[], int key) {\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n } \n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n static int binarySearch(int n, int A[], int key) {\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n } \n}",
"Main",
"static int binarySearch(int n, int A[], int key) {\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;",
"A[mid] == key",
"A[mid]",
"A",
"mid",
"key",
"return 1;",
"1",
"if(key < A[mid]) right = mid;\n else left = mid + 1;",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int n",
"n",
"int A[]",
"A",
"int key",
"key",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"int[] A;",
"A",
"A = new int[n]",
"A",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextInt();\n }",
"{\n A[i] = sc.nextInt();\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }",
"{\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }",
"int key = sc.nextInt();",
"key",
"sc.nextInt()",
"sc.nextInt",
"sc",
"count += binarySearch(n, A, key)",
"count",
"binarySearch(n, A, key)",
"binarySearch",
"n",
"A",
"key",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n static int binarySearch(int n, int A[], int key) {\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n } \n}",
"public class Main {\n static int binarySearch(int n, int A[], int key) {\n int left = 0;\n int right = n;\n while(left < right) {\n int mid = (left + right) / 2;\n if(A[mid] == key) return 1;\n else if(key < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int count = 0;\n int[] A;\n A = new int[n];\n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n for(int i = 0; i < q; i++) {\n int key = sc.nextInt();\n count += binarySearch(n, A, key);\n }\n System.out.println(count);\n } \n}",
"Main"
] | import java.util.*;
public class Main {
static int binarySearch(int n, int A[], int key) {
int left = 0;
int right = n;
while(left < right) {
int mid = (left + right) / 2;
if(A[mid] == key) return 1;
else if(key < A[mid]) right = mid;
else left = mid + 1;
}
return 0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
int[] A;
A = new int[n];
for(int i = 0; i < n; i++) {
A[i] = sc.nextInt();
}
int q = sc.nextInt();
for(int i = 0; i < q; i++) {
int key = sc.nextInt();
count += binarySearch(n, A, key);
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
13,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
40,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
]
] | [
"import java.util.Scanner;\n\n\n class Main {\n static public void main (String[] av){\n int b;\n int sum=0;\n Scanner sc =new Scanner(System.in);\n int n =sc.nextInt();\n int a[]= new int[n];\n int v;\n for(int i=0;i<n;i++){\n v=sc.nextInt();\n a[i]=v;\n }\n \nint n2=sc.nextInt();\nfor (int i=0;i<n2;i++){\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}\nSystem.out.println(sum);\n\n\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n static public void main (String[] av){\n int b;\n int sum=0;\n Scanner sc =new Scanner(System.in);\n int n =sc.nextInt();\n int a[]= new int[n];\n int v;\n for(int i=0;i<n;i++){\n v=sc.nextInt();\n a[i]=v;\n }\n \nint n2=sc.nextInt();\nfor (int i=0;i<n2;i++){\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}\nSystem.out.println(sum);\n\n\n }\n\n}",
"Main",
"static public void main (String[] av){\n int b;\n int sum=0;\n Scanner sc =new Scanner(System.in);\n int n =sc.nextInt();\n int a[]= new int[n];\n int v;\n for(int i=0;i<n;i++){\n v=sc.nextInt();\n a[i]=v;\n }\n \nint n2=sc.nextInt();\nfor (int i=0;i<n2;i++){\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}\nSystem.out.println(sum);\n\n\n }",
"main",
"{\n int b;\n int sum=0;\n Scanner sc =new Scanner(System.in);\n int n =sc.nextInt();\n int a[]= new int[n];\n int v;\n for(int i=0;i<n;i++){\n v=sc.nextInt();\n a[i]=v;\n }\n \nint n2=sc.nextInt();\nfor (int i=0;i<n2;i++){\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}\nSystem.out.println(sum);\n\n\n }",
"int b;",
"b",
"int sum=0;",
"sum",
"0",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n =sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]= new int[n];",
"a",
"new int[n]",
"n",
"int v;",
"v",
"for(int i=0;i<n;i++){\n v=sc.nextInt();\n a[i]=v;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n v=sc.nextInt();\n a[i]=v;\n }",
"{\n v=sc.nextInt();\n a[i]=v;\n }",
"v=sc.nextInt()",
"v",
"sc.nextInt()",
"sc.nextInt",
"sc",
"a[i]=v",
"a[i]",
"a",
"i",
"v",
"int n2=sc.nextInt();",
"n2",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i=0;i<n2;i++){\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n2",
"i",
"n2",
"i++",
"i++",
"i",
"{\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}",
"{\n int x=sc.nextInt();\n for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}\n}",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int j=0;j<n;j++){\n if (a[j]==x){\n sum++;\n break;\n }\n}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (a[j]==x){\n sum++;\n break;\n }\n}",
"{\n if (a[j]==x){\n sum++;\n break;\n }\n}",
"if (a[j]==x){\n sum++;\n break;\n }",
"a[j]==x",
"a[j]",
"a",
"j",
"x",
"{\n sum++;\n break;\n }",
"sum++",
"sum",
"break;",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] av",
"av"
] | import java.util.Scanner;
class Main {
static public void main (String[] av){
int b;
int sum=0;
Scanner sc =new Scanner(System.in);
int n =sc.nextInt();
int a[]= new int[n];
int v;
for(int i=0;i<n;i++){
v=sc.nextInt();
a[i]=v;
}
int n2=sc.nextInt();
for (int i=0;i<n2;i++){
int x=sc.nextInt();
for (int j=0;j<n;j++){
if (a[j]==x){
sum++;
break;
}
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
170,
5
],
[
170,
6
],
[
6,
7
],
[
170,
8
],
[
8,
9
],
[
170,
10
],
[
10,
11
],
[
170,
12
],
[
12,
13
],
[
170,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
16,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
16,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
16,
53
],
[
53,
54
],
[
53,
55
],
[
16,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
16,
76
],
[
76,
77
],
[
76,
78
],
[
16,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
16,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
16,
107
],
[
107,
108
],
[
108,
109
],
[
14,
110
],
[
110,
111
],
[
170,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
114,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
135,
141
],
[
141,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
143,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
143,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
154,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
114,
165
],
[
165,
166
],
[
112,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.util.Scanner;\npublic class Main {\n public static int n;\n public static int S[];\n public static int q;\n public static int T[];\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }\n private static boolean binary_search(int key){\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static int n;\n public static int S[];\n public static int q;\n public static int T[];\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }\n private static boolean binary_search(int key){\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }\n}",
"Main",
"public static int n;",
"n",
"public static int S[];",
"S",
"public static int q;",
"q",
"public static int T[];",
"T",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n=sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S=new int[n]",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++) S[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i]=sc.nextInt();",
"S[i]=sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q=sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T=new int[q]",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++) T[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"T[i]=sc.nextInt();",
"T[i]=sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count=0;",
"count",
"0",
"for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(binary_search(T[i])){\n count++;\n }\n }",
"{\n if(binary_search(T[i])){\n count++;\n }\n }",
"if(binary_search(T[i])){\n count++;\n }",
"binary_search(T[i])",
"binary_search",
"T[i]",
"T",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println (count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"private static boolean binary_search(int key){\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }",
"binary_search",
"{\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }",
"int left=0;",
"left",
"0",
"int right=n-1;",
"right",
"n-1",
"n",
"1",
"while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }",
"right>=left",
"right",
"left",
"{\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }",
"int mid=(left+right)/2;",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;",
"S[mid]==key",
"S[mid]",
"S",
"mid",
"key",
"return true;",
"true",
"if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;",
"S[mid] > key",
"S[mid]",
"S",
"mid",
"key",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"if (S[mid] < key) left = mid + 1;",
"S[mid] < key",
"S[mid]",
"S",
"mid",
"key",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int key",
"key",
"public class Main {\n public static int n;\n public static int S[];\n public static int q;\n public static int T[];\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }\n private static boolean binary_search(int key){\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }\n}",
"public class Main {\n public static int n;\n public static int S[];\n public static int q;\n public static int T[];\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n S=new int[n];\n for(int i=0;i<n;i++) S[i]=sc.nextInt();\n q=sc.nextInt();\n T=new int[q];\n for(int i=0;i<q;i++) T[i]=sc.nextInt();\n int count=0;\n for(int i=0;i<q;i++){\n if(binary_search(T[i])){\n count++;\n }\n }\n System.out.println (count);\n sc.close();\n }\n private static boolean binary_search(int key){\n int left=0;\n int right=n-1;\n while(right>=left){\n int mid=(left+right)/2;\n if(S[mid]==key) return true;\n else if (S[mid] > key) right = mid - 1;\n else if (S[mid] < key) left = mid + 1;\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static int n;
public static int S[];
public static int q;
public static int T[];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n=sc.nextInt();
S=new int[n];
for(int i=0;i<n;i++) S[i]=sc.nextInt();
q=sc.nextInt();
T=new int[q];
for(int i=0;i<q;i++) T[i]=sc.nextInt();
int count=0;
for(int i=0;i<q;i++){
if(binary_search(T[i])){
count++;
}
}
System.out.println (count);
sc.close();
}
private static boolean binary_search(int key){
int left=0;
int right=n-1;
while(right>=left){
int mid=(left+right)/2;
if(S[mid]==key) return true;
else if (S[mid] > key) right = mid - 1;
else if (S[mid] < key) left = mid + 1;
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
18,
13,
13,
17,
41,
13,
4,
18,
13,
41,
13,
17,
42,
2,
13,
17,
30,
41,
13,
4,
18,
13,
14,
4,
18,
13,
13,
40,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
93,
11
],
[
93,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
14,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
53,
54
],
[
53,
55
],
[
50,
56
],
[
14,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
14,
62
],
[
62,
63
],
[
62,
64
],
[
14,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
69,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
75,
80
],
[
80,
81
],
[
69,
82
],
[
82,
83
],
[
14,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
12,
90
],
[
90,
91
],
[
0,
92
],
[
92,
93
],
[
92,
94
]
] | [
"import java.util.Scanner;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class Main{\n public static void main(final String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"public class Main{\n public static void main(final String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(final String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"Map<Integer, Integer> mp = new HashMap<Integer, Integer>();",
"mp",
"new HashMap<Integer, Integer>()",
"for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }",
"{\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }",
"a[i] = scan.nextInt()",
"a[i]",
"a",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"mp.put(a[i], 1)",
"mp.put",
"mp",
"a[i]",
"a",
"i",
"1",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ans = 0;",
"ans",
"0",
"while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }",
"q > 0",
"q",
"0",
"{\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }",
"final int s = scan.nextInt();",
"s",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(mp.containsKey(s)) ans++;",
"mp.containsKey(s)",
"mp.containsKey",
"mp",
"s",
"ans++",
"ans",
"q--",
"q",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"final String[] args",
"args",
"public class Main{\n public static void main(final String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }\n}",
"public class Main{\n public static void main(final String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] a = new int[n];\n Map<Integer, Integer> mp = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n a[i] = scan.nextInt();\n mp.put(a[i], 1);\n }\n int q = scan.nextInt();\n int ans = 0;\n while (q > 0) {\n final int s = scan.nextInt();\n if(mp.containsKey(s)) ans++;\n q--;\n }\n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
public class Main{
public static void main(final String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a = new int[n];
Map<Integer, Integer> mp = new HashMap<Integer, Integer>();
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
mp.put(a[i], 1);
}
int q = scan.nextInt();
int ans = 0;
while (q > 0) {
final int s = scan.nextInt();
if(mp.containsKey(s)) ans++;
q--;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
148,
8
],
[
148,
9
],
[
9,
10
],
[
148,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
13,
22
],
[
22,
23
],
[
22,
24
],
[
13,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
13,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
13,
51
],
[
51,
52
],
[
51,
53
],
[
13,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
74,
78
],
[
73,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
13,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
11,
89
],
[
89,
90
],
[
148,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
93,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
116,
122
],
[
122,
123
],
[
123,
124
],
[
108,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
125,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
93,
143
],
[
143,
144
],
[
91,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n static int[] a;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n public static boolean binarySearchContains(int v) {\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int[] a;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n public static boolean binarySearchContains(int v) {\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"Main",
"static int[] a;",
"a",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"a = new int[n]",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextInt();\n }",
"{\n a[i] = sc.nextInt();\n }",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int c = 0;",
"c",
"0",
"for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }",
"{\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }",
"Arrays.binarySearch(a, t) >= 0",
"Arrays.binarySearch(a, t)",
"Arrays.binarySearch",
"Arrays",
"a",
"t",
"0",
"{\n c++;\n }",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public static boolean binarySearchContains(int v) {\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }",
"binarySearchContains",
"{\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }",
"int l = 0;",
"l",
"0",
"int r = a.length - 1;",
"r",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }",
"l <= r",
"l",
"r",
"{\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }",
"int m = (r + l) / 2;",
"m",
"(r + l) / 2",
"(r + l)",
"r",
"l",
"2",
"if (a[m] == v) {\n return true;\n }",
"a[m] == v",
"a[m]",
"a",
"m",
"v",
"{\n return true;\n }",
"return true;",
"true",
"if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }",
"a[m] > v",
"a[m]",
"a",
"m",
"v",
"{\n r = m - 1;\n }",
"r = m - 1",
"r",
"m - 1",
"m",
"1",
"{\n l = m + 1;\n }",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"return false;",
"false",
"int v",
"v",
"public class Main {\n static int[] a;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n public static boolean binarySearchContains(int v) {\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"public class Main {\n static int[] a;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n // if (binarySearchContains(t)) {\n // c++;\n // }\n if (Arrays.binarySearch(a, t) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n\n public static boolean binarySearchContains(int v) {\n int l = 0; // left\n int r = a.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (a[m] == v) {\n return true;\n }\n if (a[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int[] a;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
int q = sc.nextInt();
int c = 0;
for (int i = 0; i < q; i++) {
int t = sc.nextInt();
// if (binarySearchContains(t)) {
// c++;
// }
if (Arrays.binarySearch(a, t) >= 0) {
c++;
}
}
System.out.println(c);
}
public static boolean binarySearchContains(int v) {
int l = 0; // left
int r = a.length - 1; // right
while (l <= r) {
int m = (r + l) / 2;
if (a[m] == v) {
return true;
}
if (a[m] > v) {
r = m - 1;
} else {
l = m + 1;
}
}
return false;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
0,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
0,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
9,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
9,
29,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
194,
14
],
[
194,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
35,
40
],
[
17,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
17,
64
],
[
64,
65
],
[
64,
66
],
[
17,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
72,
73
],
[
73,
74
],
[
17,
75
],
[
75,
76
],
[
75,
77
],
[
17,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
81,
86
],
[
17,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
107,
109
],
[
17,
110
],
[
110,
111
],
[
110,
112
],
[
17,
113
],
[
113,
114
],
[
113,
115
],
[
17,
116
],
[
116,
117
],
[
116,
118
],
[
116,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
121,
126
],
[
126,
127
],
[
127,
128
],
[
17,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
15,
135
],
[
135,
136
],
[
194,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
139,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
152,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
152,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
152,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
178,
184
],
[
152,
185
],
[
185,
186
],
[
139,
187
],
[
187,
188
],
[
137,
189
],
[
189,
190
],
[
137,
191
],
[
191,
192
],
[
0,
193
],
[
193,
194
],
[
193,
195
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main {\n public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"Main",
"public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"String[] tmpS = br.readLine().split(\" \");",
"tmpS",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(tmpS[i]);\n }",
"{\n s[i] = Integer.parseInt(tmpS[i]);\n }",
"s[i] = Integer.parseInt(tmpS[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(tmpS[i])",
"Integer.parseInt",
"Integer",
"tmpS[i]",
"tmpS",
"i",
"tmpS = null",
"tmpS",
"null",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"String[] tmpT = br.readLine().split(\" \");",
"tmpT",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = Integer.parseInt(tmpT[i]);\n }",
"{\n t[i] = Integer.parseInt(tmpT[i]);\n }",
"t[i] = Integer.parseInt(tmpT[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(tmpT[i])",
"Integer.parseInt",
"Integer",
"tmpT[i]",
"tmpT",
"i",
"tmpT = null",
"tmpT",
"null",
"int count = 0;",
"count",
"0",
"for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }",
"int i",
"t",
"{\n if (binarySearch(s, i)) {\n count++;\n }\n }",
"{\n if (binarySearch(s, i)) {\n count++;\n }\n }",
"if (binarySearch(s, i)) {\n count++;\n }",
"binarySearch(s, i)",
"binarySearch",
"s",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"private static boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = array.length;",
"right",
"array.length",
"array",
"array.length",
"while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"int temp = array[mid];",
"temp",
"array[mid]",
"array",
"mid",
"if (target < temp) {\n right = mid;\n continue;\n }",
"target < temp",
"target",
"temp",
"{\n right = mid;\n continue;\n }",
"right = mid",
"right",
"mid",
"continue;",
"if (temp < target) {\n left = mid + 1;\n continue;\n }",
"temp < target",
"temp",
"target",
"{\n left = mid + 1;\n continue;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"continue;",
"return true;",
"true",
"return false;",
"false",
"int[] array",
"array",
"int target",
"target",
"public class Main {\n public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"public class Main {\n public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt(br.readLine());\n int[] s = new int[n];\n String[] tmpS = br.readLine().split(\" \");\n for(int i = 0; i < n; i++) {\n s[i] = Integer.parseInt(tmpS[i]);\n }\n tmpS = null;\n\n int q = Integer.parseInt(br.readLine());\n int[] t = new int[q];\n String[] tmpT = br.readLine().split(\" \");\n for (int i = 0; i < q; i++) {\n t[i] = Integer.parseInt(tmpT[i]);\n }\n tmpT = null;\n\n int count = 0;\n for(int i : t) {\n if (binarySearch(s, i)) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] array, int target) {\n int left = 0;\n int right = array.length;\n while (left < right) {\n int mid = (left + right) / 2;\n int temp = array[mid];\n if (target < temp) {\n right = mid;\n continue;\n }\n if (temp < target) {\n left = mid + 1;\n continue;\n }\n return true;\n }\n return false;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main (String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] s = new int[n];
String[] tmpS = br.readLine().split(" ");
for(int i = 0; i < n; i++) {
s[i] = Integer.parseInt(tmpS[i]);
}
tmpS = null;
int q = Integer.parseInt(br.readLine());
int[] t = new int[q];
String[] tmpT = br.readLine().split(" ");
for (int i = 0; i < q; i++) {
t[i] = Integer.parseInt(tmpT[i]);
}
tmpT = null;
int count = 0;
for(int i : t) {
if (binarySearch(s, i)) {
count++;
}
}
System.out.println(count);
}
private static boolean binarySearch(int[] array, int target) {
int left = 0;
int right = array.length;
while (left < right) {
int mid = (left + right) / 2;
int temp = array[mid];
if (target < temp) {
right = mid;
continue;
}
if (temp < target) {
left = mid + 1;
continue;
}
return true;
}
return false;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
4,
8
],
[
8,
9
],
[
4,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
16,
18
],
[
12,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
31,
37
],
[
37,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
39,
45
],
[
45,
46
],
[
45,
47
],
[
39,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
12,
53
],
[
53,
54
],
[
10,
55
],
[
55,
56
],
[
10,
57
],
[
57,
58
],
[
10,
59
],
[
59,
60
],
[
4,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
63,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
63,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
63,
101
],
[
101,
102
],
[
101,
103
],
[
63,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
63,
125
],
[
125,
126
],
[
125,
127
],
[
63,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
128,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
143,
146
],
[
146,
147
],
[
146,
148
],
[
143,
149
],
[
63,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
61,
156
],
[
156,
157
]
] | [
"import java.util.Scanner;\n\nclass Main\n{\n static int n;\n static int q;\n\n static int Search(int[]s, int t, int n)\n {\n int left = 0;\n int right = n;\n\n while(left < right)\n {\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }\n return 0;\n }\n\n public static void main(String[]args)\n {\n Scanner In = new Scanner(System.in);\n\n n = In.nextInt();\n int []S = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n S[i] = In.nextInt();\n }\n\n q = In.nextInt();\n int []T = new int[q];\n\n for(int i = 0; i < q; i++)\n {\n T[i] = In.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < q; i++)\n {\n count += Search(S,T[i],n);\n }\n\n System.out.println(count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main\n{\n static int n;\n static int q;\n\n static int Search(int[]s, int t, int n)\n {\n int left = 0;\n int right = n;\n\n while(left < right)\n {\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }\n return 0;\n }\n\n public static void main(String[]args)\n {\n Scanner In = new Scanner(System.in);\n\n n = In.nextInt();\n int []S = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n S[i] = In.nextInt();\n }\n\n q = In.nextInt();\n int []T = new int[q];\n\n for(int i = 0; i < q; i++)\n {\n T[i] = In.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < q; i++)\n {\n count += Search(S,T[i],n);\n }\n\n System.out.println(count);\n }\n}",
"Main",
"static int n;",
"n",
"static int q;",
"q",
"static int Search(int[]s, int t, int n)\n {\n int left = 0;\n int right = n;\n\n while(left < right)\n {\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }\n return 0;\n }",
"Search",
"{\n int left = 0;\n int right = n;\n\n while(left < right)\n {\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }\n return 0;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right)\n {\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n\n if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(s[mid] == t)\n return 1;\n\n else if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;",
"s[mid] == t",
"s[mid]",
"s",
"mid",
"t",
"return 1;",
"1",
"if(t < s[mid])\n right = mid;\n\n else \n left = mid + 1;",
"t < s[mid]",
"t",
"s[mid]",
"s",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int[]s",
"s",
"int t",
"t",
"int n",
"n",
"public static void main(String[]args)\n {\n Scanner In = new Scanner(System.in);\n\n n = In.nextInt();\n int []S = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n S[i] = In.nextInt();\n }\n\n q = In.nextInt();\n int []T = new int[q];\n\n for(int i = 0; i < q; i++)\n {\n T[i] = In.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < q; i++)\n {\n count += Search(S,T[i],n);\n }\n\n System.out.println(count);\n }",
"main",
"{\n Scanner In = new Scanner(System.in);\n\n n = In.nextInt();\n int []S = new int[n];\n\n for(int i = 0; i < n; i++)\n {\n S[i] = In.nextInt();\n }\n\n q = In.nextInt();\n int []T = new int[q];\n\n for(int i = 0; i < q; i++)\n {\n T[i] = In.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < q; i++)\n {\n count += Search(S,T[i],n);\n }\n\n System.out.println(count);\n }",
"Scanner In = new Scanner(System.in);",
"In",
"new Scanner(System.in)",
"n = In.nextInt()",
"n",
"In.nextInt()",
"In.nextInt",
"In",
"int []S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++)\n {\n S[i] = In.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = In.nextInt();\n }",
"{\n S[i] = In.nextInt();\n }",
"S[i] = In.nextInt()",
"S[i]",
"S",
"i",
"In.nextInt()",
"In.nextInt",
"In",
"q = In.nextInt()",
"q",
"In.nextInt()",
"In.nextInt",
"In",
"int []T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i = 0; i < q; i++)\n {\n T[i] = In.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = In.nextInt();\n }",
"{\n T[i] = In.nextInt();\n }",
"T[i] = In.nextInt()",
"T[i]",
"T",
"i",
"In.nextInt()",
"In.nextInt",
"In",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++)\n {\n count += Search(S,T[i],n);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n count += Search(S,T[i],n);\n }",
"{\n count += Search(S,T[i],n);\n }",
"count += Search(S,T[i],n)",
"count",
"Search(S,T[i],n)",
"Search",
"S",
"T[i]",
"T",
"i",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[]args",
"args"
] | import java.util.Scanner;
class Main
{
static int n;
static int q;
static int Search(int[]s, int t, int n)
{
int left = 0;
int right = n;
while(left < right)
{
int mid = (left + right) / 2;
if(s[mid] == t)
return 1;
else if(t < s[mid])
right = mid;
else
left = mid + 1;
}
return 0;
}
public static void main(String[]args)
{
Scanner In = new Scanner(System.in);
n = In.nextInt();
int []S = new int[n];
for(int i = 0; i < n; i++)
{
S[i] = In.nextInt();
}
q = In.nextInt();
int []T = new int[q];
for(int i = 0; i < q; i++)
{
T[i] = In.nextInt();
}
int count = 0;
for(int i = 0; i < q; i++)
{
count += Search(S,T[i],n);
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
17,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
30,
29,
17,
14,
4,
18,
13,
18,
13,
13,
30,
29,
17,
14,
2,
4,
18,
13,
13,
4,
18,
13,
18,
13,
13,
30,
29,
4,
13,
13,
13,
2,
13,
17,
13,
30,
29,
4,
13,
13,
13,
13,
2,
13,
17,
23,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
156,
11
],
[
156,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
14,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
44,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
67,
74
],
[
74,
75
],
[
74,
76
],
[
66,
77
],
[
77,
78
],
[
78,
79
],
[
14,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
12,
86
],
[
86,
87
],
[
156,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
90,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
109,
111
],
[
105,
112
],
[
112,
113
],
[
113,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
116,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
124,
126
],
[
115,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
129,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
129,
136
],
[
115,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
139,
142
],
[
139,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
88,
147
],
[
147,
148
],
[
88,
149
],
[
149,
150
],
[
88,
151
],
[
151,
152
],
[
88,
153
],
[
153,
154
],
[
0,
155
],
[
155,
156
],
[
155,
157
]
] | [
"\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n\n private static boolean binarySearch(String sp2[], String key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }\n\n}\n",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n\n private static boolean binarySearch(String sp2[], String key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }",
"BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));",
"bf",
"new BufferedReader(new InputStreamReader(System.in))",
"int n1 = Integer.parseInt(bf.readLine());",
"n1",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"String[] sp1 = bf.readLine().split(\" \");",
"sp1",
"bf.readLine().split(\" \")",
"bf.readLine().split",
"bf.readLine()",
"bf.readLine",
"bf",
"\" \"",
"int n2 = Integer.parseInt(bf.readLine());",
"n2",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"String[] sp2 = bf.readLine().split(\" \");",
"sp2",
"bf.readLine().split(\" \")",
"bf.readLine().split",
"bf.readLine()",
"bf.readLine",
"bf",
"\" \"",
"int sum = 0;",
"sum",
"0",
"for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n2",
"j",
"n2",
"j++",
"j++",
"j",
"{\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }",
"{\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }",
"if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }",
"binarySearch(sp1, sp2[j], 0, n1-1)",
"binarySearch",
"sp1",
"sp2[j]",
"sp2",
"j",
"0",
"n1-1",
"n1",
"1",
"{\n sum++;\n }",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"private static boolean binarySearch(String sp2[], String key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }",
"binarySearch",
"{\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (left > right) {\n return false;\n }",
"left > right",
"left",
"right",
"{\n return false;\n }",
"return false;",
"false",
"if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }",
"key.equals(sp2[mid])",
"key.equals",
"key",
"sp2[mid]",
"sp2",
"mid",
"{\n return true;\n }",
"return true;",
"true",
"if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }",
"Integer.parseInt(key) > Integer.parseInt(sp2[mid])",
"Integer.parseInt(key)",
"Integer.parseInt",
"Integer",
"key",
"Integer.parseInt(sp2[mid])",
"Integer.parseInt",
"Integer",
"sp2[mid]",
"sp2",
"mid",
"{\n return binarySearch(sp2, key, mid+1, right);\n }",
"return binarySearch(sp2, key, mid+1, right);",
"binarySearch(sp2, key, mid+1, right)",
"binarySearch",
"sp2",
"key",
"mid+1",
"mid",
"1",
"right",
"{\n return binarySearch(sp2, key, left, mid-1);\n }",
"return binarySearch(sp2, key, left, mid-1);",
"binarySearch(sp2, key, left, mid-1)",
"binarySearch",
"sp2",
"key",
"left",
"mid-1",
"mid",
"1",
"String sp2[]",
"sp2",
"String key",
"key",
"int left",
"left",
"int right",
"right",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n\n private static boolean binarySearch(String sp2[], String key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }\n\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n1 = Integer.parseInt(bf.readLine());\n String[] sp1 = bf.readLine().split(\" \");\n int n2 = Integer.parseInt(bf.readLine());\n String[] sp2 = bf.readLine().split(\" \");\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (binarySearch(sp1, sp2[j], 0, n1-1)) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n\n private static boolean binarySearch(String sp2[], String key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return false;\n }\n if (key.equals(sp2[mid])) {\n return true;\n } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\n\n }\n\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int n1 = Integer.parseInt(bf.readLine());
String[] sp1 = bf.readLine().split(" ");
int n2 = Integer.parseInt(bf.readLine());
String[] sp2 = bf.readLine().split(" ");
int sum = 0;
for (int j = 0; j < n2; j++) {
if (binarySearch(sp1, sp2[j], 0, n1-1)) {
sum++;
}
}
System.out.println(sum);
}
private static boolean binarySearch(String sp2[], String key, int left, int right) {
int mid = (left + right) / 2;
if (left > right) {
return false;
}
if (key.equals(sp2[mid])) {
return true;
} else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
return binarySearch(sp2, key, mid+1, right);
} else {
return binarySearch(sp2, key, left, mid-1);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
4,
18,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
4,
18,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
145,
8
],
[
145,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
11,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
11,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
68,
73
],
[
68,
74
],
[
67,
75
],
[
75,
76
],
[
11,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
9,
83
],
[
83,
84
],
[
145,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
87,
94
],
[
94,
95
],
[
87,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
100,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
111,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
120,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
87,
136
],
[
136,
137
],
[
85,
138
],
[
138,
139
],
[
85,
140
],
[
140,
141
],
[
85,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
] | [
"import java.util.*;\n\nimport org.omg.Messaging.SYNC_WITH_TRANSPORT;\n\npublic class Main {\n public static void main(String[] args) {\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }\n \n static boolean search(int key, int n, int[] s) {\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import org.omg.Messaging.SYNC_WITH_TRANSPORT;",
"SYNC_WITH_TRANSPORT",
"org.omg.Messaging",
"public class Main {\n public static void main(String[] args) {\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }\n \n static boolean search(int key, int n, int[] s) {\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }",
"main",
"{\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n+1];",
"s",
"new int[n+1]",
"n+1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(search(sc.nextInt(),n,s))ans++;;\n }",
"{\n if(search(sc.nextInt(),n,s))ans++;;\n }",
"if(search(sc.nextInt(),n,s))ans++;",
"search(sc.nextInt(),n,s)",
"search",
"sc.nextInt()",
"sc.nextInt",
"sc",
"n",
"s",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static boolean search(int key, int n, int[] s) {\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }",
"search",
"{\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }",
"mid = (int) Math.floor((right + left) / 2.0)",
"mid",
"(int) Math.floor((right + left) / 2.0)",
"Math.floor",
"Math",
"(right + left) / 2.0",
"(right + left)",
"right",
"left",
"2.0",
"if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"s[mid] == key",
"s[mid]",
"s",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }",
"key < s[mid]",
"key",
"s[mid]",
"s",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int key",
"key",
"int n",
"n",
"int[] s",
"s",
"public class Main {\n public static void main(String[] args) {\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }\n \n static boolean search(int key, int n, int[] s) {\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n /*\n n: 5\n S: 1 2 3 4 5 \n q: 3\n T: 3 4 1\n out: 3\n */\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n+1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if(search(sc.nextInt(),n,s))ans++;;\n }\n System.out.println(ans);\n }\n \n static boolean search(int key, int n, int[] s) {\n //iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2\n //5 ・・・ 2 \n int left = 0;\n int right = n;\n int mid;\n while (left < right) {\n mid = (int) Math.floor((right + left) / 2.0);\n if (s[mid] == key) {\n return true;\n } else if (key < s[mid]) {\n right = mid;\n } else {\n left = mid + 1;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.*;
import org.omg.Messaging.SYNC_WITH_TRANSPORT;
public class Main {
public static void main(String[] args) {
/*
n: 5
S: 1 2 3 4 5
q: 3
T: 3 4 1
out: 3
*/
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n+1];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int ans = 0;
for (int i = 0; i < q; i++) {
if(search(sc.nextInt(),n,s))ans++;;
}
System.out.println(ans);
}
static boolean search(int key, int n, int[] s) {
//iは要素の半分、key以下だったらi-1をさらにその半分、以上だったらn+i/2
//5 ・・・ 2
int left = 0;
int right = n;
int mid;
while (left < right) {
mid = (int) Math.floor((right + left) / 2.0);
if (s[mid] == key) {
return true;
} else if (key < s[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
18,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
20,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
29,
4,
18,
13,
13,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
6,
13,
12,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
331,
17
],
[
331,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
20,
29
],
[
29,
30
],
[
29,
31
],
[
20,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
20,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
20,
58
],
[
58,
59
],
[
58,
60
],
[
20,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
80,
81
],
[
20,
82
],
[
82,
83
],
[
82,
84
],
[
20,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
85,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
20,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
18,
117
],
[
117,
118
],
[
331,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
119,
127
],
[
127,
128
],
[
119,
129
],
[
129,
130
],
[
119,
131
],
[
131,
132
],
[
119,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
133,
141
],
[
141,
142
],
[
119,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
146,
151
],
[
151,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
161,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
157,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
178,
179
],
[
179,
180
],
[
145,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
119,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
188,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
188,
202
],
[
202,
203
],
[
202,
204
],
[
188,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
205,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
211,
214
],
[
210,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
188,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
119,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
225,
230
],
[
230,
231
],
[
231,
232
],
[
231,
233
],
[
230,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
225,
238
],
[
238,
239
],
[
238,
240
],
[
225,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
245,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
225,
254
],
[
254,
255
],
[
254,
256
],
[
225,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
257,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
264,
268
],
[
268,
269
],
[
268,
270
],
[
263,
271
],
[
271,
272
],
[
262,
273
],
[
273,
274
],
[
273,
275
],
[
262,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
278,
280
],
[
262,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
225,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
119,
289
],
[
289,
290
],
[
289,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
292,
296
],
[
296,
297
],
[
297,
298
],
[
298,
299
],
[
297,
300
],
[
291,
301
],
[
301,
302
],
[
305,
303
],
[
315,
304
],
[
312,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
309
],
[
309,
310
],
[
309,
311
],
[
312,
312
],
[
312,
313
],
[
312,
314
],
[
315,
315
],
[
315,
316
],
[
315,
317
],
[
305,
318
],
[
318,
319
],
[
318,
320
],
[
320,
321
],
[
289,
322
],
[
322,
323
],
[
119,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
0,
330
],
[
330,
331
],
[
330,
332
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.Scanner;\n\npublic class Main {\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n public static void main(String[] args) throws IOException {\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n public static void main(String[] args) throws IOException {\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }",
"InputReader sc = new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"int n1 = sc.nextInt();",
"n1",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sp1[] = new int[n1];",
"sp1",
"new int[n1]",
"n1",
"for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n1",
"i",
"n1",
"i++",
"i++",
"i",
"{\n sp1[i] = sc.nextInt();\n }",
"{\n sp1[i] = sc.nextInt();\n }",
"sp1[i] = sc.nextInt()",
"sp1[i]",
"sp1",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int n2 = sc.nextInt();",
"n2",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sp2[] = new int[n1];",
"sp2",
"new int[n1]",
"n1",
"for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n2",
"i",
"n2",
"i++",
"i++",
"i",
"{\n sp2[i] = sc.nextInt();\n }",
"{\n sp2[i] = sc.nextInt();\n }",
"sp2[i] = sc.nextInt()",
"sp2[i]",
"sp2",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sum = 0;",
"sum",
"0",
"for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n2",
"j",
"n2",
"j++",
"j++",
"j",
"{\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }",
"{\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }",
"if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }",
"Arrays.binarySearch(sp1, sp2[j]) > 0",
"Arrays.binarySearch(sp1, sp2[j])",
"Arrays.binarySearch",
"Arrays",
"sp1",
"sp2[j]",
"sp2",
"j",
"0",
"{\n sum++;\n }",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"next",
"{\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (numChars == -1)\n throw new InputMismatchException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }",
"nextStr",
"{\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }",
"int c = next();",
"c",
"next()",
"next",
"while (isSpaceChar(c)) {\n c = next();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = next();\n }",
"c = next()",
"c",
"next()",
"next",
"StringBuffer str = new StringBuffer();",
"str",
"new StringBuffer()",
"do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n str.append((char) c);\n c = next();\n }",
"str.append((char) c)",
"str.append",
"str",
"(char) c",
"c = next()",
"c",
"next()",
"next",
"return str.toString();",
"str.toString()",
"str.toString",
"str",
"public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = next();",
"c",
"next()",
"next",
"while (isSpaceChar(c))\n c = next();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = next()",
"c",
"next()",
"next",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = next();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = next();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = next()",
"c",
"next()",
"next",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n }",
"if (c < '0' || c > '9')\n throw new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = next()",
"c",
"next()",
"next",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"if (filter != null)\n return filter.isSpaceChar(c);",
"filter != null",
"filter",
"null",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n public static void main(String[] args) throws IOException {\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String nextStr() {\n int c = next();\n while (isSpaceChar(c)) {\n c = next();\n }\n StringBuffer str = new StringBuffer();\n do {\n str.append((char) c);\n c = next();\n } while (!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n public static void main(String[] args) throws IOException {\n\n InputReader sc = new InputReader(System.in);\n int n1 = sc.nextInt();\n int sp1[] = new int[n1];\n for (int i = 0; i < n1; i++) {\n sp1[i] = sc.nextInt();\n }\n int n2 = sc.nextInt();\n int sp2[] = new int[n1];\n for (int i = 0; i < n2; i++) {\n sp2[i] = sc.nextInt();\n }\n int sum = 0;\n for (int j = 0; j < n2; j++) {\n if (Arrays.binarySearch(sp1, sp2[j]) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int next() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextStr() {
int c = next();
while (isSpaceChar(c)) {
c = next();
}
StringBuffer str = new StringBuffer();
do {
str.append((char) c);
c = next();
} while (!isSpaceChar(c));
return str.toString();
}
public int nextInt() {
int c = next();
while (isSpaceChar(c))
c = next();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = next();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = next();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
public static void main(String[] args) throws IOException {
InputReader sc = new InputReader(System.in);
int n1 = sc.nextInt();
int sp1[] = new int[n1];
for (int i = 0; i < n1; i++) {
sp1[i] = sc.nextInt();
}
int n2 = sc.nextInt();
int sp2[] = new int[n1];
for (int i = 0; i < n2; i++) {
sp2[i] = sc.nextInt();
}
int sum = 0;
for (int j = 0; j < n2; j++) {
if (Arrays.binarySearch(sp1, sp2[j]) > 0) {
sum++;
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
40,
17,
40,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
89,
8
],
[
89,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
9,
15
],
[
15,
16
],
[
89,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
19,
28
],
[
28,
29
],
[
28,
30
],
[
19,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
19,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
19,
57
],
[
57,
58
],
[
57,
59
],
[
19,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
60,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
71,
80
],
[
80,
81
],
[
19,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
0,
88
],
[
88,
89
],
[
88,
90
]
] | [
"\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"private void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"run",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}",
"num[i] = scanner.nextInt()",
"num[i]",
"num",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int m = scanner.nextInt();",
"m",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int count = 0;",
"count",
"0",
"while (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}",
"m-- > 0",
"m--",
"m",
"0",
"{\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}",
"int a = scanner.nextInt();",
"a",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;",
"Arrays.binarySearch(num, a) > -1",
"Arrays.binarySearch(num, a)",
"Arrays.binarySearch",
"Arrays",
"num",
"a",
"-1",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tprivate void run() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scanner.nextInt();\n\t\t}\n\t\tint m = scanner.nextInt();\n\t\tint count = 0;\n\t\twhile (m-- > 0) {\n\t\t\tint a = scanner.nextInt();\n\t\t\tif (Arrays.binarySearch(num, a) > -1)\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
private void run() {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] num = new int[n];
for (int i = 0; i < n; i++) {
num[i] = scanner.nextInt();
}
int m = scanner.nextInt();
int count = 0;
while (m-- > 0) {
int a = scanner.nextInt();
if (Arrays.binarySearch(num, a) > -1)
count++;
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
11,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
11,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
9,
105
],
[
105,
106
],
[
7,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
109,
118
],
[
118,
119
],
[
118,
120
],
[
109,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
133,
139
],
[
139,
140
],
[
140,
141
],
[
133,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
142,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
109,
158
],
[
158,
159
],
[
107,
160
],
[
160,
161
],
[
107,
162
],
[
162,
163
]
] | [
"import java.io.*;\nimport java.util.*;\n\n\nclass Main{\n public static void main(String[] args){\n\tScanner sc = new Scanner(System.in);\n\tint count = 0;\n\tint R = sc.nextInt();\n\tint[] A = new int[R];\n\tfor(int i = 0;i < R;i++){\n\t A[i] = sc.nextInt();\n\t}\n\tint N = sc.nextInt();\n\tint[] B = new int[N];\n\tfor(int j = 0;j < N;j++){\n\t B[j] = sc.nextInt();\n\t}\n\tfor(int j = 0;j < N;j++){\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}\n\tSystem.out.println(count);\n }\n // public static boolean linearSearch(int[] A,int key){\n// \tint i = 0;\n// \tfor(i = 0;i < A.length;i++){\n// \t if(A[i] == key){\n// \t\treturn true;\n// \t }\n// \t}\n// \treturn false;\n// }\n// }\n public static boolean binarySearch(int[] A,int key){\n \tint left = 0;\n \tint right = A.length;\n \tint mid = 0;\n \twhile(left < right){\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}\n \treturn false;\n }\n}\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args){\n\tScanner sc = new Scanner(System.in);\n\tint count = 0;\n\tint R = sc.nextInt();\n\tint[] A = new int[R];\n\tfor(int i = 0;i < R;i++){\n\t A[i] = sc.nextInt();\n\t}\n\tint N = sc.nextInt();\n\tint[] B = new int[N];\n\tfor(int j = 0;j < N;j++){\n\t B[j] = sc.nextInt();\n\t}\n\tfor(int j = 0;j < N;j++){\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}\n\tSystem.out.println(count);\n }\n // public static boolean linearSearch(int[] A,int key){\n// \tint i = 0;\n// \tfor(i = 0;i < A.length;i++){\n// \t if(A[i] == key){\n// \t\treturn true;\n// \t }\n// \t}\n// \treturn false;\n// }\n// }\n public static boolean binarySearch(int[] A,int key){\n \tint left = 0;\n \tint right = A.length;\n \tint mid = 0;\n \twhile(left < right){\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}\n \treturn false;\n }\n}",
"Main",
"public static void main(String[] args){\n\tScanner sc = new Scanner(System.in);\n\tint count = 0;\n\tint R = sc.nextInt();\n\tint[] A = new int[R];\n\tfor(int i = 0;i < R;i++){\n\t A[i] = sc.nextInt();\n\t}\n\tint N = sc.nextInt();\n\tint[] B = new int[N];\n\tfor(int j = 0;j < N;j++){\n\t B[j] = sc.nextInt();\n\t}\n\tfor(int j = 0;j < N;j++){\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}\n\tSystem.out.println(count);\n }",
"main",
"{\n\tScanner sc = new Scanner(System.in);\n\tint count = 0;\n\tint R = sc.nextInt();\n\tint[] A = new int[R];\n\tfor(int i = 0;i < R;i++){\n\t A[i] = sc.nextInt();\n\t}\n\tint N = sc.nextInt();\n\tint[] B = new int[N];\n\tfor(int j = 0;j < N;j++){\n\t B[j] = sc.nextInt();\n\t}\n\tfor(int j = 0;j < N;j++){\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}\n\tSystem.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int R = sc.nextInt();",
"R",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A = new int[R];",
"A",
"new int[R]",
"R",
"for(int i = 0;i < R;i++){\n\t A[i] = sc.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < R",
"i",
"R",
"i++",
"i++",
"i",
"{\n\t A[i] = sc.nextInt();\n\t}",
"{\n\t A[i] = sc.nextInt();\n\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] B = new int[N];",
"B",
"new int[N]",
"N",
"for(int j = 0;j < N;j++){\n\t B[j] = sc.nextInt();\n\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n\t B[j] = sc.nextInt();\n\t}",
"{\n\t B[j] = sc.nextInt();\n\t}",
"B[j] = sc.nextInt()",
"B[j]",
"B",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j = 0;j < N;j++){\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}",
"{\n\t if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }\n\t}",
"if(binarySearch(A,B[j])){\n\t\tcount++;\n\t }",
"binarySearch(A,B[j])",
"binarySearch",
"A",
"B[j]",
"B",
"j",
"{\n\t\tcount++;\n\t }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"// public static boolean linearSearch(int[] A,int key){\n// \tint i = 0;\n// \tfor(i = 0;i < A.length;i++){\n// \t if(A[i] == key){\n// \t\treturn true;\n// \t }\n// \t}\n// \treturn false;\n// }\n// }\n public static boolean binarySearch(int[] A,int key){\n \tint left = 0;\n \tint right = A.length;\n \tint mid = 0;\n \twhile(left < right){\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}\n \treturn false;\n }",
"binarySearch",
"{\n \tint left = 0;\n \tint right = A.length;\n \tint mid = 0;\n \twhile(left < right){\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}\n \treturn false;\n }",
"int left = 0;",
"left",
"0",
"int right = A.length;",
"right",
"A.length",
"A",
"A.length",
"int mid = 0;",
"mid",
"0",
"while(left < right){\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}",
"left < right",
"left",
"right",
"{\n \t mid = (left + right) / 2;\n\t \n \t if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }\n \t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(A[mid] == key){\n \t\treturn true;\n \t }else if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }",
"A[mid] == key",
"A[mid]",
"A",
"mid",
"key",
"{\n \t\treturn true;\n \t }",
"return true;",
"true",
"if(key < A[mid]){\n \t\tright = mid;\n \t }else{\n \t\tleft = mid + 1;\n \t }",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"{\n \t\tright = mid;\n \t }",
"right = mid",
"right",
"mid",
"{\n \t\tleft = mid + 1;\n \t }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] A",
"A",
"int key",
"key"
] | import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int count = 0;
int R = sc.nextInt();
int[] A = new int[R];
for(int i = 0;i < R;i++){
A[i] = sc.nextInt();
}
int N = sc.nextInt();
int[] B = new int[N];
for(int j = 0;j < N;j++){
B[j] = sc.nextInt();
}
for(int j = 0;j < N;j++){
if(binarySearch(A,B[j])){
count++;
}
}
System.out.println(count);
}
// public static boolean linearSearch(int[] A,int key){
// int i = 0;
// for(i = 0;i < A.length;i++){
// if(A[i] == key){
// return true;
// }
// }
// return false;
// }
// }
public static boolean binarySearch(int[] A,int key){
int left = 0;
int right = A.length;
int mid = 0;
while(left < right){
mid = (left + right) / 2;
if(A[mid] == key){
return true;
}else if(key < A[mid]){
right = mid;
}else{
left = mid + 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
103,
5
],
[
103,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
10,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
10,
48
],
[
48,
49
],
[
48,
50
],
[
10,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
10,
72
],
[
72,
73
],
[
72,
74
],
[
10,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
10,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
6,
100
],
[
100,
101
],
[
0,
102
],
[
102,
103
],
[
102,
104
]
] | [
"import java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }",
"main",
"{\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }",
"try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }",
"{\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\tS[i] = sc.nextInt();\n \t}",
"{\n \t\tS[i] = sc.nextInt();\n \t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \t\tT[i] = sc.nextInt();\n \t}",
"{\n \t\tT[i] = sc.nextInt();\n \t}",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int C = 0;",
"C",
"0",
"for(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}",
"{\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}",
"int low = 0;",
"low",
"0",
"int high = n;",
"high",
"n",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try(Scanner sc = new Scanner(System.in)){\n \tint n = sc.nextInt();\n \tint [] S = new int[n];\n \tfor(int i=0;i<n;i++) {\n \t\tS[i] = sc.nextInt();\n \t}\n \t\n \tint q = sc.nextInt();\n \tint [] T = new int[q];\n \tfor(int i=0;i<q;i++) {\n \t\tT[i] = sc.nextInt();\n \t}\n \tint C = 0;\n \tfor(int i=0;i<q;i++) {\n \t\tint low = 0;\n \tint high = n;\n \t\tloop:while(low<high) {\n \t\t\tint mid = (low+high)/2;\n \t\t\tif(S[mid]==T[i]) {\n \t\t\t\tC++;\n \t\t\t\tbreak loop;\n \t\t\t}\n \t\t\telse if(S[mid]>T[i]) high=mid;\n \t\t\telse if(S[mid]<T[i]) low=mid+1;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)){
int n = sc.nextInt();
int [] S = new int[n];
for(int i=0;i<n;i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int [] T = new int[q];
for(int i=0;i<q;i++) {
T[i] = sc.nextInt();
}
int C = 0;
for(int i=0;i<q;i++) {
int low = 0;
int high = n;
loop:while(low<high) {
int mid = (low+high)/2;
if(S[mid]==T[i]) {
C++;
break loop;
}
else if(S[mid]>T[i]) high=mid;
else if(S[mid]<T[i]) low=mid+1;
}
}
System.out.println(C);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
41,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
13,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
29,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
152,
5
],
[
152,
6
],
[
6,
7
],
[
152,
8
],
[
8,
9
],
[
152,
10
],
[
10,
11
],
[
10,
12
],
[
152,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
15,
24
],
[
24,
25
],
[
24,
26
],
[
15,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
30,
32
],
[
15,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
15,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
15,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
76,
79
],
[
76,
80
],
[
15,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
15,
87
],
[
87,
88
],
[
88,
89
],
[
13,
90
],
[
90,
91
],
[
152,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
107,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
106,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
92,
145
],
[
145,
146
],
[
92,
147
],
[
147,
148
],
[
92,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static int s[];\n public static int n;\n public static int count = 0;\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }\n\n public static void solve(int key, int right, int left){\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static int s[];\n public static int n;\n public static int count = 0;\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }\n\n public static void solve(int key, int right, int left){\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }\n}",
"Main",
"public static int s[];",
"s",
"public static int n;",
"n",
"public static int count = 0;",
"count",
"0",
"public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"s = new int[n]",
"s",
"new int[n]",
"n",
"int right = n - 1;",
"right",
"n - 1",
"n",
"1",
"for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = scan.nextInt();\n }",
"{\n s[i] = scan.nextInt();\n }",
"s[i] = scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int m = scan.nextInt();\n solve(m, right, 0);\n }",
"{\n int m = scan.nextInt();\n solve(m, right, 0);\n }",
"int m = scan.nextInt();",
"m",
"scan.nextInt()",
"scan.nextInt",
"scan",
"solve(m, right, 0)",
"solve",
"m",
"right",
"0",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scan.close()",
"scan.close",
"scan",
"String args[]",
"args",
"public static void solve(int key, int right, int left){\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }",
"solve",
"{\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }",
"int m = (left + right) / 2;",
"m",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }",
"left <= right",
"left",
"right",
"{\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }",
"if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }",
"s[m] == key",
"s[m]",
"s",
"m",
"key",
"{\n count = count + 1;\n return;\n }",
"count = count + 1",
"count",
"count + 1",
"count",
"1",
"return;",
"if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }",
"s[m] > key",
"s[m]",
"s",
"m",
"key",
"{\n right = m - 1;\n }",
"right = m - 1",
"right",
"m - 1",
"m",
"1",
"{\n left = m + 1;\n }",
"left = m + 1",
"left",
"m + 1",
"m",
"1",
"m = (left + right) / 2",
"m",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"int key",
"key",
"int right",
"right",
"int left",
"left",
"public class Main {\n public static int s[];\n public static int n;\n public static int count = 0;\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }\n\n public static void solve(int key, int right, int left){\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }\n}",
"public class Main {\n public static int s[];\n public static int n;\n public static int count = 0;\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n s = new int[n];\n int right = n - 1;\n for(int i = 0; i < n; i++){\n s[i] = scan.nextInt();\n }\n int q = scan.nextInt();\n for(int i = 0; i < q; i++){\n int m = scan.nextInt();\n solve(m, right, 0);\n }\n\n System.out.println(count);\n scan.close();\n }\n\n public static void solve(int key, int right, int left){\n int m = (left + right) / 2;\n while(left <= right) {\n if (s[m] == key) {\n count = count + 1;\n return;\n } else if (s[m] > key) {\n right = m - 1;\n } else {\n left = m + 1;\n }\n m = (left + right) / 2;\n }\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static int s[];
public static int n;
public static int count = 0;
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
s = new int[n];
int right = n - 1;
for(int i = 0; i < n; i++){
s[i] = scan.nextInt();
}
int q = scan.nextInt();
for(int i = 0; i < q; i++){
int m = scan.nextInt();
solve(m, right, 0);
}
System.out.println(count);
scan.close();
}
public static void solve(int key, int right, int left){
int m = (left + right) / 2;
while(left <= right) {
if (s[m] == key) {
count = count + 1;
return;
} else if (s[m] > key) {
right = m - 1;
} else {
left = m + 1;
}
m = (left + right) / 2;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
60,
5
],
[
60,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
6,
57
],
[
57,
58
],
[
0,
59
],
[
59,
60
],
[
59,
61
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = Integer.parseInt(sc.next());",
"S[i] = Integer.parseInt(sc.next())",
"S[i]",
"S",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n int q = sc.nextInt();\n int ans = 0;\n label:\n for(int i = 0; i < q; i++) {\n int t = Integer.parseInt(sc.next());\n int l = 0;\n int u = n-1;\n while(l <= u) {\n int m = (l + u) / 2;\n if(S[m] == t) {\n ans++;\n continue label;\n }\n if(S[m] < t) l = m+1;\n else u = m-1;\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for(int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
int q = sc.nextInt();
int ans = 0;
label:
for(int i = 0; i < q; i++) {
int t = Integer.parseInt(sc.next());
int l = 0;
int u = n-1;
while(l <= u) {
int m = (l + u) / 2;
if(S[m] == t) {
ans++;
continue label;
}
if(S[m] < t) l = m+1;
else u = m-1;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
17,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
30,
29,
17,
14,
2,
13,
13,
30,
29,
17,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
30,
29,
4,
13,
13,
2,
2,
2,
13,
13,
17,
17,
13,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
30,
29,
4,
13,
13,
13,
2,
2,
2,
13,
13,
17,
17,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
182,
5
],
[
182,
6
],
[
6,
7
],
[
182,
8
],
[
8,
9
],
[
182,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
12,
21
],
[
21,
22
],
[
21,
23
],
[
12,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
12,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
12,
50
],
[
50,
51
],
[
50,
52
],
[
12,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
12,
74
],
[
74,
75
],
[
74,
76
],
[
12,
77
],
[
77,
78
],
[
77,
79
],
[
77,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
83,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
12,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
12,
99
],
[
99,
100
],
[
100,
101
],
[
10,
102
],
[
102,
103
],
[
182,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
108,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
107,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
120,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
128,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
139,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
142,
148
],
[
139,
149
],
[
127,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
151,
159
],
[
150,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
162,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
166,
172
],
[
106,
173
],
[
173,
174
],
[
104,
175
],
[
175,
176
],
[
104,
177
],
[
177,
178
],
[
104,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.Scanner;\npublic class Main {\n static int n;\n static int s[];\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }\n \n public static boolean bsearch(int k, int i, int j){\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int n;\n static int s[];\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }\n \n public static boolean bsearch(int k, int i, int j){\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }\n}",
"Main",
"static int n;",
"n",
"static int s[];",
"s",
"public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"s = new int[n]",
"s",
"new int[n]",
"n",
"for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int t[] = new int[q];",
"t",
"new int[q]",
"q",
"for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = sc.nextInt();\n }",
"{\n t[i] = sc.nextInt();\n }",
"t[i] = sc.nextInt()",
"t[i]",
"t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }",
"int i",
"t",
"{\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }",
"{\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }",
"if(bsearch(i, 0, n-1)){\n ans++;\n }",
"bsearch(i, 0, n-1)",
"bsearch",
"i",
"0",
"n-1",
"n",
"1",
"{\n ans++;\n }",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] arg",
"arg",
"public static boolean bsearch(int k, int i, int j){\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }",
"bsearch",
"{\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }",
"if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }",
"s[(i+j)/2]==k",
"s[(i+j)/2]",
"s",
"(i+j)/2",
"(i+j)",
"i",
"j",
"2",
"k",
"{\n return true;\n }",
"return true;",
"true",
"if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }",
"i>j",
"i",
"j",
"{\n return false;\n }",
"return false;",
"false",
"if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }",
"s[(i+j)/2]<k",
"s[(i+j)/2]",
"s",
"(i+j)/2",
"(i+j)",
"i",
"j",
"2",
"k",
"{\n return bsearch(k, (i+j)/2+1, j);\n }",
"return bsearch(k, (i+j)/2+1, j);",
"bsearch(k, (i+j)/2+1, j)",
"bsearch",
"k",
"(i+j)/2+1",
"(i+j)/2",
"(i+j)",
"i",
"j",
"2",
"1",
"j",
"if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }",
"s[(i+j)/2]>k",
"s[(i+j)/2]",
"s",
"(i+j)/2",
"(i+j)",
"i",
"j",
"2",
"k",
"{\n return bsearch(k, i, (i+j)/2-1);\n }",
"return bsearch(k, i, (i+j)/2-1);",
"bsearch(k, i, (i+j)/2-1)",
"bsearch",
"k",
"i",
"(i+j)/2-1",
"(i+j)/2",
"(i+j)",
"i",
"j",
"2",
"1",
"return false;",
"false",
"int k",
"k",
"int i",
"i",
"int j",
"j",
"public class Main {\n static int n;\n static int s[];\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }\n \n public static boolean bsearch(int k, int i, int j){\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }\n}",
"public class Main {\n static int n;\n static int s[];\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n s = new int[n];\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt(); \n int t[] = new int[q];\n for(int i=0;i<q;i++){\n t[i] = sc.nextInt();\n }\n int ans = 0;\n for(int i: t){\n if(bsearch(i, 0, n-1)){\n ans++;\n }\n }\n System.out.println(ans);\n sc.close();\n }\n \n public static boolean bsearch(int k, int i, int j){\n \n if(s[(i+j)/2]==k){\n return true;\n }else if(i>j){\n return false;\n }else if(s[(i+j)/2]<k){\n return bsearch(k, (i+j)/2+1, j);\n }else if(s[(i+j)/2]>k){\n return bsearch(k, i, (i+j)/2-1);\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int n;
static int s[];
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
s = new int[n];
for(int i=0;i<n;i++){
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int t[] = new int[q];
for(int i=0;i<q;i++){
t[i] = sc.nextInt();
}
int ans = 0;
for(int i: t){
if(bsearch(i, 0, n-1)){
ans++;
}
}
System.out.println(ans);
sc.close();
}
public static boolean bsearch(int k, int i, int j){
if(s[(i+j)/2]==k){
return true;
}else if(i>j){
return false;
}else if(s[(i+j)/2]<k){
return bsearch(k, (i+j)/2+1, j);
}else if(s[(i+j)/2]>k){
return bsearch(k, i, (i+j)/2-1);
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
29,
17,
23,
13,
23,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
295,
26
],
[
295,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
37,
39
],
[
29,
40
],
[
40,
41
],
[
40,
42
],
[
29,
43
],
[
43,
44
],
[
43,
45
],
[
29,
46
],
[
46,
47
],
[
46,
48
],
[
29,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
29,
54
],
[
54,
55
],
[
55,
56
],
[
27,
57
],
[
57,
58
],
[
295,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
59,
63
],
[
63,
64
],
[
59,
65
],
[
65,
66
],
[
59,
67
],
[
67,
68
],
[
59,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
71,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
92,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
101,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
71,
117
],
[
117,
118
],
[
69,
119
],
[
119,
120
],
[
69,
121
],
[
121,
122
],
[
59,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
125,
131
],
[
131,
132
],
[
131,
133
],
[
125,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
135,
146
],
[
147,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
125,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
125,
160
],
[
160,
161
],
[
160,
162
],
[
125,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
164,
172
],
[
172,
173
],
[
173,
174
],
[
164,
175
],
[
176,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
181,
182
],
[
182,
183
],
[
125,
184
],
[
184,
185
],
[
184,
186
],
[
125,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
192,
193
],
[
192,
194
],
[
187,
195
],
[
195,
196
],
[
196,
197
],
[
187,
198
],
[
199,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
201,
204
],
[
204,
205
],
[
204,
206
],
[
200,
207
],
[
207,
208
],
[
208,
209
],
[
125,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
123,
214
],
[
214,
215
],
[
123,
216
],
[
216,
217
],
[
59,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
221,
226
],
[
226,
227
],
[
227,
228
],
[
226,
229
],
[
218,
230
],
[
230,
231
],
[
295,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
232,
236
],
[
236,
237
],
[
232,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
244,
246
],
[
238,
247
],
[
247,
248
],
[
232,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
253,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
252,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
266,
267
],
[
262,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
251,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
232,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
280,
283
],
[
283,
284
],
[
232,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
289,
292
],
[
292,
293
],
[
0,
294
],
[
294,
295
],
[
294,
296
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\nimport java.awt.Point;\n\npublic class Main {\n // static int INF = (1 << 30) - 1;\n // static long L_INF = (1L << 62) - 1;\n // static long MOD = (long) 1e9 + 7;\n\n static class Solver {\n int n;\n int[] S;\n int q;\n int[] T;\n\n boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }\n\n // write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n }\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}\n",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.*;",
"util.*",
"java",
"import java.awt.Point;",
"Point",
"java.awt",
"public class Main {\n // static int INF = (1 << 30) - 1;\n // static long L_INF = (1L << 62) - 1;\n // static long MOD = (long) 1e9 + 7;\n\n static class Solver {\n int n;\n int[] S;\n int q;\n int[] T;\n\n boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }\n\n // write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n }\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"Solver solver = new Solver();",
"solver",
"new Solver()",
"solver.solve(in, out)",
"solver.solve",
"solver",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Solver {\n int n;\n int[] S;\n int q;\n int[] T;\n\n boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }\n\n // write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n }",
"Solver",
"int n;",
"n",
"int[] S;",
"S",
"int q;",
"q",
"int[] T;",
"T",
"boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = arr.length;",
"right",
"arr.length",
"arr",
"arr.length",
"while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }",
"arr[mid] == v",
"arr[mid]",
"arr",
"mid",
"v",
"{\n return true;\n }",
"return true;",
"true",
"if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }",
"arr[mid] < v",
"arr[mid]",
"arr",
"mid",
"v",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"return false;",
"false",
"int[] arr",
"arr",
"int v",
"v",
"// write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }",
"solve",
"{\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }",
"n = in.nextInt()",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = in.nextInt();\n }",
"{\n S[i] = in.nextInt();\n }",
"S[i] = in.nextInt()",
"S[i]",
"S",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"q = in.nextInt()",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"T = new int[q]",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = in.nextInt();\n }",
"{\n T[i] = in.nextInt();\n }",
"T[i] = in.nextInt()",
"T[i]",
"T",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }",
"{\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }",
"if (binarySearch(S, T[i])) {\n ans++;\n }",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"{\n ans++;\n }",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"InputReader in",
"in",
"PrintWriter out",
"out",
"void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }",
"debug",
"{\n System.err.println(Arrays.deepToString(os));\n }",
"System.err.println(Arrays.deepToString(os))",
"System.err.println",
"System.err",
"System",
"System.err",
"Arrays.deepToString(os)",
"Arrays.deepToString",
"Arrays",
"os",
"Object... os",
"os",
"static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }",
"InputReader",
"BufferedReader reader;",
"reader",
"StringTokenizer tokenizer;",
"tokenizer",
"InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(stream), 32768)",
"reader",
"new BufferedReader(new InputStreamReader(stream), 32768)",
"tokenizer = null",
"tokenizer",
"null",
"InputStream stream",
"stream",
"String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public class Main {\n // static int INF = (1 << 30) - 1;\n // static long L_INF = (1L << 62) - 1;\n // static long MOD = (long) 1e9 + 7;\n\n static class Solver {\n int n;\n int[] S;\n int q;\n int[] T;\n\n boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }\n\n // write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n }\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"public class Main {\n // static int INF = (1 << 30) - 1;\n // static long L_INF = (1L << 62) - 1;\n // static long MOD = (long) 1e9 + 7;\n\n static class Solver {\n int n;\n int[] S;\n int q;\n int[] T;\n\n boolean binarySearch(int[] arr, int v) {\n int left = 0;\n int right = arr.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (arr[mid] == v) {\n return true;\n } else if (arr[mid] < v) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return false;\n }\n\n // write your code\n void solve(InputReader in, PrintWriter out) {\n n = in.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = in.nextInt();\n }\n q = in.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = in.nextInt();\n }\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, T[i])) {\n ans++;\n }\n }\n out.println(ans);\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n }\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }\n\n static class InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.awt.Point;
public class Main {
// static int INF = (1 << 30) - 1;
// static long L_INF = (1L << 62) - 1;
// static long MOD = (long) 1e9 + 7;
static class Solver {
int n;
int[] S;
int q;
int[] T;
boolean binarySearch(int[] arr, int v) {
int left = 0;
int right = arr.length;
while (left < right) {
int mid = (left + right) / 2;
if (arr[mid] == v) {
return true;
} else if (arr[mid] < v) {
left = mid + 1;
} else {
right = mid;
}
}
return false;
}
// write your code
void solve(InputReader in, PrintWriter out) {
n = in.nextInt();
S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = in.nextInt();
}
q = in.nextInt();
T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = in.nextInt();
}
int ans = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(S, T[i])) {
ans++;
}
}
out.println(ans);
}
void debug(Object... os) {
System.err.println(Arrays.deepToString(os));
}
}
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(in, out);
out.close();
}
static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
2,
13,
17,
13,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
4,
18,
13,
17,
2,
18,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
148,
5
],
[
148,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
10,
12
],
[
9,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
8,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
22,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
29,
32
],
[
29,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
8,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
37,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
44,
47
],
[
44,
48
],
[
48,
49
],
[
48,
50
],
[
44,
51
],
[
8,
52
],
[
52,
53
],
[
6,
54
],
[
54,
55
],
[
6,
56
],
[
56,
57
],
[
6,
58
],
[
58,
59
],
[
6,
60
],
[
60,
61
],
[
148,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
68,
70
],
[
64,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
64,
76
],
[
76,
77
],
[
76,
78
],
[
64,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
64,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
64,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
122,
123
],
[
123,
124
],
[
119,
125
],
[
119,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
118,
131
],
[
131,
132
],
[
64,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
148,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
139,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"import java.util.Scanner;\n\n// ALDS1_4_B\npublic class Main {\n\tboolean binarySearch(int[] array, int target, int min, int max) {\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}\n\t\n\tvoid run() {\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tboolean binarySearch(int[] array, int target, int min, int max) {\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}\n\t\n\tvoid run() {\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main",
"boolean binarySearch(int[] array, int target, int min, int max) {\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}",
"binarySearch",
"{\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}",
"if (max < min) return false;",
"max < min",
"max",
"min",
"return false;",
"false",
"int mid = (max + min) / 2;",
"mid",
"(max + min) / 2",
"(max + min)",
"max",
"min",
"2",
"if (array[mid] > target) return binarySearch(array, target, min, mid - 1);",
"array[mid] > target",
"array[mid]",
"array",
"mid",
"target",
"return binarySearch(array, target, min, mid - 1);",
"binarySearch(array, target, min, mid - 1)",
"binarySearch",
"array",
"target",
"min",
"mid - 1",
"mid",
"1",
"if (array[mid] < target) return binarySearch(array, target, mid + 1, max);",
"array[mid] < target",
"array[mid]",
"array",
"mid",
"target",
"return binarySearch(array, target, mid + 1, max);",
"binarySearch(array, target, mid + 1, max)",
"binarySearch",
"array",
"target",
"mid + 1",
"mid",
"1",
"max",
"return true;",
"true",
"int[] array",
"array",
"int target",
"target",
"int min",
"min",
"int max",
"max",
"void run() {\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"run",
"{\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}",
"{\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}",
"if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;",
"binarySearch(S, sc.nextInt(), 0, S.length - 1)",
"binarySearch",
"S",
"sc.nextInt()",
"sc.nextInt",
"sc",
"0",
"S.length - 1",
"S.length",
"S",
"S.length",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"public static void main(String[] args) {\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"public class Main {\n\tboolean binarySearch(int[] array, int target, int min, int max) {\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}\n\t\n\tvoid run() {\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"public class Main {\n\tboolean binarySearch(int[] array, int target, int min, int max) {\n\t\tif (max < min) return false;\n\t\tint mid = (max + min) / 2;\n\t\tif (array[mid] > target) return binarySearch(array, target, min, mid - 1);\n\t\tif (array[mid] < target) return binarySearch(array, target, mid + 1, max);\n\t\treturn true;\n\t}\n\t\n\tvoid run() {\n\t\tint count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main"
] | import java.util.Scanner;
// ALDS1_4_B
public class Main {
boolean binarySearch(int[] array, int target, int min, int max) {
if (max < min) return false;
int mid = (max + min) / 2;
if (array[mid] > target) return binarySearch(array, target, min, mid - 1);
if (array[mid] < target) return binarySearch(array, target, mid + 1, max);
return true;
}
void run() {
int count = 0;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
for (int i = 0; i < q; i++) {
if (binarySearch(S, sc.nextInt(), 0, S.length - 1)) count++;
}
System.out.println(count);
}
public static void main(String[] args) {
new Main().run();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
38,
5,
13,
30,
4,
18,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
4,
13,
13,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
202,
5
],
[
202,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
30,
34
],
[
29,
35
],
[
35,
36
],
[
36,
37
],
[
29,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
38,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
8,
62
],
[
62,
63
],
[
6,
64
],
[
64,
65
],
[
6,
66
],
[
66,
67
],
[
6,
68
],
[
68,
69
],
[
202,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
76,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
90,
91
],
[
83,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
94,
99
],
[
83,
100
],
[
100,
101
],
[
100,
102
],
[
83,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
123,
125
],
[
83,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
132,
133
],
[
83,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
136,
141
],
[
83,
142
],
[
142,
143
],
[
142,
144
],
[
83,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
146,
154
],
[
154,
155
],
[
155,
156
],
[
146,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
165,
166
],
[
165,
167
],
[
83,
168
],
[
168,
169
],
[
168,
170
],
[
83,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
176,
177
],
[
176,
178
],
[
171,
179
],
[
179,
180
],
[
180,
181
],
[
171,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
184,
187
],
[
184,
188
],
[
188,
189
],
[
188,
190
],
[
183,
191
],
[
191,
192
],
[
83,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
193,
198
],
[
70,
199
],
[
199,
200
],
[
0,
201
],
[
201,
202
],
[
201,
203
]
] | [
"import java.io.*;\n\npublic class Main{\n\n static boolean binarySearch(int[] s, int n, int key){\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }\n public static void main(String[] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\n static boolean binarySearch(int[] s, int n, int key){\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }\n public static void main(String[] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }\n}",
"Main",
"static boolean binarySearch(int[] s, int n, int key){\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n - 1;",
"right",
"n - 1",
"n",
"1",
"while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }",
"left <= right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }",
"s[mid] == key",
"s[mid]",
"s",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }",
"s[mid] < key",
"s[mid]",
"s",
"mid",
"key",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if(key < s[mid]){\n right = mid - 1;\n }",
"key < s[mid]",
"key",
"s[mid]",
"s",
"mid",
"{\n right = mid - 1;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"return false;",
"false",
"int[] s",
"s",
"int n",
"n",
"int key",
"key",
"public static void main(String[] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }",
"catch(IOException e){\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] str1 = br.readLine().split(\" \");",
"str1",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"s[i] = Integer.parseInt(str1[i]);",
"s[i] = Integer.parseInt(str1[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(str1[i])",
"Integer.parseInt",
"Integer",
"str1[i]",
"str1",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] str2 = br.readLine().split(\" \");",
"str2",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"t[i] = Integer.parseInt(str2[i]);",
"t[i] = Integer.parseInt(str2[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(str2[i])",
"Integer.parseInt",
"Integer",
"str2[i]",
"str2",
"i",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"if(binarySearch(s, n, t[i]))\n count++;",
"if(binarySearch(s, n, t[i]))\n count++;",
"binarySearch(s, n, t[i])",
"binarySearch",
"s",
"n",
"t[i]",
"t",
"i",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n\n static boolean binarySearch(int[] s, int n, int key){\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }\n public static void main(String[] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }\n}",
"public class Main{\n\n static boolean binarySearch(int[] s, int n, int key){\n int left = 0;\n int right = n - 1;\n while(left <= right){\n int mid = (left + right) / 2;\n if(s[mid] == key){\n return true;\n }else if(s[mid] < key){\n left = mid + 1;\n }else if(key < s[mid]){\n right = mid - 1;\n }\n }\n\n return false;\n }\n public static void main(String[] args){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n try{\n int n = Integer.parseInt(br.readLine());\n String[] str1 = br.readLine().split(\" \");\n int[] s = new int[n];\n for(int i = 0; i < n; i++)\n s[i] = Integer.parseInt(str1[i]);\n\n int q = Integer.parseInt(br.readLine());\n String[] str2 = br.readLine().split(\" \");\n int[] t = new int[q];\n for(int i = 0; i < q; i++)\n t[i] = Integer.parseInt(str2[i]);\n\n int count = 0;\n for(int i = 0; i < q; i++)\n if(binarySearch(s, n, t[i]))\n count++;\n\n System.out.println(count); \n }catch(IOException e){\n e.printStackTrace();\n }\n }\n}",
"Main"
] | import java.io.*;
public class Main{
static boolean binarySearch(int[] s, int n, int key){
int left = 0;
int right = n - 1;
while(left <= right){
int mid = (left + right) / 2;
if(s[mid] == key){
return true;
}else if(s[mid] < key){
left = mid + 1;
}else if(key < s[mid]){
right = mid - 1;
}
}
return false;
}
public static void main(String[] args){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
int n = Integer.parseInt(br.readLine());
String[] str1 = br.readLine().split(" ");
int[] s = new int[n];
for(int i = 0; i < n; i++)
s[i] = Integer.parseInt(str1[i]);
int q = Integer.parseInt(br.readLine());
String[] str2 = br.readLine().split(" ");
int[] t = new int[q];
for(int i = 0; i < q; i++)
t[i] = Integer.parseInt(str2[i]);
int count = 0;
for(int i = 0; i < q; i++)
if(binarySearch(s, n, t[i]))
count++;
System.out.println(count);
}catch(IOException e){
e.printStackTrace();
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
4,
18,
13,
18,
13,
13,
40,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
13,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
29,
13,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
29,
40,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
177,
8
],
[
177,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
25,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
11,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
11,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
11,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
91,
101
],
[
101,
102
],
[
90,
103
],
[
103,
104
],
[
11,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
9,
111
],
[
111,
112
],
[
177,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
121,
123
],
[
115,
124
],
[
124,
125
],
[
124,
126
],
[
115,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
115,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
139,
145
],
[
145,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
147,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
147,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
138,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
115,
169
],
[
169,
170
],
[
170,
171
],
[
113,
172
],
[
172,
173
],
[
113,
174
],
[
174,
175
],
[
0,
176
],
[
176,
177
],
[
176,
178
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main\n{\n\tpublic static void main(String[] args)throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tpublic static int binarySearch(int[] c, int key)\n\t{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main\n{\n\tpublic static void main(String[] args)throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tpublic static int binarySearch(int[] c, int key)\n\t{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n}",
"Main",
"public static void main(String[] args)throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] g = br.readLine().split(\" \");",
"g",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int [] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i< n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}",
"{\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}",
"ar[i] = Integer.parseInt(g[i])",
"ar[i]",
"ar",
"i",
"Integer.parseInt(g[i])",
"Integer.parseInt",
"Integer",
"g[i]",
"g",
"i",
"int m = Integer.parseInt(br.readLine());",
"m",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int ans = 0;",
"ans",
"0",
"g = br.readLine().split(\" \")",
"g",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i <m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}",
"{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}",
"if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;",
"binarySearch(ar,Integer.parseInt(g[i])) != -1",
"binarySearch(ar,Integer.parseInt(g[i]))",
"binarySearch",
"ar",
"Integer.parseInt(g[i])",
"Integer.parseInt",
"Integer",
"g[i]",
"g",
"i",
"-1",
"1",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static int binarySearch(int[] c, int key)\n\t{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}",
"int len = c.length;",
"len",
"c.length",
"c",
"c.length",
"int left = 0",
"left",
"0",
"right = len;",
"right",
"len",
"int mid = (right + left) / 2 ;",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"while(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}",
"if(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }",
"c[mid] == key",
"c[mid]",
"c",
"mid",
"key",
"return mid;",
"mid",
"if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }",
"c[mid] < key",
"c[mid]",
"c",
"mid",
"key",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"{ right = mid; }",
"right = mid",
"right",
"mid",
"mid = (right + left) / 2",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"return -1;",
"-1",
"1",
"int[] c",
"c",
"int key",
"key",
"public class Main\n{\n\tpublic static void main(String[] args)throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tpublic static int binarySearch(int[] c, int key)\n\t{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n}",
"public class Main\n{\n\tpublic static void main(String[] args)throws Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] g = br.readLine().split(\" \");\n\t\tint [] ar = new int[n];\n\t\tfor( int i = 0 ; i< n ; i++){\n\t\t\tar[i] = Integer.parseInt(g[i]);\n\t\t}\n\t\tint m = Integer.parseInt(br.readLine());\n\t\tint ans = 0;\n\t\tg = br.readLine().split(\" \");\n\t\tfor(int i = 0 ; i <m; i++)\n\t\t{\n\t\t\tif(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;\t\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tpublic static int binarySearch(int[] c, int key)\n\t{\n\t\tint len = c.length;\n\t\tint left = 0 , right = len;\n\t\tint mid = (right + left) / 2 ;\n\t\twhile(left < right){\n\t\t\tif(c[mid] == key) return mid;\n\t\t\telse if(c[mid] < key) left = mid+1;\n\t\t\telse { right = mid; }\n\t\t\tmid = (right + left) / 2 ;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main
{
public static void main(String[] args)throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] g = br.readLine().split(" ");
int [] ar = new int[n];
for( int i = 0 ; i< n ; i++){
ar[i] = Integer.parseInt(g[i]);
}
int m = Integer.parseInt(br.readLine());
int ans = 0;
g = br.readLine().split(" ");
for(int i = 0 ; i <m; i++)
{
if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;
}
System.out.println(ans);
}
public static int binarySearch(int[] c, int key)
{
int len = c.length;
int left = 0 , right = len;
int mid = (right + left) / 2 ;
while(left < right){
if(c[mid] == key) return mid;
else if(c[mid] < key) left = mid+1;
else { right = mid; }
mid = (right + left) / 2 ;
}
return -1;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
39,
40,
17,
2,
13,
17,
13,
42,
17,
30,
14,
2,
18,
13,
18,
13,
17,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
18,
13,
17,
18,
13,
13,
30,
14,
2,
2,
18,
13,
17,
18,
13,
17,
17,
30,
3,
0,
18,
13,
17,
18,
13,
17,
0,
18,
13,
17,
2,
2,
18,
13,
17,
18,
13,
17,
17,
30,
14,
2,
2,
18,
13,
17,
18,
13,
17,
17,
30,
3,
0,
18,
13,
17,
18,
13,
17,
0,
18,
13,
17,
2,
2,
18,
13,
17,
18,
13,
17,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
199,
5
],
[
199,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
87,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
100,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
100,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
125,
135
],
[
135,
136
],
[
124,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
124,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
153,
155
],
[
148,
156
],
[
114,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
164,
166
],
[
159,
167
],
[
158,
168
],
[
168,
169
],
[
157,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
157,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
186,
187
],
[
186,
188
],
[
181,
189
],
[
8,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
190,
195
],
[
6,
196
],
[
196,
197
],
[
0,
198
],
[
198,
199
],
[
198,
200
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] args){\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }",
"main",
"{\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }",
"int i;",
"i",
"int count=0;",
"count",
"0",
"Scanner sc= new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n= sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int intarr[]=new int[n];",
"intarr",
"new int[n]",
"n",
"for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n intarr[i]=sc.nextInt(); \n }",
"{\n intarr[i]=sc.nextInt(); \n }",
"intarr[i]=sc.nextInt()",
"intarr[i]",
"intarr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int qlong=sc.nextInt();",
"qlong",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int qintarr[]=new int[qlong];",
"qintarr",
"new int[qlong]",
"qlong",
"for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<qlong",
"i",
"qlong",
"i++",
"i++",
"i",
"{\n qintarr[i]=sc.nextInt();\n }",
"{\n qintarr[i]=sc.nextInt();\n }",
"qintarr[i]=sc.nextInt()",
"qintarr[i]",
"qintarr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }",
"i=0;",
"i=0",
"i",
"0",
"i<qlong",
"i",
"qlong",
"i++",
"i++",
"i",
"{\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }",
"{\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }",
"int pivot[]={-1,n/2,n};",
"pivot",
"{-1,n/2,n}",
"-1",
"1",
"n/2",
"n",
"2",
"n",
"while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n }",
"true",
"{\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n }",
"if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }",
"intarr[pivot[1]]==qintarr[i]",
"intarr[pivot[1]]",
"intarr",
"pivot[1]",
"pivot",
"1",
"qintarr[i]",
"qintarr",
"i",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }",
"intarr[pivot[1]]>qintarr[i]",
"intarr[pivot[1]]",
"intarr",
"pivot[1]",
"pivot",
"1",
"qintarr[i]",
"qintarr",
"i",
"{\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }",
"if(pivot[1]-pivot[0]<=1){\n break;\n }",
"pivot[1]-pivot[0]<=1",
"pivot[1]-pivot[0]",
"pivot[1]",
"pivot",
"1",
"pivot[0]",
"pivot",
"0",
"1",
"{\n break;\n }",
"break;",
"pivot[2]=pivot[1]",
"pivot[2]",
"pivot",
"2",
"pivot[1]",
"pivot",
"1",
"pivot[1]=(pivot[0]+pivot[1])/2",
"pivot[1]",
"pivot",
"1",
"(pivot[0]+pivot[1])/2",
"(pivot[0]+pivot[1])",
"pivot[0]",
"pivot",
"0",
"pivot[1]",
"pivot",
"1",
"2",
"{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }",
"if(pivot[2]-pivot[1]<=1){\n break;\n }",
"pivot[2]-pivot[1]<=1",
"pivot[2]-pivot[1]",
"pivot[2]",
"pivot",
"2",
"pivot[1]",
"pivot",
"1",
"1",
"{\n break;\n }",
"break;",
"pivot[0]=pivot[1]",
"pivot[0]",
"pivot",
"0",
"pivot[1]",
"pivot",
"1",
"pivot[1]=(pivot[1]+pivot[2])/2",
"pivot[1]",
"pivot",
"1",
"(pivot[1]+pivot[2])/2",
"(pivot[1]+pivot[2])",
"pivot[1]",
"pivot",
"1",
"pivot[2]",
"pivot",
"2",
"2",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }\n}",
"public class Main{\n public static void main(String[] args){\n int i;\n int count=0;\n Scanner sc= new Scanner(System.in);\n \n int n= sc.nextInt();\n int intarr[]=new int[n];\n for(i=0;i<n;i++){\n intarr[i]=sc.nextInt(); \n }\n int qlong=sc.nextInt();\n int qintarr[]=new int[qlong];\n for(i=0;i<qlong;i++){\n qintarr[i]=sc.nextInt();\n }\n \n for(i=0;i<qlong;i++){\n int pivot[]={-1,n/2,n};\n while(true){\n if(intarr[pivot[1]]==qintarr[i]){\n count++;\n break;\n }else if(intarr[pivot[1]]>qintarr[i]){\n if(pivot[1]-pivot[0]<=1){\n break;\n }\n pivot[2]=pivot[1];\n pivot[1]=(pivot[0]+pivot[1])/2;\n }else{\n if(pivot[2]-pivot[1]<=1){\n break;\n }\n pivot[0]=pivot[1];\n pivot[1]=(pivot[1]+pivot[2])/2;\n }\n } \n }\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
int i;
int count=0;
Scanner sc= new Scanner(System.in);
int n= sc.nextInt();
int intarr[]=new int[n];
for(i=0;i<n;i++){
intarr[i]=sc.nextInt();
}
int qlong=sc.nextInt();
int qintarr[]=new int[qlong];
for(i=0;i<qlong;i++){
qintarr[i]=sc.nextInt();
}
for(i=0;i<qlong;i++){
int pivot[]={-1,n/2,n};
while(true){
if(intarr[pivot[1]]==qintarr[i]){
count++;
break;
}else if(intarr[pivot[1]]>qintarr[i]){
if(pivot[1]-pivot[0]<=1){
break;
}
pivot[2]=pivot[1];
pivot[1]=(pivot[0]+pivot[1])/2;
}else{
if(pivot[2]-pivot[1]<=1){
break;
}
pivot[0]=pivot[1];
pivot[1]=(pivot[1]+pivot[2])/2;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
18,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
111,
8
],
[
111,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
11,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
9,
108
],
[
108,
109
],
[
0,
110
],
[
110,
111
],
[
110,
112
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] t = new int[n];",
"t",
"new int[n]",
"n",
"for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = sc.nextInt();\n }",
"{\n t[i] = sc.nextInt();\n }",
"t[i] = sc.nextInt()",
"t[i]",
"t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int c = 0;",
"c",
"0",
"for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }",
"{\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }",
"if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }",
"Arrays.binarySearch(s, t[i]) >= 0",
"Arrays.binarySearch(s, t[i])",
"Arrays.binarySearch",
"Arrays",
"s",
"t[i]",
"t",
"i",
"0",
"{\n c++;\n }",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] t = new int[n];\n for (int i = 0; i < q; i++) {\n t[i] = sc.nextInt();\n }\n int c = 0;\n for (int i = 0; i < q; i++) {\n if (Arrays.binarySearch(s, t[i]) >= 0) {\n c++;\n }\n }\n System.out.println(c);\n }\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] t = new int[n];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
int c = 0;
for (int i = 0; i < q; i++) {
if (Arrays.binarySearch(s, t[i]) >= 0) {
c++;
}
}
System.out.println(c);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
41,
13,
20,
13,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
14,
2,
18,
13,
13,
13,
0,
18,
13,
13,
40,
17,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
41,
13,
4,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
41,
13,
17,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
18,
13,
13,
14,
2,
2,
2,
13,
13,
2,
17,
13,
2,
18,
13,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
40,
17,
41,
13,
18,
13,
13,
42,
2,
4,
18,
13,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
4,
13,
13,
13,
13,
0,
13,
13,
0,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
17,
29,
17,
12,
13,
30,
14,
2,
4,
13,
17,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
37,
20,
41,
13,
17,
42,
4,
13,
13,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
469,
14
],
[
469,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
469,
20
],
[
20,
21
],
[
20,
22
],
[
469,
24
],
[
24,
25
],
[
24,
26
],
[
469,
27
],
[
27,
28
],
[
27,
29
],
[
469,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
32,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
32,
40
],
[
40,
41
],
[
40,
42
],
[
32,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
32,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
60,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
32,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
32,
94
],
[
94,
95
],
[
94,
96
],
[
32,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
98,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
32,
116
],
[
116,
117
],
[
116,
118
],
[
32,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
32,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
123,
134
],
[
135,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
138,
142
],
[
142,
143
],
[
142,
144
],
[
135,
145
],
[
145,
146
],
[
147,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
151,
153
],
[
147,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
158,
160
],
[
145,
161
],
[
161,
162
],
[
32,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
30,
169
],
[
169,
170
],
[
469,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
174,
180
],
[
180,
181
],
[
174,
182
],
[
182,
183
],
[
171,
184
],
[
184,
185
],
[
171,
186
],
[
186,
187
],
[
171,
188
],
[
188,
189
],
[
469,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
192,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
192,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
204,
207
],
[
207,
208
],
[
207,
209
],
[
203,
210
],
[
202,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
214,
218
],
[
211,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
220,
223
],
[
220,
224
],
[
219,
225
],
[
225,
226
],
[
225,
227
],
[
219,
228
],
[
228,
229
],
[
228,
230
],
[
192,
231
],
[
231,
232
],
[
190,
233
],
[
233,
234
],
[
190,
235
],
[
235,
236
],
[
469,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
240,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
246,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
250,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
261,
262
],
[
260,
263
],
[
246,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
264,
268
],
[
268,
269
],
[
239,
270
],
[
270,
271
],
[
469,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
276,
279
],
[
275,
280
],
[
280,
281
],
[
281,
282
],
[
281,
283
],
[
283,
284
],
[
274,
285
],
[
285,
286
],
[
286,
287
],
[
469,
288
],
[
288,
289
],
[
288,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
292,
296
],
[
296,
297
],
[
296,
298
],
[
288,
299
],
[
299,
300
],
[
469,
301
],
[
301,
302
],
[
301,
303
],
[
303,
304
],
[
304,
305
],
[
305,
306
],
[
306,
307
],
[
305,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
311,
313
],
[
304,
314
],
[
314,
315
],
[
469,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
318,
321
],
[
321,
322
],
[
322,
323
],
[
469,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
327,
331
],
[
331,
332
],
[
326,
333
],
[
333,
334
],
[
333,
335
],
[
326,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
326,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
345,
348
],
[
344,
349
],
[
349,
350
],
[
349,
351
],
[
351,
352
],
[
326,
353
],
[
353,
354
],
[
354,
355
],
[
355,
356
],
[
469,
357
],
[
357,
358
],
[
357,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
361,
364
],
[
364,
365
],
[
469,
366
],
[
366,
367
],
[
366,
368
],
[
368,
369
],
[
369,
370
],
[
369,
371
],
[
368,
373
],
[
373,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
373,
378
],
[
378,
379
],
[
378,
380
],
[
373,
381
],
[
381,
382
],
[
382,
383
],
[
373,
384
],
[
384,
385
],
[
385,
386
],
[
386,
387
],
[
386,
388
],
[
385,
389
],
[
389,
390
],
[
368,
391
],
[
391,
392
],
[
366,
393
],
[
393,
394
],
[
469,
395
],
[
395,
396
],
[
395,
397
],
[
397,
398
],
[
398,
399
],
[
399,
400
],
[
400,
401
],
[
398,
402
],
[
402,
403
],
[
397,
404
],
[
404,
405
],
[
404,
406
],
[
397,
407
],
[
407,
408
],
[
407,
409
],
[
409,
410
],
[
397,
411
],
[
411,
412
],
[
412,
413
],
[
412,
414
],
[
411,
415
],
[
415,
416
],
[
416,
417
],
[
416,
418
],
[
415,
419
],
[
419,
420
],
[
419,
421
],
[
421,
422
],
[
397,
423
],
[
423,
424
],
[
424,
425
],
[
425,
426
],
[
425,
427
],
[
424,
428
],
[
428,
429
],
[
428,
430
],
[
423,
431
],
[
431,
432
],
[
397,
433
],
[
433,
434
],
[
433,
435
],
[
397,
436
],
[
436,
437
],
[
437,
438
],
[
437,
439
],
[
436,
440
],
[
440,
441
],
[
441,
442
],
[
442,
443
],
[
443,
444
],
[
443,
445
],
[
442,
446
],
[
446,
447
],
[
446,
448
],
[
441,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
449,
453
],
[
453,
454
],
[
453,
455
],
[
455,
456
],
[
455,
457
],
[
440,
458
],
[
458,
459
],
[
458,
460
],
[
460,
461
],
[
397,
462
],
[
462,
463
],
[
463,
464
],
[
463,
465
],
[
465,
466
],
[
463,
467
],
[
0,
468
],
[
468,
469
],
[
468,
470
]
] | [
"import java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\npublic class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tstatic boolean isOK(int index,int key,int[]a){\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}\n\tstatic int binary_search(int key,int[] a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n}\n\n",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"public class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tstatic boolean isOK(int index,int key,int[]a){\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}\n\tstatic int binary_search(int key,int[] a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n}",
"Main",
"//FastScanner\n\tstatic InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"static byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"static int length = 0",
"length",
"0",
"p = 0;",
"p",
"0",
"public static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n=nextInt();",
"n",
"nextInt()",
"nextInt",
"int S[]=new int[n];",
"S",
"new int[n]",
"n",
"int k=-1;",
"k",
"-1",
"1",
"for(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}",
"{\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}",
"S[i]=nextInt()",
"S[i]",
"S",
"i",
"nextInt()",
"nextInt",
"if(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];",
"S[i]==k",
"S[i]",
"S",
"i",
"k",
"S[i]=-1",
"S[i]",
"S",
"i",
"-1",
"1",
"if(k!=S[i])\n\t\t\t\t\tk=S[i];",
"k!=S[i]",
"k",
"S[i]",
"S",
"i",
"k=S[i]",
"k",
"S[i]",
"S",
"i",
"int q=nextInt();",
"q",
"nextInt()",
"nextInt",
"int T[]=new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++)T[i]=nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"T[i]=nextInt();",
"T[i]=nextInt()",
"T[i]",
"T",
"i",
"nextInt()",
"nextInt",
"int ans=0;",
"ans",
"0",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"for(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}",
"{\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}",
"int a=Arrays.binarySearch(T,S[i]);",
"a",
"Arrays.binarySearch(T,S[i])",
"Arrays.binarySearch",
"Arrays",
"T",
"S[i]",
"S",
"i",
"if(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;",
"a<q&&0<=a&&T[a]==S[i]",
"a<q&&0<=a&&T[a]==S[i]",
"a<q",
"a",
"q",
"0<=a",
"0",
"a",
"T[a]==S[i]",
"T[a]",
"T",
"a",
"S[i]",
"S",
"i",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static boolean isOK(int index,int key,int[]a){\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}",
"isOK",
"{\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}",
"if (key>=a[index]) return true;\n\t else return false;",
"key>=a[index]",
"key",
"a[index]",
"a",
"index",
"return true;",
"true",
"return false;",
"false",
"int index",
"index",
"int key",
"key",
"int[]a",
"a",
"static int binary_search(int key,int[] a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}",
"binary_search",
"{\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}",
"int ng = -1;",
"ng",
"-1",
"1",
"int ok = (int)a.length;",
"ok",
"(int)a.length",
"a",
"a.length",
"while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }",
"Math.abs(ok - ng) > 1",
"Math.abs(ok - ng)",
"Math.abs",
"Math",
"ok - ng",
"ok",
"ng",
"1",
"{\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }",
"int mid = (ok + ng) / 2;",
"mid",
"(ok + ng) / 2",
"(ok + ng)",
"ok",
"ng",
"2",
"if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;",
"isOK(mid,key,a)",
"isOK",
"mid",
"key",
"a",
"ok = mid",
"ok",
"mid",
"ng = mid",
"ng",
"mid",
"return ok;",
"ok",
"int key",
"key",
"int[] a",
"a",
"public static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}",
"if (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}",
"p < length",
"p",
"length",
"return true;",
"true",
"{\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}",
"p = 0",
"p",
"0",
"try {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}",
"catch (Exception e) {e.printStackTrace();}",
"Exception e",
"{e.printStackTrace();}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{length = in.read(buffer);}",
"length = in.read(buffer)",
"length",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (length == 0) return false;",
"length == 0",
"length",
"0",
"return false;",
"false",
"return true;",
"true",
"public static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}",
"readByte",
"{\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}",
"if (hasNextByte() == true) return buffer[p++];",
"hasNextByte() == true",
"hasNextByte()",
"hasNextByte",
"true",
"return buffer[p++];",
"buffer[p++]",
"buffer",
"p++",
"p",
"return -1;",
"-1",
"1",
"public static boolean isPrintable (int n) {return 33<=n&&n<=126;}",
"isPrintable",
"{return 33<=n&&n<=126;}",
"return 33<=n&&n<=126;",
"33<=n&&n<=126",
"33<=n",
"33",
"n",
"n<=126",
"n",
"126",
"int n",
"n",
"public static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}",
"skip",
"{\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}",
"while (hasNextByte() && !isPrintable(buffer[p])) p++;",
"hasNextByte() && !isPrintable(buffer[p])",
"hasNextByte()",
"hasNextByte",
"!isPrintable(buffer[p])",
"isPrintable(buffer[p])",
"isPrintable",
"buffer[p]",
"buffer",
"p",
"p++",
"p",
"public static boolean hasNext () {skip(); return hasNextByte();}",
"hasNext",
"{skip(); return hasNextByte();}",
"skip()",
"skip",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int temp = readByte();",
"temp",
"readByte()",
"readByte",
"while (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}",
"isPrintable(temp)",
"isPrintable",
"temp",
"{\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}",
"sb.appendCodePoint(temp)",
"sb.appendCodePoint",
"sb",
"temp",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public static int nextInt () {return Math.toIntExact(nextLong());}",
"nextInt",
"{return Math.toIntExact(nextLong());}",
"return Math.toIntExact(nextLong());",
"Math.toIntExact(nextLong())",
"Math.toIntExact",
"Math",
"nextLong()",
"nextLong",
"public static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}",
"nextInts",
"{\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}",
"int[] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for (int i=0; i<n; i++) ar[i] = nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"ar[i] = nextInt();",
"ar[i] = nextInt()",
"ar[i]",
"ar",
"i",
"nextInt()",
"nextInt",
"return ar;",
"ar",
"int n",
"n",
"public static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"boolean minus = false;",
"minus",
"false",
"int temp = readByte();",
"temp",
"readByte()",
"readByte",
"if (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}",
"temp == '-'",
"temp",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"if (temp<'0' || '9'<temp) throw new NumberFormatException();",
"temp<'0' || '9'<temp",
"temp<'0'",
"temp",
"'0'",
"'9'<temp",
"'9'",
"temp",
"throw new NumberFormatException();",
"new NumberFormatException()",
"long n = 0;",
"n",
"0",
"while (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}",
"isPrintable(temp)",
"isPrintable",
"temp",
"{\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}",
"if ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}",
"'0'<=temp && temp<='9'",
"'0'<=temp",
"'0'",
"temp",
"temp<='9'",
"temp",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += temp - '0'",
"n",
"temp - '0'",
"temp",
"'0'",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"return minus? -n : n;",
"minus? -n : n",
"minus",
"-n",
"n",
"n",
"public class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tstatic boolean isOK(int index,int key,int[]a){\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}\n\tstatic int binary_search(int key,int[] a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n=nextInt();\n\t\tint S[]=new int[n];\n\t\tint k=-1;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tS[i]=nextInt();\n\t\t\tif(S[i]==k)\n\t\t\t\tS[i]=-1;\n\t\t\telse\n\t\t\t\tif(k!=S[i])\n\t\t\t\t\tk=S[i];\n\t\t}\n\t\tint q=nextInt();\n\t\tint T[]=new int[q];\n\t\tfor(int i=0;i<q;i++)T[i]=nextInt();\n\t\tint ans=0;\n\t\tArrays.sort(T);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tint a=Arrays.binarySearch(T,S[i]);\n\t\t\tif(a<q&&0<=a&&T[a]==S[i])\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tstatic boolean isOK(int index,int key,int[]a){\n\t\tif (key>=a[index]) return true;\n\t else return false;\n\t}\n\tstatic int binary_search(int key,int[] a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n}",
"Main"
] | import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
public static void main(String[] args)throws Exception{
PrintWriter out = new PrintWriter(System.out);
int n=nextInt();
int S[]=new int[n];
int k=-1;
for(int i=0;i<n;i++){
S[i]=nextInt();
if(S[i]==k)
S[i]=-1;
else
if(k!=S[i])
k=S[i];
}
int q=nextInt();
int T[]=new int[q];
for(int i=0;i<q;i++)T[i]=nextInt();
int ans=0;
Arrays.sort(T);
for(int i=0;i<n;i++){
int a=Arrays.binarySearch(T,S[i]);
if(a<q&&0<=a&&T[a]==S[i])
ans++;
}
System.out.println(ans);
}
static boolean isOK(int index,int key,int[]a){
if (key>=a[index]) return true;
else return false;
}
static int binary_search(int key,int[] a) {
int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
while (Math.abs(ok - ng) > 1) {
int mid = (ok + ng) / 2;
if (isOK(mid,key,a)) ok = mid;
else ng = mid;
}
return ok;
}
//FastScanner
static InputStream in = System.in;
static byte[] buffer = new byte[1024];
static int length = 0, p = 0;
public static boolean hasNextByte () {
if (p < length) return true;
else {
p = 0;
try {length = in.read(buffer);}
catch (Exception e) {e.printStackTrace();}
if (length == 0) return false;
}
return true;
}
public static int readByte () {
if (hasNextByte() == true) return buffer[p++];
return -1;
}
public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
public static void skip () {
while (hasNextByte() && !isPrintable(buffer[p])) p++;
}
public static boolean hasNext () {skip(); return hasNextByte();}
public static String next () {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int temp = readByte();
while (isPrintable(temp)) {
sb.appendCodePoint(temp);
temp = readByte();
}
return sb.toString();
}
public static int nextInt () {return Math.toIntExact(nextLong());}
public static int[] nextInts (int n) {
int[] ar = new int[n];
for (int i=0; i<n; i++) ar[i] = nextInt();
return ar;
}
public static long nextLong () {
if (!hasNext()) throw new NoSuchElementException();
boolean minus = false;
int temp = readByte();
if (temp == '-') {
minus = true;
temp = readByte();
}
if (temp<'0' || '9'<temp) throw new NumberFormatException();
long n = 0;
while (isPrintable(temp)) {
if ('0'<=temp && temp<='9') {
n *= 10;
n += temp - '0';
}
temp = readByte();
}
return minus? -n : n;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
2,
13,
17,
42,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
13,
13,
30,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
20,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
29,
4,
18,
13,
13,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
6,
13,
12,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
379,
23
],
[
379,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
26,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
51,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
26,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
26,
64
],
[
64,
65
],
[
64,
66
],
[
26,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
68,
76
],
[
76,
77
],
[
77,
78
],
[
68,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
26,
88
],
[
88,
89
],
[
88,
90
],
[
26,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
91,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
103,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
103,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
119,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
119,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
143,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
26,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
24,
165
],
[
165,
166
],
[
379,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
167,
175
],
[
175,
176
],
[
167,
177
],
[
177,
178
],
[
167,
179
],
[
179,
180
],
[
167,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
181,
189
],
[
189,
190
],
[
167,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
194,
199
],
[
199,
200
],
[
193,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
209,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
205,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
227,
228
],
[
193,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
167,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
236,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
236,
250
],
[
250,
251
],
[
250,
252
],
[
236,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
253,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
259,
262
],
[
258,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
236,
267
],
[
267,
268
],
[
268,
269
],
[
269,
270
],
[
167,
271
],
[
271,
272
],
[
271,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
273,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
273,
286
],
[
286,
287
],
[
286,
288
],
[
273,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
289,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
293,
298
],
[
298,
299
],
[
298,
300
],
[
300,
301
],
[
273,
302
],
[
302,
303
],
[
302,
304
],
[
273,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
307,
309
],
[
305,
310
],
[
310,
311
],
[
311,
312
],
[
312,
313
],
[
313,
314
],
[
313,
315
],
[
312,
316
],
[
316,
317
],
[
316,
318
],
[
311,
319
],
[
319,
320
],
[
310,
321
],
[
321,
322
],
[
321,
323
],
[
310,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
326,
328
],
[
310,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
273,
333
],
[
333,
334
],
[
334,
335
],
[
334,
336
],
[
167,
337
],
[
337,
338
],
[
337,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
345,
346
],
[
346,
347
],
[
345,
348
],
[
339,
349
],
[
349,
350
],
[
353,
351
],
[
363,
352
],
[
360,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
353,
357
],
[
357,
358
],
[
357,
359
],
[
360,
360
],
[
360,
361
],
[
360,
362
],
[
363,
363
],
[
363,
364
],
[
363,
365
],
[
353,
366
],
[
366,
367
],
[
366,
368
],
[
368,
369
],
[
337,
370
],
[
370,
371
],
[
167,
372
],
[
372,
373
],
[
372,
374
],
[
374,
375
],
[
374,
376
],
[
376,
377
],
[
0,
378
],
[
378,
379
],
[
378,
380
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\n\n \npublic class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.LinkedList;",
"LinkedList",
"java.util",
"import java.util.PriorityQueue;",
"PriorityQueue",
"java.util",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }",
"InputReader sc = new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ss = new int[n];",
"ss",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ss[i] = sc.nextInt();\n }",
"{\n ss[i] = sc.nextInt();\n }",
"ss[i] = sc.nextInt()",
"ss[i]",
"ss",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ts = new int[m];",
"ts",
"new int[m]",
"m",
"for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n ts[i] = sc.nextInt();\n }",
"{\n ts[i] = sc.nextInt();\n }",
"ts[i] = sc.nextInt()",
"ts[i]",
"ts",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }",
"{\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }",
"int target = ts[i];",
"target",
"ts[i]",
"ts",
"i",
"int left = 0;",
"left",
"0",
"int right = n-1;",
"right",
"n-1",
"n",
"1",
"while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }",
"true",
"{\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }",
"int center = (left + right) / 2;",
"center",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(ss[center] == target){\n ans++;\n break;\n }",
"ss[center] == target",
"ss[center]",
"ss",
"center",
"target",
"{\n ans++;\n break;\n }",
"ans++",
"ans",
"break;",
"if(right == left){break;}",
"right == left",
"right",
"left",
"{break;}",
"break;",
"if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }",
"ss[center] < target",
"ss[center]",
"ss",
"center",
"target",
"{\n left = center + 1;\n }",
"left = center + 1",
"left",
"center + 1",
"center",
"1",
"{\n right = center;\n }",
"right = center",
"right",
"center",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
" static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"next",
"{\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }",
"if (numChars == -1)\n throw new InputMismatchException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }",
"nextStr",
"{\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }",
"int c = next();",
"c",
"next()",
"next",
"while(isSpaceChar(c)){c = next();}",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{c = next();}",
"c = next()",
"c",
"next()",
"next",
"StringBuffer str = new StringBuffer();",
"str",
"new StringBuffer()",
"do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n str.append((char)c);\n c = next();\n }",
"str.append((char)c)",
"str.append",
"str",
"(char)c",
"c = next()",
"c",
"next()",
"next",
"return str.toString();",
"str.toString()",
"str.toString",
"str",
"public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = next();",
"c",
"next()",
"next",
"while (isSpaceChar(c))\n c = next();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = next()",
"c",
"next()",
"next",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = next();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = next();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = next()",
"c",
"next()",
"next",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n }",
"if (c < '0' || c > '9')\n throw new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = next()",
"c",
"next()",
"next",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isSpaceChar",
"{\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"if (filter != null)\n return filter.isSpaceChar(c);",
"filter != null",
"filter",
"null",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n \n int n = sc.nextInt();\n int[] ss = new int[n];\n for(int i = 0; i < n; i++){\n ss[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n int[] ts = new int[m];\n for(int i = 0; i < m; i++){\n ts[i] = sc.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < m; i++){\n int target = ts[i];\n int left = 0;\n int right = n-1;\n while(true){\n int center = (left + right) / 2;\n if(ss[center] == target){\n ans++;\n break;\n }\n if(right == left){break;}\n if(ss[center] < target){\n left = center + 1;\n }else{\n right = center;\n }\n }\n }\n System.out.println(ans);\n }\n \n \n// LinkedList<Integer>[] setsu = new LinkedList[n];\n// for(int i = 0; i < n; i++){\n// setsu[i] = new LinkedList<Integer>();\n// } \n\n //ここからテンプレ\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n \n public int next() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n \n public String nextStr() {\n int c = next();\n while(isSpaceChar(c)){c = next();}\n StringBuffer str = new StringBuffer();\n do{\n str.append((char)c);\n c = next();\n }while(!isSpaceChar(c));\n return str.toString();\n }\n\n public int nextInt() {\n int c = next();\n while (isSpaceChar(c))\n c = next();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = next();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = next();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
public class Main {
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
int n = sc.nextInt();
int[] ss = new int[n];
for(int i = 0; i < n; i++){
ss[i] = sc.nextInt();
}
int m = sc.nextInt();
int[] ts = new int[m];
for(int i = 0; i < m; i++){
ts[i] = sc.nextInt();
}
int ans = 0;
for(int i = 0; i < m; i++){
int target = ts[i];
int left = 0;
int right = n-1;
while(true){
int center = (left + right) / 2;
if(ss[center] == target){
ans++;
break;
}
if(right == left){break;}
if(ss[center] < target){
left = center + 1;
}else{
right = center;
}
}
}
System.out.println(ans);
}
// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
// setsu[i] = new LinkedList<Integer>();
// }
//ここからテンプレ
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int next() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextStr() {
int c = next();
while(isSpaceChar(c)){c = next();}
StringBuffer str = new StringBuffer();
do{
str.append((char)c);
c = next();
}while(!isSpaceChar(c));
return str.toString();
}
public int nextInt() {
int c = next();
while (isSpaceChar(c))
c = next();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = next();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = next();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
13,
18,
13,
13,
30,
40,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
157,
5
],
[
157,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
75,
79
],
[
75,
80
],
[
6,
81
],
[
81,
82
],
[
157,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
86,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
99,
105
],
[
105,
106
],
[
106,
107
],
[
85,
108
],
[
108,
109
],
[
83,
110
],
[
110,
111
],
[
83,
112
],
[
112,
113
],
[
83,
114
],
[
114,
115
],
[
157,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
122,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
136,
139
],
[
136,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
118,
146
],
[
146,
147
],
[
116,
148
],
[
148,
149
],
[
116,
150
],
[
150,
151
],
[
116,
152
],
[
152,
153
],
[
116,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"\n\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}\n\n\tpublic static boolean isIncludeNumber(int n, int s[], int num) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int countNumbers(int n, int s[], int q, int t[]) {\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}\n\n\tpublic static boolean isIncludeNumber(int n, int s[], int num) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int countNumbers(int n, int s[], int q, int t[]) {\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int s[] = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int t[] = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"t[i] = sc.nextInt()",
"t[i]",
"t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"System.out.println(countNumbers(n, s, q, t))",
"System.out.println",
"System.out",
"System",
"System.out",
"countNumbers(n, s, q, t)",
"countNumbers",
"n",
"s",
"q",
"t",
"String[] args",
"args",
"public static boolean isIncludeNumber(int n, int s[], int num) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"isIncludeNumber",
"{\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"for (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}",
"if (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}",
"s[i] == num",
"s[i]",
"s",
"i",
"num",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"return false;",
"false",
"int n",
"n",
"int s[]",
"s",
"int num",
"num",
"public static int countNumbers(int n, int s[], int q, int t[]) {\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"countNumbers",
"{\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"int count = 0;",
"count",
"0",
"for (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"if (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}",
"isIncludeNumber(n, s, t[j])",
"isIncludeNumber",
"n",
"s",
"t[j]",
"t",
"j",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"return count;",
"count",
"int n",
"n",
"int s[]",
"s",
"int q",
"q",
"int t[]",
"t",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}\n\n\tpublic static boolean isIncludeNumber(int n, int s[], int num) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int countNumbers(int n, int s[], int q, int t[]) {\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint s[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint t[] = new int[q];\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\n\t\tSystem.out.println(countNumbers(n, s, q, t));\n\t}\n\n\tpublic static boolean isIncludeNumber(int n, int s[], int num) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (s[i] == num) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static int countNumbers(int n, int s[], int q, int t[]) {\n\t\tint count = 0;\n\t\tfor (int j = 0; j < q; j++) {\n\t\t\tif (isIncludeNumber(n, s, t[j])) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int s[] = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int t[] = new int[q];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
System.out.println(countNumbers(n, s, q, t));
}
public static boolean isIncludeNumber(int n, int s[], int num) {
for (int i = 0; i < n; i++) {
if (s[i] == num) {
return true;
}
}
return false;
}
public static int countNumbers(int n, int s[], int q, int t[]) {
int count = 0;
for (int j = 0; j < q; j++) {
if (isIncludeNumber(n, s, t[j])) {
count++;
}
}
return count;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
41,
13,
13,
0,
13,
13,
0,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
18,
13,
13,
17,
18,
13,
13,
30,
40,
13,
9,
14,
2,
18,
13,
2,
18,
13,
13,
17,
18,
13,
13,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
240,
5
],
[
240,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
64,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
101,
104
],
[
6,
105
],
[
105,
106
],
[
240,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
109,
128
],
[
128,
129
],
[
128,
130
],
[
109,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
131,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
147,
155
],
[
155,
156
],
[
155,
157
],
[
146,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
146,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
163,
171
],
[
171,
172
],
[
171,
173
],
[
162,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
175,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
175,
189
],
[
189,
190
],
[
190,
191
],
[
175,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
198,
199
],
[
198,
200
],
[
193,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
162,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
205,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
205,
217
],
[
217,
218
],
[
218,
219
],
[
205,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
226,
228
],
[
221,
229
],
[
229,
230
],
[
230,
231
],
[
229,
232
],
[
109,
233
],
[
233,
234
],
[
107,
235
],
[
235,
236
],
[
107,
237
],
[
237,
238
],
[
0,
239
],
[
239,
240
],
[
239,
241
]
] | [
"import java.io.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }\n \n}",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }\n \n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n=Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] str=br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S=new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i]=Integer.parseInt(str[i]);",
"S[i]=Integer.parseInt(str[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int q=Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"str=br.readLine().split(\" \")",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] T=new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"T[i]=Integer.parseInt(str[i]);",
"T[i]=Integer.parseInt(str[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"System.out.println(method(S,T))",
"System.out.println",
"System.out",
"System",
"System.out",
"method(S,T)",
"method",
"S",
"T",
"String[] args",
"args",
"static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }",
"method",
"{\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }",
"if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }",
"s.length<t.length",
"s.length",
"s",
"s.length",
"t.length",
"t",
"t.length",
"{\n int[] tmp=s;\n s=t;\n t=tmp;\n }",
"int[] tmp=s;",
"tmp",
"s",
"s=t",
"s",
"t",
"t=tmp",
"t",
"tmp",
"int count=0;",
"count",
"0",
"for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<t.length",
"i",
"t.length",
"t",
"t.length",
"i++",
"i++",
"i",
"{\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }",
"{\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }",
"if(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"s[s.length/2]==t[i]",
"s[s.length/2]",
"s",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"t[i]",
"t",
"i",
"{count++;continue;}",
"count++",
"count",
"continue;",
"if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"s[s.length/2]<t[i]",
"s[s.length/2]",
"s",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"t[i]",
"t",
"i",
"{\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}",
"for(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"int j=s.length/2;",
"int j=s.length/2;",
"j",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"j<s.length",
"j",
"s.length",
"s",
"s.length",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"for(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<s.length/2",
"j",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"return count;",
"count",
"int[] s",
"s",
"int[] t",
"t",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }\n \n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n for(int i=0;i<t.length;i++){\n \tif(s[s.length/2]==t[i]){count++;continue;}\n \telse if(s[s.length/2]<t[i]){\n \t\tfor(int j=s.length/2;j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \t\n \telse\n \t\tfor(int j=0;j<s.length/2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}\n \t\n \n \n \n }\n \n return count;\n }\n \n}",
"Main"
] | import java.io.*;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
String[] str=br.readLine().split(" ");
int[] S=new int[n];
for(int i=0;i<n;i++)
S[i]=Integer.parseInt(str[i]);
int q=Integer.parseInt(br.readLine());
str=br.readLine().split(" ");
int[] T=new int[q];
for(int i=0;i<q;i++)
T[i]=Integer.parseInt(str[i]);
System.out.println(method(S,T));
}
static int method(int[] s,int[] t){
if(s.length<t.length){
int[] tmp=s;
s=t;
t=tmp;
}
int count=0;
for(int i=0;i<t.length;i++){
if(s[s.length/2]==t[i]){count++;continue;}
else if(s[s.length/2]<t[i]){
for(int j=s.length/2;j<s.length;j++)
if(t[i]==s[j]){count++;break;}}
else
for(int j=0;j<s.length/2;j++)
if(t[i]==s[j]){count++;break;}
}
return count;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
117,
5
],
[
117,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
60,
66
],
[
66,
67
],
[
66,
68
],
[
60,
69
],
[
69,
70
],
[
69,
71
],
[
60,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
6,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
]
] | [
"import java.util.*;\npublic class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }\n}",
"Main",
"public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++) S[i] = sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = sc.nextInt();",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt = 0;",
"cnt",
"0",
"for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }",
"{\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int left = 0",
"left",
"0",
"right = n;",
"right",
"n",
"while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }",
"left<right",
"left",
"right",
"{\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }",
"int mid = (left+right)/2;",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;",
"S[mid]==t",
"S[mid]",
"S",
"mid",
"t",
"{\n cnt++;\n break;\n }",
"cnt++",
"cnt",
"break;",
"if(S[mid]>t) right = mid;\n else left = mid+1;",
"S[mid]>t",
"S[mid]",
"S",
"mid",
"t",
"right = mid",
"right",
"mid",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String [] args",
"args",
"public class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }\n}",
"public class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] S = new int[n];\n for(int i=0;i<n;i++) S[i] = sc.nextInt();\n int q = sc.nextInt();\n int cnt = 0;\n for(int i=0;i<q;i++){\n int t = sc.nextInt();\n int left = 0, right = n;\n while(left<right){\n int mid = (left+right)/2;\n if(S[mid]==t){\n cnt++;\n break;\n }\n else if(S[mid]>t) right = mid;\n else left = mid+1;\n }\n }\n System.out.println(cnt);\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] S = new int[n];
for(int i=0;i<n;i++) S[i] = sc.nextInt();
int q = sc.nextInt();
int cnt = 0;
for(int i=0;i<q;i++){
int t = sc.nextInt();
int left = 0, right = n;
while(left<right){
int mid = (left+right)/2;
if(S[mid]==t){
cnt++;
break;
}
else if(S[mid]>t) right = mid;
else left = mid+1;
}
}
System.out.println(cnt);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
4,
18,
13,
4,
18,
13,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
4,
18,
13,
17,
23,
13,
6,
13,
41,
13,
20,
41,
13,
17,
12,
13,
30,
23,
13,
12,
13,
30,
14,
40,
13,
30,
4,
18,
13,
13,
17,
0,
13,
17,
29,
4,
18,
36,
13,
17,
2,
4,
18,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
13,
13,
13,
29,
4,
13,
13,
13,
2,
13,
17,
14,
2,
4,
18,
13,
13,
13,
29,
17,
29,
4,
13,
13,
2,
13,
17,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
37,
38
],
[
37,
39
],
[
0,
40
],
[
223,
41
],
[
223,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
44,
53
],
[
53,
54
],
[
53,
55
],
[
44,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
73
],
[
44,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
44,
79
],
[
79,
80
],
[
79,
81
],
[
44,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
82,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
99,
100
],
[
94,
101
],
[
101,
102
],
[
44,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
44,
109
],
[
109,
110
],
[
110,
111
],
[
44,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
42,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
126,
128
],
[
126,
129
],
[
129,
130
],
[
118,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
143,
145
],
[
133,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
147,
151
],
[
147,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
152,
156
],
[
131,
157
],
[
157,
158
],
[
118,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
161,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
161,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
176,
181
],
[
175,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
183,
186
],
[
183,
187
],
[
187,
188
],
[
187,
189
],
[
175,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
191,
196
],
[
190,
197
],
[
197,
198
],
[
190,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
200,
203
],
[
203,
204
],
[
203,
205
],
[
200,
206
],
[
159,
207
],
[
207,
208
],
[
159,
209
],
[
209,
210
],
[
159,
211
],
[
211,
212
],
[
118,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
213,
220
],
[
220,
221
],
[
0,
222
],
[
222,
223
],
[
222,
224
]
] | [
"import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.lang.management.ManagementFactory;\nimport java.lang.management.ThreadMXBean;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n}\n\nclass Slist {\n\tList<Integer> list = new ArrayList<Integer>();\n\tboolean sorted = false;\n\n\tpublic Slist(int n) {\n\t\t// TODO Auto-generated constructor stub\n\t}\n\n\tpublic boolean isExist(int e) {\n\t\tif (!sorted) {\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}\n\t\treturn this.bsearch(e, 0, list.size() - 1);\n\t}\n\n\tprivate boolean bsearch(int e, int min, int max) {\n\t\tif (min > max)\n\t\t\treturn false;\n\t\tint mid = (max + min) / 2;\n\t\tif (list.get(mid) > e)\n\t\t\treturn bsearch(e, min, mid - 1);\n\t\telse if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);\n\t}\n\n\tpublic void add(int e) {\n\t\tlist.add(e);\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.File;",
"File",
"java.io",
"import java.io.FileNotFoundException;",
"FileNotFoundException",
"java.io",
"import java.io.FileReader;",
"FileReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.lang.management.ManagementFactory;",
"ManagementFactory",
"java.lang.management",
"import java.lang.management.ThreadMXBean;",
"ThreadMXBean",
"java.lang.management",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.PriorityQueue;",
"PriorityQueue",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Slist s = new Slist(n);",
"s",
"new Slist(n)",
"for (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"s.add(scan.nextInt());",
"s.add(scan.nextInt())",
"s.add",
"s",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"if (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;",
"if (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;",
"s.isExist(scan.nextInt())",
"s.isExist",
"s",
"scan.nextInt()",
"scan.nextInt",
"scan",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"scan.close()",
"scan.close",
"scan",
"System.exit(0)",
"System.exit",
"System",
"0",
"String[] args",
"args",
"class Slist {\n\tList<Integer> list = new ArrayList<Integer>();\n\tboolean sorted = false;\n\n\tpublic Slist(int n) {\n\t\t// TODO Auto-generated constructor stub\n\t}\n\n\tpublic boolean isExist(int e) {\n\t\tif (!sorted) {\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}\n\t\treturn this.bsearch(e, 0, list.size() - 1);\n\t}\n\n\tprivate boolean bsearch(int e, int min, int max) {\n\t\tif (min > max)\n\t\t\treturn false;\n\t\tint mid = (max + min) / 2;\n\t\tif (list.get(mid) > e)\n\t\t\treturn bsearch(e, min, mid - 1);\n\t\telse if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);\n\t}\n\n\tpublic void add(int e) {\n\t\tlist.add(e);\n\t}\n\n}",
"Slist",
"List<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"boolean sorted = false;",
"sorted",
"false",
"public Slist(int n) {\n\t\t// TODO Auto-generated constructor stub\n\t}",
"Slist",
"{\n\t\t// TODO Auto-generated constructor stub\n\t}",
"int n",
"n",
"public boolean isExist(int e) {\n\t\tif (!sorted) {\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}\n\t\treturn this.bsearch(e, 0, list.size() - 1);\n\t}",
"isExist",
"{\n\t\tif (!sorted) {\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}\n\t\treturn this.bsearch(e, 0, list.size() - 1);\n\t}",
"if (!sorted) {\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}",
"!sorted",
"sorted",
"{\n\t\t\tCollections.sort(list, null);\n\t\t\tsorted = true;\n\t\t}",
"Collections.sort(list, null)",
"Collections.sort",
"Collections",
"list",
"null",
"sorted = true",
"sorted",
"true",
"return this.bsearch(e, 0, list.size() - 1);",
"this.bsearch(e, 0, list.size() - 1)",
"this.bsearch",
"this",
"e",
"0",
"list.size() - 1",
"list.size()",
"list.size",
"list",
"1",
"int e",
"e",
"private boolean bsearch(int e, int min, int max) {\n\t\tif (min > max)\n\t\t\treturn false;\n\t\tint mid = (max + min) / 2;\n\t\tif (list.get(mid) > e)\n\t\t\treturn bsearch(e, min, mid - 1);\n\t\telse if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);\n\t}",
"bsearch",
"{\n\t\tif (min > max)\n\t\t\treturn false;\n\t\tint mid = (max + min) / 2;\n\t\tif (list.get(mid) > e)\n\t\t\treturn bsearch(e, min, mid - 1);\n\t\telse if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);\n\t}",
"if (min > max)\n\t\t\treturn false;",
"min > max",
"min",
"max",
"return false;",
"false",
"int mid = (max + min) / 2;",
"mid",
"(max + min) / 2",
"(max + min)",
"max",
"min",
"2",
"if (list.get(mid) > e)\n\t\t\treturn bsearch(e, min, mid - 1);\n\t\telse if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);",
"list.get(mid) > e",
"list.get(mid)",
"list.get",
"list",
"mid",
"e",
"return bsearch(e, min, mid - 1);",
"bsearch(e, min, mid - 1)",
"bsearch",
"e",
"min",
"mid - 1",
"mid",
"1",
"if (list.get(mid) == e)\n\t\t\treturn true;\n\t\telse\n\t\t\treturn bsearch(e, mid + 1, max);",
"list.get(mid) == e",
"list.get(mid)",
"list.get",
"list",
"mid",
"e",
"return true;",
"true",
"return bsearch(e, mid + 1, max);",
"bsearch(e, mid + 1, max)",
"bsearch",
"e",
"mid + 1",
"mid",
"1",
"max",
"int e",
"e",
"int min",
"min",
"int max",
"max",
"public void add(int e) {\n\t\tlist.add(e);\n\t}",
"add",
"{\n\t\tlist.add(e);\n\t}",
"list.add(e)",
"list.add",
"list",
"e",
"int e",
"e",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\t// Scanner scan = new Scanner(new\n\t\t// File(\"D:\\\\UserArea\\\\J0124567\\\\Downloads\\\\ALDS1_3_C-in10.txt\"));\n\t\t// while (scan.hasNext()) {\n\n\t\tint n = scan.nextInt();\n\t\tSlist s = new Slist(n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts.add(scan.nextInt());\n\t\tint q = scan.nextInt();\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tif (s.isExist(scan.nextInt()))\n\t\t\t\tcnt++;\n\t\tSystem.out.println(cnt);\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
// Scanner scan = new Scanner(new
// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
// while (scan.hasNext()) {
int n = scan.nextInt();
Slist s = new Slist(n);
for (int i = 0; i < n; i++)
s.add(scan.nextInt());
int q = scan.nextInt();
int cnt = 0;
for (int i = 0; i < q; i++)
if (s.isExist(scan.nextInt()))
cnt++;
System.out.println(cnt);
scan.close();
System.exit(0);
}
}
class Slist {
List<Integer> list = new ArrayList<Integer>();
boolean sorted = false;
public Slist(int n) {
// TODO Auto-generated constructor stub
}
public boolean isExist(int e) {
if (!sorted) {
Collections.sort(list, null);
sorted = true;
}
return this.bsearch(e, 0, list.size() - 1);
}
private boolean bsearch(int e, int min, int max) {
if (min > max)
return false;
int mid = (max + min) / 2;
if (list.get(mid) > e)
return bsearch(e, min, mid - 1);
else if (list.get(mid) == e)
return true;
else
return bsearch(e, mid + 1, max);
}
public void add(int e) {
list.add(e);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
8,
74
],
[
74,
75
],
[
74,
76
],
[
8,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
95,
97
],
[
89,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
89,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
115,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
125,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
8,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
6,
149
],
[
149,
150
]
] | [
"import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = scanner.nextInt();\n }\n Arrays.sort(s);\n int q = scanner.nextInt();\n int[] t = new int[n];\n for(int i = 0; i < q; i++){\n t[i] = scanner.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < q; i++){\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = scanner.nextInt();\n }\n Arrays.sort(s);\n int q = scanner.nextInt();\n int[] t = new int[n];\n for(int i = 0; i < q; i++){\n t[i] = scanner.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < q; i++){\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = scanner.nextInt();\n }\n Arrays.sort(s);\n int q = scanner.nextInt();\n int[] t = new int[n];\n for(int i = 0; i < q; i++){\n t[i] = scanner.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < q; i++){\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = scanner.nextInt();\n }\n Arrays.sort(s);\n int q = scanner.nextInt();\n int[] t = new int[n];\n for(int i = 0; i < q; i++){\n t[i] = scanner.nextInt();\n }\n\n int ans = 0;\n for(int i = 0; i < q; i++){\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }\n System.out.println(ans);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n s[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = scanner.nextInt();\n }",
"{\n s[i] = scanner.nextInt();\n }",
"s[i] = scanner.nextInt()",
"s[i]",
"s",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] t = new int[n];",
"t",
"new int[n]",
"n",
"for(int i = 0; i < q; i++){\n t[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = scanner.nextInt();\n }",
"{\n t[i] = scanner.nextInt();\n }",
"t[i] = scanner.nextInt()",
"t[i]",
"t",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < q; i++){\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }",
"{\n int target = t[i];\n int head = 0;\n int tail = n-1;\n while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }\n }",
"int target = t[i];",
"target",
"t[i]",
"t",
"i",
"int head = 0;",
"head",
"0",
"int tail = n-1;",
"tail",
"n-1",
"n",
"1",
"while(head <= tail){\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }",
"head <= tail",
"head",
"tail",
"{\n int middle = (head + tail)/2;\n //System.out.println(s[middle]);\n if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}\n \n }",
"int middle = (head + tail)/2;",
"middle",
"(head + tail)/2",
"(head + tail)",
"head",
"tail",
"2",
"if(s[middle] == target){ans++;break;}\n else if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}",
"s[middle] == target",
"s[middle]",
"s",
"middle",
"target",
"{ans++;break;}",
"ans++",
"ans",
"break;",
"if(s[middle] < target){head = middle+1;}\n else{tail = middle-1;}",
"s[middle] < target",
"s[middle]",
"s",
"middle",
"target",
"{head = middle+1;}",
"head = middle+1",
"head",
"middle+1",
"middle",
"1",
"{tail = middle-1;}",
"tail = middle-1",
"tail",
"middle-1",
"middle",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] | import java.util.*;
class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] s = new int[n];
for(int i = 0; i < n; i++){
s[i] = scanner.nextInt();
}
Arrays.sort(s);
int q = scanner.nextInt();
int[] t = new int[n];
for(int i = 0; i < q; i++){
t[i] = scanner.nextInt();
}
int ans = 0;
for(int i = 0; i < q; i++){
int target = t[i];
int head = 0;
int tail = n-1;
while(head <= tail){
int middle = (head + tail)/2;
//System.out.println(s[middle]);
if(s[middle] == target){ans++;break;}
else if(s[middle] < target){head = middle+1;}
else{tail = middle-1;}
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
161,
5
],
[
161,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
161,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
106,
115
],
[
115,
116
],
[
106,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
129,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
138,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
138,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
106,
154
],
[
154,
155
],
[
104,
156
],
[
156,
157
],
[
104,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }\n\n static boolean search(int a, int []S) {\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }\n\n static boolean search(int a, int []S) {\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }",
"main",
"{\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"int [] S = new int [n];",
"S",
"new int [n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = s.nextInt();\n }",
"{\n S[i] = s.nextInt();\n }",
"S[i] = s.nextInt()",
"S[i]",
"S",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int q = s.nextInt();",
"q",
"s.nextInt()",
"s.nextInt",
"s",
"int [] T = new int [q];",
"T",
"new int [q]",
"q",
"for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = s.nextInt();\n }",
"{\n T[i] = s.nextInt();\n }",
"T[i] = s.nextInt()",
"T[i]",
"T",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int C = 0;",
"C",
"0",
"for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (search(T[i], S)) {\n C++;\n }\n }",
"{\n if (search(T[i], S)) {\n C++;\n }\n }",
"if (search(T[i], S)) {\n C++;\n }",
"search(T[i], S)",
"search",
"T[i]",
"T",
"i",
"S",
"{\n C++;\n }",
"C++",
"C",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args",
"static boolean search(int a, int []S) {\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }",
"search",
"{\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = S.length ;",
"right",
"S.length",
"S",
"S.length",
"int middle;",
"middle",
"while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }",
"left < right",
"left",
"right",
"{\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }",
"middle = (left + right ) / 2",
"middle",
"(left + right ) / 2",
"(left + right )",
"left",
"right",
"2",
"if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }",
"S[middle] == a",
"S[middle]",
"S",
"middle",
"a",
"{\n return true;\n }",
"return true;",
"true",
"if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }",
"S[middle] < a",
"S[middle]",
"S",
"middle",
"a",
"{\n left = middle + 1;\n }",
"left = middle + 1",
"left",
"middle + 1",
"middle",
"1",
"{\n right = middle;\n }",
"right = middle",
"right",
"middle",
"return false;",
"false",
"int a",
"a",
"int []S",
"S",
"public class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }\n\n static boolean search(int a, int []S) {\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int [] S = new int [n];\n for (int i = 0; i < n; i++) {\n S[i] = s.nextInt();\n }\n int q = s.nextInt();\n int [] T = new int [q];\n for (int i = 0; i < q; i++) {\n T[i] = s.nextInt();\n }\n\n int C = 0;\n\n for (int i = 0; i < q; i++) {\n if (search(T[i], S)) {\n C++;\n }\n }\n System.out.println(C);\n }\n\n static boolean search(int a, int []S) {\n int left = 0;\n int right = S.length ;\n int middle;\n\n while (left < right) {\n middle = (left + right ) / 2;\n if (S[middle] == a) {\n return true;\n } else if (S[middle] < a) {\n left = middle + 1;\n } else {\n right = middle;\n }\n }\n return false;\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int [] S = new int [n];
for (int i = 0; i < n; i++) {
S[i] = s.nextInt();
}
int q = s.nextInt();
int [] T = new int [q];
for (int i = 0; i < q; i++) {
T[i] = s.nextInt();
}
int C = 0;
for (int i = 0; i < q; i++) {
if (search(T[i], S)) {
C++;
}
}
System.out.println(C);
}
static boolean search(int a, int []S) {
int left = 0;
int right = S.length ;
int middle;
while (left < right) {
middle = (left + right ) / 2;
if (S[middle] == a) {
return true;
} else if (S[middle] < a) {
left = middle + 1;
} else {
right = middle;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
17,
2,
18,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
178,
8
],
[
178,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
32,
38
],
[
38,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
40,
46
],
[
46,
47
],
[
46,
48
],
[
40,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
11,
54
],
[
54,
55
],
[
9,
56
],
[
56,
57
],
[
9,
58
],
[
58,
59
],
[
9,
60
],
[
60,
61
],
[
9,
62
],
[
62,
63
],
[
178,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
66,
75
],
[
75,
76
],
[
75,
77
],
[
66,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
66,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
66,
104
],
[
104,
105
],
[
104,
106
],
[
66,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
66,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
66,
132
],
[
132,
133
],
[
132,
134
],
[
66,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
135,
146
],
[
147,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
149,
152
],
[
152,
153
],
[
152,
154
],
[
149,
155
],
[
149,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
148,
161
],
[
161,
162
],
[
66,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
178,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
169,
175
],
[
175,
176
],
[
0,
177
],
[
177,
178
],
[
177,
179
]
] | [
"/*\n * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=jp\n */\nimport java.util.*;\nimport java.util.Arrays;\n\npublic class Main {\n\t\n\tboolean binSearch(int[] s, int x, int a, int b) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\t\n\tboolean binSearch(int[] s, int x, int a, int b) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}\n\n}",
"Main",
"boolean binSearch(int[] s, int x, int a, int b) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"binSearch",
"{\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"int left = 0;",
"left",
"0",
"int right = s.length;",
"right",
"s.length",
"s",
"s.length",
"while (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;",
"s[mid] == x",
"s[mid]",
"s",
"mid",
"x",
"return true;",
"true",
"if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;",
"s[mid] > x",
"s[mid]",
"s",
"mid",
"x",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] s",
"s",
"int x",
"x",
"int a",
"a",
"int b",
"b",
"void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"run",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tt[i] = sc.nextInt();\n\t\t}",
"t[i] = sc.nextInt()",
"t[i]",
"t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}",
"{\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}",
"if (binSearch(s, t[i], 0, s.length - 1)) cnt++;",
"binSearch(s, t[i], 0, s.length - 1)",
"binSearch",
"s",
"t[i]",
"t",
"i",
"0",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"public class Main {\n\t\n\tboolean binSearch(int[] s, int x, int a, int b) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}\n\n}",
"public class Main {\n\t\n\tboolean binSearch(int[] s, int x, int a, int b) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s[mid] == x) return true;\n\t\t\telse if (s[mid] > x) right = mid;\n\t\t\telse left = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(s);\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binSearch(s, t[i], 0, s.length - 1)) cnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tnew Main().run();\n\t}\n\n}",
"Main"
] | /*
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=jp
*/
import java.util.*;
import java.util.Arrays;
public class Main {
boolean binSearch(int[] s, int x, int a, int b) {
int left = 0;
int right = s.length;
while (left < right) {
int mid = (left + right) / 2;
if (s[mid] == x) return true;
else if (s[mid] > x) right = mid;
else left = mid + 1;
}
return false;
}
void run() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
Arrays.sort(s);
int cnt = 0;
for (int i = 0; i < q; i++) {
if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
}
System.out.println(cnt);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Main().run();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
159,
5
],
[
159,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
87,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
93,
94
],
[
94,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
159,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
106,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
127,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
136,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
106,
152
],
[
152,
153
],
[
104,
154
],
[
154,
155
],
[
104,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean BinarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean BinarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = scanner.nextInt();\n }",
"{\n s[i] = scanner.nextInt();\n }",
"s[i] = scanner.nextInt()",
"s[i]",
"s",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = scanner.nextInt();\n }",
"{\n t[i] = scanner.nextInt();\n }",
"t[i] = scanner.nextInt()",
"t[i]",
"t",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }",
"{\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }",
"if (BinarySearch(s, t[i])) {\n count++;\n }",
"BinarySearch(s, t[i])",
"BinarySearch",
"s",
"t[i]",
"t",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static boolean BinarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }",
"BinarySearch",
"{\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = a.length;",
"right",
"a.length",
"a",
"a.length",
"while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }",
"a[mid] == key",
"a[mid]",
"a",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }",
"key < a[mid]",
"key",
"a[mid]",
"a",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] a",
"a",
"int key",
"key",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean BinarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (BinarySearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean BinarySearch(int[] a, int key) {\n int left = 0;\n int right = a.length;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key) {\n return true;\n }\n else if (key < a[mid]) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n } \n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = scanner.nextInt();
}
int q = scanner.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = scanner.nextInt();
}
int count = 0;
for (int i = 0; i < q; i++) {
if (BinarySearch(s, t[i])) {
count++;
}
}
System.out.println(count);
}
static boolean BinarySearch(int[] a, int key) {
int left = 0;
int right = a.length;
while (left < right) {
int mid = (left + right) / 2;
if (a[mid] == key) {
return true;
}
else if (key < a[mid]) {
right = mid;
}
else {
left = mid + 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
18,
13,
13,
13,
13,
14,
2,
13,
17,
40,
13,
4,
18,
18,
13,
13,
17,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
194,
5
],
[
194,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
23,
24
],
[
23,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
8,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
8,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
97,
99
],
[
8,
100
],
[
100,
101
],
[
100,
102
],
[
8,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
120,
126
],
[
117,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
133,
139
],
[
6,
140
],
[
140,
141
],
[
194,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
148,
150
],
[
144,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
155,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
163,
169
],
[
169,
170
],
[
163,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
171,
177
],
[
177,
178
],
[
177,
179
],
[
171,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
182,
184
],
[
144,
185
],
[
185,
186
],
[
142,
187
],
[
187,
188
],
[
142,
189
],
[
189,
190
],
[
142,
191
],
[
191,
192
],
[
0,
193
],
[
193,
194
],
[
193,
195
]
] | [
"import java.io.*;\n\npublic class Main{\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}\n\n\tprivate static boolean binarySearch(int key, int[] A, int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}\n\n\tprivate static boolean binarySearch(int key, int[] A, int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] S = new int[n+1];",
"S",
"new int[n+1]",
"n+1",
"n",
"1",
"String[] ins = br.readLine().split(\" \");",
"ins",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}",
"S[i] = Integer.parseInt(ins[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(ins[i])",
"Integer.parseInt",
"Integer",
"ins[i]",
"ins",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"ins = br.readLine().split(\" \")",
"ins",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}",
"T[i] = Integer.parseInt(ins[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(ins[i])",
"Integer.parseInt",
"Integer",
"ins[i]",
"ins",
"i",
"int C = 0;",
"C",
"0",
"for(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}",
"{\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}",
"boolean flag = binarySearch(T[i], S, n);",
"flag",
"binarySearch(T[i], S, n)",
"binarySearch",
"T[i]",
"T",
"i",
"S",
"n",
"if(flag == true)\n\t\t\t\tC++;",
"flag == true",
"flag",
"true",
"C++",
"C",
"System.out.printf(\"%d\\n\", C)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"C",
"String[] args",
"args",
"private static boolean binarySearch(int key, int[] A, int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;",
"A[mid] == key",
"A[mid]",
"A",
"mid",
"key",
"return true;",
"true",
"if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int key",
"key",
"int[] A",
"A",
"int n",
"n",
"public class Main{\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}\n\n\tprivate static boolean binarySearch(int key, int[] A, int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n}",
"public class Main{\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] S = new int[n+1];\n\t\tString[] ins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = Integer.parseInt(ins[i]);\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tint[] T = new int[q];\n\t\tins = br.readLine().split(\" \");\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = Integer.parseInt(ins[i]);\n\t\t}\n\n\t\tint C = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tboolean flag = binarySearch(T[i], S, n);\n\t\t\tif(flag == true)\n\t\t\t\tC++;\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", C);\n\t}\n\n\tprivate static boolean binarySearch(int key, int[] A, int n){\n\t\tint left = 0;\n\t\tint right = n;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif(A[mid] == key)\n\t\t\t\treturn true;\n\t\t\telse if(key < A[mid])\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n}",
"Main"
] | import java.io.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] S = new int[n+1];
String[] ins = br.readLine().split(" ");
for(int i = 0; i < n; i++){
S[i] = Integer.parseInt(ins[i]);
}
int q = Integer.parseInt(br.readLine());
int[] T = new int[q];
ins = br.readLine().split(" ");
for(int i = 0; i < q; i++){
T[i] = Integer.parseInt(ins[i]);
}
int C = 0;
for(int i = 0; i < T.length; i++){
boolean flag = binarySearch(T[i], S, n);
if(flag == true)
C++;
}
System.out.printf("%d\n", C);
}
private static boolean binarySearch(int key, int[] A, int n){
int left = 0;
int right = n;
while(left < right){
int mid = (left + right) / 2;
if(A[mid] == key)
return true;
else if(key < A[mid])
right = mid;
else
left = mid + 1;
}
return false;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
41,
13,
17,
2,
2,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
10,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
10,
48
],
[
48,
49
],
[
48,
50
],
[
10,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
10,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
10,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
10,
80
],
[
80,
81
],
[
80,
82
],
[
10,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
83,
98
],
[
98,
99
],
[
99,
100
],
[
83,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
103,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
10,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
6,
135
],
[
135,
136
]
] | [
"import java.util.*;\n\nclass Main {\n public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }\n }\n}",
"Main",
"public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }",
"{\n int N = sc.nextInt();\n long[] S = new long[N];\n for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }\n int Q = sc.nextInt();\n long[] T = new long[Q];\n for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }\n Arrays.sort(S);\n Arrays.sort(T);\n int ans = 0;\n for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] S = new long[N];",
"S",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n S[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextLong();\n }",
"{\n S[i] = sc.nextLong();\n }",
"S[i] = sc.nextLong()",
"S[i]",
"S",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"int Q = sc.nextInt();",
"Q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] T = new long[Q];",
"T",
"new long[Q]",
"Q",
"for (int i = 0; i < Q; i++) {\n T[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < Q",
"i",
"Q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextLong();\n }",
"{\n T[i] = sc.nextLong();\n }",
"T[i] = sc.nextLong()",
"T[i]",
"T",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int ans = 0;",
"ans",
"0",
"for (int i = 0, j = 0; i < N && j < Q; i++) {\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }",
"int i = 0, j = 0;",
"int i = 0",
"i",
"0",
"j = 0;",
"j",
"0",
"i < N && j < Q",
"i < N",
"i",
"N",
"j < Q",
"j",
"Q",
"i++",
"i++",
"i",
"{\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }",
"{\n if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }\n }",
"if (S[i] == T[j]) {\n ans++;\n j++;\n } else if(S[i] > T[j]) {\n i--;\n j++;\n }",
"S[i] == T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n ans++;\n j++;\n }",
"ans++",
"ans",
"j++",
"j",
"if(S[i] > T[j]) {\n i--;\n j++;\n }",
"S[i] > T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n i--;\n j++;\n }",
"i--",
"i",
"j++",
"j",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args"
] | import java.util.*;
class Main {
public static void main(String args[]) {
try (Scanner sc = new Scanner(System.in)) {
int N = sc.nextInt();
long[] S = new long[N];
for (int i = 0; i < N; i++) {
S[i] = sc.nextLong();
}
int Q = sc.nextInt();
long[] T = new long[Q];
for (int i = 0; i < Q; i++) {
T[i] = sc.nextLong();
}
Arrays.sort(S);
Arrays.sort(T);
int ans = 0;
for (int i = 0, j = 0; i < N && j < Q; i++) {
if (S[i] == T[j]) {
ans++;
j++;
} else if(S[i] > T[j]) {
i--;
j++;
}
}
System.out.println(ans);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
2,
13,
13,
2,
13,
13,
29,
40,
17,
14,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
13,
29,
40,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
30,
29,
4,
13,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
40,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
17,
2,
13,
17,
13,
18,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
256,
5
],
[
256,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
8,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
16,
24
],
[
24,
25
],
[
25,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
28,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
27,
39
],
[
39,
40
],
[
40,
41
],
[
8,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
51,
57
],
[
57,
58
],
[
58,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
69,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
77,
80
],
[
77,
81
],
[
77,
82
],
[
69,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
85,
89
],
[
85,
90
],
[
6,
91
],
[
91,
92
],
[
6,
93
],
[
93,
94
],
[
6,
95
],
[
95,
96
],
[
6,
97
],
[
97,
98
],
[
256,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
101,
107
],
[
107,
108
],
[
101,
109
],
[
109,
110
],
[
101,
111
],
[
111,
112
],
[
101,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
101,
118
],
[
118,
119
],
[
118,
120
],
[
101,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
122,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
101,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
101,
147
],
[
147,
148
],
[
147,
149
],
[
101,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
151,
162
],
[
163,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
169,
170
],
[
101,
171
],
[
171,
172
],
[
172,
173
],
[
101,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
174,
179
],
[
179,
180
],
[
179,
181
],
[
174,
182
],
[
182,
183
],
[
183,
184
],
[
174,
185
],
[
186,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
191,
193
],
[
187,
194
],
[
194,
195
],
[
194,
196
],
[
187,
197
],
[
197,
198
],
[
198,
199
],
[
187,
200
],
[
201,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
203,
207
],
[
207,
208
],
[
207,
209
],
[
202,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
101,
216
],
[
216,
217
],
[
216,
218
],
[
101,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
219,
224
],
[
224,
225
],
[
224,
226
],
[
219,
227
],
[
227,
228
],
[
228,
229
],
[
219,
230
],
[
231,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
234,
237
],
[
237,
238
],
[
237,
239
],
[
234,
240
],
[
234,
241
],
[
241,
242
],
[
241,
243
],
[
233,
244
],
[
232,
245
],
[
245,
246
],
[
101,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
247,
252
],
[
99,
253
],
[
253,
254
],
[
0,
255
],
[
255,
256
],
[
255,
257
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static int binarySearch(int start, int n, int[] S, int q) {\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static int binarySearch(int start, int n, int[] S, int q) {\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static int binarySearch(int start, int n, int[] S, int q) {\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }",
"binarySearch",
"{\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }",
"int mid = (start + n) / 2;",
"mid",
"(start + n) / 2",
"(start + n)",
"start",
"n",
"2",
"if(mid == start || mid == n)return -1;",
"mid == start || mid == n",
"mid == start",
"mid",
"start",
"mid == n",
"mid",
"n",
"return -1;",
"-1",
"1",
"if (S[n] < q || S[start] > q)\n return -1;",
"S[n] < q || S[start] > q",
"S[n] < q",
"S[n]",
"S",
"n",
"q",
"S[start] > q",
"S[start]",
"S",
"start",
"q",
"return -1;",
"-1",
"1",
"if (S[start] == q){\n return 1;\n }",
"S[start] == q",
"S[start]",
"S",
"start",
"q",
"{\n return 1;\n }",
"return 1;",
"1",
"if(S[mid] == q ){\n return 1;\n }",
"S[mid] == q",
"S[mid]",
"S",
"mid",
"q",
"{\n return 1;\n }",
"return 1;",
"1",
"if(S[n] == q) {\n return 1;\n }",
"S[n] == q",
"S[n]",
"S",
"n",
"q",
"{\n return 1;\n }",
"return 1;",
"1",
"if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }",
"S[mid] < q",
"S[mid]",
"S",
"mid",
"q",
"{\n return binarySearch(mid, n, S, q);\n }",
"return binarySearch(mid, n, S, q);",
"binarySearch(mid, n, S, q)",
"binarySearch",
"mid",
"n",
"S",
"q",
"{\n return binarySearch(start, mid, S, q);\n }",
"return binarySearch(start, mid, S, q);",
"binarySearch(start, mid, S, q)",
"binarySearch",
"start",
"mid",
"S",
"q",
"int start",
"start",
"int n",
"n",
"int[] S",
"S",
"int q",
"q",
"public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n",
"n",
"q;",
"q",
"int S[];",
"S",
"int T[];",
"T",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = scan.nextInt();\n }",
"{\n S[i] = scan.nextInt();\n }",
"S[i] = scan.nextInt()",
"S[i]",
"S",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"q = scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"T = new int[q]",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = scan.nextInt();\n }",
"{\n T[i] = scan.nextInt();\n }",
"T[i] = scan.nextInt()",
"T[i]",
"T",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"scan.close()",
"scan.close",
"scan",
"for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }",
"{\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }",
"for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }",
"int j = i+1;",
"int j = i+1;",
"j",
"i+1",
"i",
"1",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\n if(T[i] == T[j])T[j]=-1;\n }",
"{\n if(T[i] == T[j])T[j]=-1;\n }",
"if(T[i] == T[j])T[j]=-1;",
"T[i] == T[j]",
"T[i]",
"T",
"i",
"T[j]",
"T",
"j",
"T[j]=-1",
"T[j]",
"T",
"j",
"-1",
"1",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{ \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }",
"{ \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }",
"if (binarySearch(0, n-1, S, T[i]) == 1)ans++;",
"binarySearch(0, n-1, S, T[i]) == 1",
"binarySearch(0, n-1, S, T[i])",
"binarySearch",
"0",
"n-1",
"n",
"1",
"S",
"T[i]",
"T",
"i",
"1",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n public static int binarySearch(int start, int n, int[] S, int q) {\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }\n}",
"public class Main{\n public static int binarySearch(int start, int n, int[] S, int q) {\n int mid = (start + n) / 2;\n if(mid == start || mid == n)return -1;\n if (S[n] < q || S[start] > q)\n return -1;\n if (S[start] == q){\n return 1;\n }\n if(S[mid] == q ){\n return 1;\n }\n if(S[n] == q) {\n return 1;\n }\n if (S[mid] < q) {\n return binarySearch(mid, n, S, q);\n } else {\n return binarySearch(start, mid, S, q);\n }\n }\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n, q;\n int S[];\n int T[];\n n = scan.nextInt();\n S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scan.nextInt();\n }\n q = scan.nextInt();\n T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = scan.nextInt();\n }\n scan.close();\n for (int i = 0; i < q; i++) {\n for (int j = i+1; j < q; j++) {\n if(T[i] == T[j])T[j]=-1;\n }\n }\n\n int ans = 0;\n\n for (int i = 0; i < q; i++) { \n if (binarySearch(0, n-1, S, T[i]) == 1)ans++;\n }\n\n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static int binarySearch(int start, int n, int[] S, int q) {
int mid = (start + n) / 2;
if(mid == start || mid == n)return -1;
if (S[n] < q || S[start] > q)
return -1;
if (S[start] == q){
return 1;
}
if(S[mid] == q ){
return 1;
}
if(S[n] == q) {
return 1;
}
if (S[mid] < q) {
return binarySearch(mid, n, S, q);
} else {
return binarySearch(start, mid, S, q);
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n, q;
int S[];
int T[];
n = scan.nextInt();
S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = scan.nextInt();
}
q = scan.nextInt();
T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = scan.nextInt();
}
scan.close();
for (int i = 0; i < q; i++) {
for (int j = i+1; j < q; j++) {
if(T[i] == T[j])T[j]=-1;
}
}
int ans = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(0, n-1, S, T[i]) == 1)ans++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
29,
8,
4,
13,
18,
13,
40,
13,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
323,
14
],
[
323,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
17,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
17,
55
],
[
55,
56
],
[
55,
57
],
[
17,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
78,
82
],
[
77,
83
],
[
76,
84
],
[
84,
85
],
[
17,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
15,
92
],
[
92,
93
],
[
323,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
94,
101
],
[
101,
102
],
[
101,
103
],
[
94,
105
],
[
105,
106
],
[
105,
107
],
[
94,
108
],
[
108,
109
],
[
108,
110
],
[
94,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
114,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
125,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
121,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
113,
146
],
[
146,
147
],
[
94,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
152,
159
],
[
159,
160
],
[
94,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
169,
171
],
[
161,
172
],
[
172,
173
],
[
94,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
178,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
177,
187
],
[
187,
188
],
[
94,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
194,
195
],
[
195,
196
],
[
94,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
200,
204
],
[
204,
205
],
[
199,
206
],
[
206,
207
],
[
206,
208
],
[
199,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
199,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
213,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
217,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
199,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
94,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
94,
236
],
[
236,
237
],
[
236,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
239,
243
],
[
243,
244
],
[
238,
245
],
[
245,
246
],
[
245,
247
],
[
238,
248
],
[
248,
249
],
[
248,
250
],
[
238,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
238,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
255,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
238,
267
],
[
267,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
268,
272
],
[
272,
273
],
[
272,
274
],
[
267,
275
],
[
275,
276
],
[
276,
277
],
[
238,
278
],
[
278,
279
],
[
278,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
286,
288
],
[
281,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
289,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
295,
297
],
[
281,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
300,
302
],
[
302,
303
],
[
299,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
298,
308
],
[
308,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
310,
314
],
[
298,
315
],
[
315,
316
],
[
316,
317
],
[
280,
318
],
[
318,
319
],
[
318,
320
],
[
320,
321
],
[
0,
322
],
[
322,
323
],
[
322,
324
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}\n\t\n\t// Read Class\n\tstatic class FS {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\n\t\tprivate int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}\n\t\tprivate boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}\n\t\tprivate void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t\n\t\tpublic boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t\tpublic String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}\n\t\n\t// Read Class\n\tstatic class FS {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\n\t\tprivate int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}\n\t\tprivate boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}\n\t\tprivate void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t\n\t\tpublic boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t\tpublic String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}",
"main",
"{\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}",
"FS r = new FS();",
"r",
"new FS()",
"int n = r.nextInt();",
"n",
"r.nextInt()",
"r.nextInt",
"r",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = r.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = r.nextInt();\n\t\t}",
"S[i] = r.nextInt()",
"S[i]",
"S",
"i",
"r.nextInt()",
"r.nextInt",
"r",
"int q = r.nextInt();",
"q",
"r.nextInt()",
"r.nextInt",
"r",
"int c = 0;",
"c",
"0",
"for(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}",
"{\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}",
"int t = r.nextInt();",
"t",
"r.nextInt()",
"r.nextInt",
"r",
"if(Arrays.binarySearch(S, t) >= 0) c++;",
"Arrays.binarySearch(S, t) >= 0",
"Arrays.binarySearch(S, t)",
"Arrays.binarySearch",
"Arrays",
"S",
"t",
"0",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"static class FS {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\n\t\tprivate int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}\n\t\tprivate boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}\n\t\tprivate void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t\n\t\tpublic boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t\tpublic String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}",
"FS",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"hasNextByte",
"{\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"if (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"{\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t\t\t\treturn false;\n\t\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}",
"readByte",
"{ return hasNextByte() ? buffer[ptr++] : -1;}",
"return hasNextByte() ? buffer[ptr++] : -1;",
"hasNextByte() ? buffer[ptr++] : -1",
"hasNextByte()",
"hasNextByte",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"-1",
"1",
"private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}",
"isPrintableChar",
"{return 33 <= c && c <= 126;}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}",
"skipUnprintable",
"{while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}",
"while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"public boolean hasNext() { skipUnprintable(); return hasNextByte();}",
"hasNext",
"{ skipUnprintable(); return hasNextByte();}",
"skipUnprintable()",
"skipUnprintable",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"next",
"{\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}",
"nextInt",
"{\n\t\t\treturn (int)nextLong();\n\t\t}",
"return (int)nextLong();",
"(int)nextLong()",
"nextLong",
"public long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}",
"nextLong",
"{\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}",
"true",
"{\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}\n\t\n\t// Read Class\n\tstatic class FS {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\n\t\tprivate int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}\n\t\tprivate boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}\n\t\tprivate void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t\n\t\tpublic boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t\tpublic String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFS r = new FS();\n\t\tint n = r.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tS[i] = r.nextInt();\n\t\t}\n\t\tint q = r.nextInt();\n\t\tint c = 0;\n\t\tfor(int i=0; i<q; i++) {\n\t\t\tint t = r.nextInt();\n\t\t\tif(Arrays.binarySearch(S, t) >= 0) c++;\n\t\t}\n\t\tSystem.out.println(c);\n\t}\n\t\n\t// Read Class\n\tstatic class FS {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\n\t\tprivate int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}\n\t\tprivate boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}\n\t\tprivate void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n\t\n\t\tpublic boolean hasNext() { skipUnprintable(); return hasNextByte();}\n\t\tpublic String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile(true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if(b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
FS r = new FS();
int n = r.nextInt();
int[] S = new int[n];
for(int i=0; i<n; i++) {
S[i] = r.nextInt();
}
int q = r.nextInt();
int c = 0;
for(int i=0; i<q; i++) {
int t = r.nextInt();
if(Arrays.binarySearch(S, t) >= 0) c++;
}
System.out.println(c);
}
// Read Class
static class FS {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
public boolean hasNext() { skipUnprintable(); return hasNextByte();}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public int nextInt() {
return (int)nextLong();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if(b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
4,
18,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
171,
11
],
[
171,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
38,
48
],
[
48,
49
],
[
49,
50
],
[
38,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
60,
61
],
[
60,
62
],
[
14,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
14,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
73,
78
],
[
14,
79
],
[
79,
80
],
[
79,
81
],
[
14,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
82,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
96,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
14,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
12,
114
],
[
114,
115
],
[
171,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
139,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
148,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
148,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
118,
164
],
[
164,
165
],
[
116,
166
],
[
166,
167
],
[
116,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }\n\n private static boolean binarySearch(int[] num, int key) {\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }\n\n private static boolean binarySearch(int[] num, int key) {\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }",
"main",
"{\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"String[] strings = br.readLine().split(\"\\\\s\");",
"strings",
"br.readLine().split(\"\\\\s\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s\"",
"for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<strings.length",
"i",
"strings.length",
"strings",
"strings.length",
"i++",
"i++",
"i",
"{\n num[i] = Integer.parseInt(strings[i]);\n }",
"{\n num[i] = Integer.parseInt(strings[i]);\n }",
"num[i] = Integer.parseInt(strings[i])",
"num[i]",
"num",
"i",
"Integer.parseInt(strings[i])",
"Integer.parseInt",
"Integer",
"strings[i]",
"strings",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] strs = br.readLine().split(\"\\\\s\");",
"strs",
"br.readLine().split(\"\\\\s\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s\"",
"int sum = 0;",
"sum",
"0",
"for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }",
"{\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }",
"if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }",
"binarySearch(num, Integer.parseInt(strs[i]))",
"binarySearch",
"num",
"Integer.parseInt(strs[i])",
"Integer.parseInt",
"Integer",
"strs[i]",
"strs",
"i",
"{\n sum++;\n }",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"private static boolean binarySearch(int[] num, int key) {\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }",
"binarySearch",
"{\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = num.length;",
"right",
"num.length",
"num",
"num.length",
"while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }",
"int mid = (left+right)/2;",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }",
"key == num[mid]",
"key",
"num[mid]",
"num",
"mid",
"{\n return true;\n }",
"return true;",
"true",
"if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }",
"key < num[mid]",
"key",
"num[mid]",
"num",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = mid+1;\n }",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"return false;",
"false",
"int[] num",
"num",
"int key",
"key",
"public class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }\n\n private static boolean binarySearch(int[] num, int key) {\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }\n}",
"public class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n\n int[] num = new int[n];\n String[] strings = br.readLine().split(\"\\\\s\");\n for (int i=0; i<strings.length; i++){\n num[i] = Integer.parseInt(strings[i]);\n }\n\n int q = Integer.parseInt(br.readLine());\n String[] strs = br.readLine().split(\"\\\\s\");\n int sum = 0;\n for (int i=0; i<q; i++){\n if (binarySearch(num, Integer.parseInt(strs[i]))){\n sum++;\n }\n }\n\n System.out.println(sum);\n\n }\n\n private static boolean binarySearch(int[] num, int key) {\n \n // left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?\n int left = 0;\n int right = num.length;\n \n // ?????¶???????????¶??? <\n while (left < right){\n int mid = (left+right)/2;\n if (key == num[mid]){\n return true;\n }\n else if (key < num[mid]){\n right = mid;\n }\n else {\n left = mid+1;\n }\n }\n\n return false;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] num = new int[n];
String[] strings = br.readLine().split("\\s");
for (int i=0; i<strings.length; i++){
num[i] = Integer.parseInt(strings[i]);
}
int q = Integer.parseInt(br.readLine());
String[] strs = br.readLine().split("\\s");
int sum = 0;
for (int i=0; i<q; i++){
if (binarySearch(num, Integer.parseInt(strs[i]))){
sum++;
}
}
System.out.println(sum);
}
private static boolean binarySearch(int[] num, int key) {
// left??¨???????´¢?????´?????´???????´????right??????????°?????´?????????????????´?
int left = 0;
int right = num.length;
// ?????¶???????????¶??? <
while (left < right){
int mid = (left+right)/2;
if (key == num[mid]){
return true;
}
else if (key < num[mid]){
right = mid;
}
else {
left = mid+1;
}
}
return false;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
147,
5
],
[
147,
6
],
[
6,
7
],
[
147,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
10,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
10,
48
],
[
48,
49
],
[
48,
50
],
[
10,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
10,
72
],
[
72,
73
],
[
72,
74
],
[
10,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
87,
94
],
[
94,
95
],
[
87,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
10,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
8,
144
],
[
144,
145
],
[
0,
146
],
[
146,
147
],
[
146,
148
]
] | [
"import java.util.Scanner;\npublic class Main {\nprivate static Scanner s;\n\npublic static void main(String[] args) {\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\nprivate static Scanner s;\n\npublic static void main(String[] args) {\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}\n}",
"Main",
"private static Scanner s;",
"s",
"public static void main(String[] args) {\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}",
"main",
"{\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}",
"s = new Scanner(System.in)",
"s",
"new Scanner(System.in)",
"int a = s.nextInt();",
"a",
"s.nextInt()",
"s.nextInt",
"s",
"int[] b = new int[a];",
"b",
"new int[a]",
"a",
"for(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n\t\tb[i] = s.nextInt();\n\t}",
"{\n\t\tb[i] = s.nextInt();\n\t}",
"b[i] = s.nextInt()",
"b[i]",
"b",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int c = s.nextInt();",
"c",
"s.nextInt()",
"s.nextInt",
"s",
"int[] d = new int[c];",
"d",
"new int[c]",
"c",
"for(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < c",
"i",
"c",
"i++",
"i++",
"i",
"{\n\t\td[i] = s.nextInt();\n\t}",
"{\n\t\td[i] = s.nextInt();\n\t}",
"d[i] = s.nextInt()",
"d[i]",
"d",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int count = 0;",
"count",
"0",
"for(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < c",
"i",
"c",
"i++",
"i++",
"i",
"{\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}",
"{\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}",
"int l = 0",
"l",
"0",
"r = a",
"r",
"a",
"m;",
"m",
"while(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}",
"l < r",
"l",
"r",
"{\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}",
"d[i] == b[m]",
"d[i]",
"d",
"i",
"b[m]",
"b",
"m",
"{\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}",
"count++",
"count",
"break;",
"if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}",
"d[i] < b[m]",
"d[i]",
"d",
"i",
"b[m]",
"b",
"m",
"{\n\t\t\tr = m;\n\t\t}",
"r = m",
"r",
"m",
"{\n\t\t\tl = m + 1;\n\t\t}",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\nprivate static Scanner s;\n\npublic static void main(String[] args) {\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}\n}",
"public class Main {\nprivate static Scanner s;\n\npublic static void main(String[] args) {\n\ts = new Scanner(System.in);\n\tint a = s.nextInt();\n\tint[] b = new int[a];\n\tfor(int i = 0;i < a;i++) {\n\t\tb[i] = s.nextInt();\n\t}\n\n\tint c = s.nextInt();\n\tint[] d = new int[c];\n\tfor(int i = 0;i < c;i++) {\n\t\td[i] = s.nextInt();\n\t}\n\tint count = 0;\n\n\tfor(int i = 0;i < c;i++) {\n\tint l = 0,r = a,m;\n\twhile(l < r) {\n\t\tm = (l+r)/2;\n\t\tif(d[i] == b[m]) {\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t}else if(d[i] < b[m]) {\n\t\t\tr = m;\n\t\t}else {\n\t\t\tl = m + 1;\n\t\t}\n\t}\n\t}\n\tSystem.out.println(count);\n}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
private static Scanner s;
public static void main(String[] args) {
s = new Scanner(System.in);
int a = s.nextInt();
int[] b = new int[a];
for(int i = 0;i < a;i++) {
b[i] = s.nextInt();
}
int c = s.nextInt();
int[] d = new int[c];
for(int i = 0;i < c;i++) {
d[i] = s.nextInt();
}
int count = 0;
for(int i = 0;i < c;i++) {
int l = 0,r = a,m;
while(l < r) {
m = (l+r)/2;
if(d[i] == b[m]) {
count++;
break;
}else if(d[i] < b[m]) {
r = m;
}else {
l = m + 1;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
14,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
29,
4,
13,
13,
2,
13,
17,
13,
14,
2,
13,
18,
13,
13,
30,
29,
4,
13,
13,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
29,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
18,
13,
13,
17,
2,
13,
17,
14,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
196,
17
],
[
196,
18
],
[
18,
19
],
[
196,
20
],
[
20,
21
],
[
196,
22
],
[
22,
23
],
[
196,
24
],
[
24,
25
],
[
196,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
49,
55
],
[
41,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
64,
67
],
[
64,
68
],
[
68,
69
],
[
68,
70
],
[
56,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
77,
78
],
[
78,
79
],
[
28,
80
],
[
80,
81
],
[
81,
82
],
[
26,
83
],
[
83,
84
],
[
26,
85
],
[
85,
86
],
[
26,
87
],
[
87,
88
],
[
196,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
91,
100
],
[
100,
101
],
[
100,
102
],
[
91,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
116,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
91,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
91,
129
],
[
129,
130
],
[
129,
131
],
[
91,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
133,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
151,
152
],
[
91,
153
],
[
153,
154
],
[
153,
155
],
[
91,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
161,
163
],
[
156,
164
],
[
164,
165
],
[
165,
166
],
[
156,
167
],
[
168,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
171,
177
],
[
177,
178
],
[
177,
179
],
[
168,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
185,
186
],
[
91,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
89,
193
],
[
193,
194
],
[
0,
195
],
[
195,
196
],
[
195,
197
]
] | [
"import java.util.Scanner;\nimport java.util.ArrayList;\nimport java.lang.Integer;\nimport java.lang.StringBuilder;\nimport java.lang.Math;\n\npublic class Main {\n private static int N;\n private static int[] S;\n private static int Q;\n private static int[] C;\n\n private static int binarySearch(int v, int low, int high) {\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.lang.Integer;",
"Integer",
"java.lang",
"import java.lang.StringBuilder;",
"StringBuilder",
"java.lang",
"import java.lang.Math;",
"Math",
"java.lang",
"public class Main {\n private static int N;\n private static int[] S;\n private static int Q;\n private static int[] C;\n\n private static int binarySearch(int v, int low, int high) {\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }\n}",
"Main",
"private static int N;",
"N",
"private static int[] S;",
"S",
"private static int Q;",
"Q",
"private static int[] C;",
"C",
"private static int binarySearch(int v, int low, int high) {\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }",
"binarySearch",
"{\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }",
"if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }",
"low <= high",
"low",
"high",
"{\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }",
"int mid = (low + high) / 2;",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }",
"v > S[mid]",
"v",
"S[mid]",
"S",
"mid",
"{\n return binarySearch(v, mid + 1, high);\n }",
"return binarySearch(v, mid + 1, high);",
"binarySearch(v, mid + 1, high)",
"binarySearch",
"v",
"mid + 1",
"mid",
"1",
"high",
"if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }",
"v < S[mid]",
"v",
"S[mid]",
"S",
"mid",
"{\n return binarySearch(v, low, mid - 1);\n }",
"return binarySearch(v, low, mid - 1);",
"binarySearch(v, low, mid - 1)",
"binarySearch",
"v",
"low",
"mid - 1",
"mid",
"1",
"if (v == S[mid]) {\n return v;\n }",
"v == S[mid]",
"v",
"S[mid]",
"S",
"mid",
"{\n return v;\n }",
"return v;",
"v",
"return -1;",
"-1",
"1",
"int v",
"v",
"int low",
"low",
"int high",
"high",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"N = in.nextInt()",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"S = new int[N]",
"S",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n S[i] = in.nextInt();\n }",
"{\n S[i] = in.nextInt();\n }",
"S[i] = in.nextInt()",
"S[i]",
"S",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"Q = in.nextInt()",
"Q",
"in.nextInt()",
"in.nextInt",
"in",
"C = new int[N]",
"C",
"new int[N]",
"N",
"for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < Q",
"i",
"Q",
"i++",
"i++",
"i",
"{\n C[i] = in.nextInt();\n }",
"{\n C[i] = in.nextInt();\n }",
"C[i] = in.nextInt()",
"C[i]",
"C",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < Q",
"i",
"Q",
"i++",
"i++",
"i",
"{\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }",
"{\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }",
"int ret = binarySearch(C[i], 0, N - 1);",
"ret",
"binarySearch(C[i], 0, N - 1)",
"binarySearch",
"C[i]",
"C",
"i",
"0",
"N - 1",
"N",
"1",
"if (ret >= 0) {\n cnt++;\n }",
"ret >= 0",
"ret",
"0",
"{\n cnt++;\n }",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n private static int N;\n private static int[] S;\n private static int Q;\n private static int[] C;\n\n private static int binarySearch(int v, int low, int high) {\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }\n}",
"public class Main {\n private static int N;\n private static int[] S;\n private static int Q;\n private static int[] C;\n\n private static int binarySearch(int v, int low, int high) {\n if (low <= high) {\n int mid = (low + high) / 2;\n if (v > S[mid]) {\n return binarySearch(v, mid + 1, high);\n } else if (v < S[mid]){\n return binarySearch(v, low, mid - 1);\n } else if (v == S[mid]) {\n return v;\n }\n }\n return -1;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n N = in.nextInt();\n S = new int[N];\n for (int i = 0; i < N; i++) {\n S[i] = in.nextInt();\n }\n\n Q = in.nextInt();\n C = new int[N];\n for (int i = 0; i < Q; i++) {\n C[i] = in.nextInt();\n }\n\n int cnt = 0;\n for (int i = 0; i < Q; i++) {\n int ret = binarySearch(C[i], 0, N - 1);\n if (ret >= 0) {\n cnt++;\n }\n }\n\n System.out.println(cnt);\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.ArrayList;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;
public class Main {
private static int N;
private static int[] S;
private static int Q;
private static int[] C;
private static int binarySearch(int v, int low, int high) {
if (low <= high) {
int mid = (low + high) / 2;
if (v > S[mid]) {
return binarySearch(v, mid + 1, high);
} else if (v < S[mid]){
return binarySearch(v, low, mid - 1);
} else if (v == S[mid]) {
return v;
}
}
return -1;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
N = in.nextInt();
S = new int[N];
for (int i = 0; i < N; i++) {
S[i] = in.nextInt();
}
Q = in.nextInt();
C = new int[N];
for (int i = 0; i < Q; i++) {
C[i] = in.nextInt();
}
int cnt = 0;
for (int i = 0; i < Q; i++) {
int ret = binarySearch(C[i], 0, N - 1);
if (ret >= 0) {
cnt++;
}
}
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
0,
18,
13,
2,
18,
13,
13,
17,
13,
42,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
2,
18,
13,
13,
17,
30,
29,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
148,
5
],
[
148,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
8,
72
],
[
72,
73
],
[
72,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
75,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
88,
95
],
[
95,
96
],
[
96,
97
],
[
8,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
6,
104
],
[
104,
105
],
[
148,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
112,
120
],
[
108,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
108,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
108,
141
],
[
141,
142
],
[
106,
143
],
[
143,
144
],
[
106,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean LinearSearch(int[] a, int key) {\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean LinearSearch(int[] a, int key) {\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] s = new int[n + 1];",
"s",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = scanner.nextInt();\n }",
"{\n s[i] = scanner.nextInt();\n }",
"s[i] = scanner.nextInt()",
"s[i]",
"s",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = scanner.nextInt();\n }",
"{\n t[i] = scanner.nextInt();\n }",
"t[i] = scanner.nextInt()",
"t[i]",
"t",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }",
"{\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }",
"if (LinearSearch(s, t[i])) {\n count++;\n }",
"LinearSearch(s, t[i])",
"LinearSearch",
"s",
"t[i]",
"t",
"i",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static boolean LinearSearch(int[] a, int key) {\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }",
"LinearSearch",
"{\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }",
"int i = 0;",
"i",
"0",
"a[a.length - 1] = key",
"a[a.length - 1]",
"a",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"key",
"while (a[i] != key) {\n i++;\n }",
"a[i] != key",
"a[i]",
"a",
"i",
"key",
"{\n i++;\n }",
"i++",
"i",
"if (i == a.length - 1) {\n return false;\n }",
"i == a.length - 1",
"i",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"{\n return false;\n }",
"return false;",
"false",
"return true;",
"true",
"int[] a",
"a",
"int key",
"key",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean LinearSearch(int[] a, int key) {\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n int count = 0;\n for (int i = 0; i < q; i++) {\n if (LinearSearch(s, t[i])) {\n count++;\n }\n }\n System.out.println(count);\n }\n\n static boolean LinearSearch(int[] a, int key) {\n int i = 0;\n a[a.length - 1] = key;\n while (a[i] != key) {\n i++;\n }\n if (i == a.length - 1) {\n return false;\n }\n return true;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] s = new int[n + 1];
for (int i = 0; i < n; i++) {
s[i] = scanner.nextInt();
}
int q = scanner.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = scanner.nextInt();
}
int count = 0;
for (int i = 0; i < q; i++) {
if (LinearSearch(s, t[i])) {
count++;
}
}
System.out.println(count);
}
static boolean LinearSearch(int[] a, int key) {
int i = 0;
a[a.length - 1] = key;
while (a[i] != key) {
i++;
}
if (i == a.length - 1) {
return false;
}
return true;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
29,
17,
23,
13,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
169,
8
],
[
169,
9
],
[
9,
10
],
[
169,
11
],
[
11,
12
],
[
169,
13
],
[
13,
14
],
[
169,
15
],
[
15,
16
],
[
169,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
19,
28
],
[
28,
29
],
[
28,
30
],
[
19,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
19,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
19,
56
],
[
56,
57
],
[
56,
58
],
[
19,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
19,
79
],
[
79,
80
],
[
79,
81
],
[
19,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
82,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
19,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
169,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
111,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
132,
138
],
[
138,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
140,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
140,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
111,
156
],
[
156,
157
],
[
109,
158
],
[
158,
159
],
[
169,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
160,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tint n, q;\n\tint[] s, t;\n\tvoid run() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tboolean binarySearch(int val) {\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tint n, q;\n\tint[] s, t;\n\tvoid run() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tboolean binarySearch(int val) {\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main",
"int n",
"n",
"q;",
"q",
"int[] s",
"s",
"t;",
"t",
"void run() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"run",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"s = new int[n]",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"s[i] = scan.nextInt();",
"s[i] = scan.nextInt()",
"s[i]",
"s",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"q = scan.nextInt()",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"t = new int[q]",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"t[i] = scan.nextInt();",
"t[i] = scan.nextInt()",
"t[i]",
"t",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}",
"{\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}",
"if (binarySearch(t[i]))\n\t\t\t\tans++;",
"binarySearch(t[i])",
"binarySearch",
"t[i]",
"t",
"i",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"boolean binarySearch(int val) {\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}",
"int low = 0;",
"low",
"0",
"int high = n - 1;",
"high",
"n - 1",
"n",
"1",
"while (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}",
"low <= high",
"low",
"high",
"{\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}",
"int mid = (low + high) / 2;",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"if (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;",
"s[mid] == val",
"s[mid]",
"s",
"mid",
"val",
"return true;",
"true",
"if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;",
"s[mid] > val",
"s[mid]",
"s",
"mid",
"val",
"high = mid - 1",
"high",
"mid - 1",
"mid",
"1",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int val",
"val",
"public static void main(String[] args) {\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"public class Main {\n\tint n, q;\n\tint[] s, t;\n\tvoid run() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tboolean binarySearch(int val) {\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"public class Main {\n\tint n, q;\n\tint[] s, t;\n\tvoid run() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\ts = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ts[i] = scan.nextInt();\n\t\tq = scan.nextInt();\n\t\tt = new int[q];\n\t\tfor (int i = 0; i < q; i++)\n\t\t\tt[i] = scan.nextInt();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarySearch(t[i]))\n\t\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tboolean binarySearch(int val) {\n\t\tint low = 0;\n\t\tint high = n - 1;\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (s[mid] == val)\n\t\t\t\treturn true;\n\t\t\telse if (s[mid] > val)\n\t\t\t\thigh = mid - 1;\n\t\t\telse\n\t\t\t\tlow = mid + 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
int n, q;
int[] s, t;
void run() {
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
s = new int[n];
for (int i = 0; i < n; i++)
s[i] = scan.nextInt();
q = scan.nextInt();
t = new int[q];
for (int i = 0; i < q; i++)
t[i] = scan.nextInt();
int ans = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(t[i]))
ans++;
}
System.out.println(ans);
}
boolean binarySearch(int val) {
int low = 0;
int high = n - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (s[mid] == val)
return true;
else if (s[mid] > val)
high = mid - 1;
else
low = mid + 1;
}
return false;
}
public static void main(String[] args) {
new Main().run();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
13,
41,
13,
4,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
13,
17,
40,
13,
4,
18,
13,
13,
12,
13,
30,
0,
13,
20,
4,
18,
20,
4,
18,
13,
23,
13,
12,
13,
30,
4,
18,
13,
13,
29,
18,
13,
2,
18,
13,
13,
17,
23,
13,
12,
13,
30,
4,
18,
13,
13,
29,
18,
13,
17,
23,
13,
12,
13,
30,
41,
13,
2,
4,
18,
13,
2,
13,
13,
4,
18,
13,
2,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
2,
2,
2,
13,
13,
2,
13,
13,
2,
2,
13,
13,
2,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
2,
13,
17,
2,
2,
13,
17,
17,
29,
17,
41,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
30,
14,
2,
2,
13,
13,
17,
30,
29,
17,
29,
17,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
18,
18,
13,
17,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
17,
29,
17,
12,
13,
30,
14,
2,
4,
13,
17,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
37,
20,
41,
13,
17,
42,
4,
13,
13,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
41,
13,
20,
8,
13,
2,
13,
17,
13,
8,
13,
2,
13,
17,
13,
11,
1,
41,
13,
8,
13,
17,
17,
2,
13,
8,
13,
2,
13,
17,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
8,
13,
2,
13,
17,
13,
4,
18,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
7,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
13,
15
],
[
7,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
18,
20
],
[
7,
21
],
[
21,
22
],
[
21,
23
],
[
7,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
7,
29
],
[
29,
30
],
[
29,
31
],
[
7,
33
],
[
33,
34
],
[
33,
35
],
[
7,
36
],
[
36,
37
],
[
36,
38
],
[
7,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
41,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
41,
55
],
[
55,
56
],
[
55,
57
],
[
41,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
73,
77
],
[
77,
78
],
[
72,
79
],
[
71,
80
],
[
80,
81
],
[
41,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
7,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
88,
95
],
[
95,
96
],
[
96,
97
],
[
86,
98
],
[
98,
99
],
[
7,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
102,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
100,
115
],
[
115,
116
],
[
7,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
119,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
117,
128
],
[
128,
129
],
[
7,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
139,
141
],
[
135,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
145,
147
],
[
132,
148
],
[
148,
149
],
[
130,
150
],
[
150,
151
],
[
130,
152
],
[
152,
153
],
[
130,
154
],
[
154,
155
],
[
130,
156
],
[
156,
157
],
[
7,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
166,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
178,
179
],
[
178,
180
],
[
160,
181
],
[
181,
182
],
[
158,
183
],
[
183,
184
],
[
158,
185
],
[
185,
186
],
[
158,
187
],
[
187,
188
],
[
158,
189
],
[
189,
190
],
[
7,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
198,
199
],
[
193,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
200,
210
],
[
210,
211
],
[
193,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
214,
217
],
[
193,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
218,
223
],
[
223,
224
],
[
223,
225
],
[
218,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
218,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
231,
237
],
[
237,
238
],
[
238,
239
],
[
193,
240
],
[
240,
241
],
[
191,
242
],
[
242,
243
],
[
7,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
247,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
254,
256
],
[
247,
257
],
[
257,
258
],
[
258,
259
],
[
247,
260
],
[
261,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
262,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
262,
274
],
[
274,
275
],
[
275,
276
],
[
262,
277
],
[
278,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
279,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
261,
287
],
[
287,
288
],
[
288,
289
],
[
244,
290
],
[
290,
291
],
[
7,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
295,
299
],
[
299,
300
],
[
295,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
301,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
308,
309
],
[
309,
310
],
[
310,
311
],
[
305,
312
],
[
312,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
315,
318
],
[
301,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
319,
323
],
[
323,
324
],
[
294,
325
],
[
325,
326
],
[
7,
327
],
[
327,
328
],
[
327,
329
],
[
329,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
331,
334
],
[
330,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
338,
339
],
[
329,
340
],
[
340,
341
],
[
341,
342
],
[
7,
343
],
[
343,
344
],
[
343,
345
],
[
345,
346
],
[
346,
347
],
[
347,
348
],
[
348,
349
],
[
348,
350
],
[
347,
351
],
[
351,
352
],
[
351,
353
],
[
343,
354
],
[
354,
355
],
[
7,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
359,
360
],
[
360,
361
],
[
361,
362
],
[
360,
363
],
[
363,
364
],
[
364,
365
],
[
364,
366
],
[
366,
367
],
[
366,
368
],
[
359,
369
],
[
369,
370
],
[
7,
371
],
[
371,
372
],
[
371,
373
],
[
373,
374
],
[
374,
375
],
[
373,
376
],
[
376,
377
],
[
377,
378
],
[
7,
379
],
[
379,
380
],
[
379,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
384,
385
],
[
382,
386
],
[
386,
387
],
[
381,
388
],
[
388,
389
],
[
388,
390
],
[
381,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
381,
395
],
[
395,
396
],
[
396,
397
],
[
396,
398
],
[
395,
399
],
[
399,
400
],
[
400,
401
],
[
401,
402
],
[
400,
403
],
[
399,
404
],
[
404,
405
],
[
404,
406
],
[
406,
407
],
[
381,
408
],
[
408,
409
],
[
409,
410
],
[
410,
411
],
[
7,
412
],
[
412,
413
],
[
412,
414
],
[
414,
415
],
[
415,
416
],
[
415,
417
],
[
414,
419
],
[
419,
420
],
[
420,
421
],
[
421,
422
],
[
421,
423
],
[
419,
424
],
[
424,
425
],
[
424,
426
],
[
419,
427
],
[
427,
428
],
[
428,
429
],
[
419,
430
],
[
430,
431
],
[
431,
432
],
[
432,
433
],
[
432,
434
],
[
431,
435
],
[
435,
436
],
[
414,
437
],
[
437,
438
],
[
412,
439
],
[
439,
440
],
[
7,
441
],
[
441,
442
],
[
441,
443
],
[
443,
444
],
[
444,
445
],
[
445,
446
],
[
446,
447
],
[
445,
448
],
[
448,
449
],
[
7,
450
],
[
450,
451
],
[
450,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
452,
457
],
[
457,
458
],
[
458,
459
],
[
459,
460
],
[
459,
461
],
[
457,
462
],
[
462,
463
],
[
462,
464
],
[
457,
465
],
[
465,
466
],
[
466,
467
],
[
457,
468
],
[
468,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
469,
473
],
[
473,
474
],
[
452,
475
],
[
475,
476
],
[
450,
477
],
[
477,
478
],
[
7,
479
],
[
479,
480
],
[
479,
481
],
[
481,
482
],
[
482,
483
],
[
483,
484
],
[
484,
485
],
[
482,
486
],
[
486,
487
],
[
481,
488
],
[
488,
489
],
[
488,
490
],
[
481,
491
],
[
491,
492
],
[
491,
493
],
[
493,
494
],
[
481,
495
],
[
495,
496
],
[
496,
497
],
[
496,
498
],
[
495,
499
],
[
499,
500
],
[
500,
501
],
[
500,
502
],
[
499,
503
],
[
503,
504
],
[
503,
505
],
[
505,
506
],
[
481,
507
],
[
507,
508
],
[
508,
509
],
[
509,
510
],
[
509,
511
],
[
508,
512
],
[
512,
513
],
[
512,
514
],
[
507,
515
],
[
515,
516
],
[
481,
517
],
[
517,
518
],
[
517,
519
],
[
481,
520
],
[
520,
521
],
[
521,
522
],
[
521,
523
],
[
520,
524
],
[
524,
525
],
[
525,
526
],
[
526,
527
],
[
527,
528
],
[
527,
529
],
[
526,
530
],
[
530,
531
],
[
530,
532
],
[
525,
533
],
[
533,
534
],
[
534,
535
],
[
534,
536
],
[
533,
537
],
[
537,
538
],
[
537,
539
],
[
539,
540
],
[
539,
541
],
[
524,
542
],
[
542,
543
],
[
542,
544
],
[
544,
545
],
[
481,
546
],
[
546,
547
],
[
547,
548
],
[
547,
549
],
[
549,
550
],
[
547,
551
],
[
7,
552
],
[
552,
553
],
[
552,
554
],
[
554,
555
],
[
555,
556
],
[
555,
557
],
[
558,
559
],
[
558,
560
],
[
560,
561
],
[
560,
562
],
[
558,
563
],
[
564,
565
],
[
564,
566
],
[
566,
567
],
[
566,
568
],
[
564,
569
],
[
554,
570
],
[
570,
571
],
[
571,
572
],
[
572,
573
],
[
572,
574
],
[
574,
575
],
[
574,
576
],
[
574,
577
],
[
570,
578
],
[
578,
579
],
[
578,
580
],
[
580,
581
],
[
580,
582
],
[
582,
583
],
[
582,
584
],
[
580,
585
],
[
570,
586
],
[
586,
587
],
[
587,
588
],
[
570,
589
],
[
590,
590
],
[
590,
591
],
[
591,
592
],
[
591,
593
],
[
593,
594
],
[
590,
595
],
[
595,
596
],
[
596,
597
],
[
597,
598
],
[
597,
599
],
[
595,
600
],
[
600,
601
],
[
600,
602
],
[
595,
603
],
[
603,
604
],
[
604,
605
],
[
595,
606
],
[
607,
607
],
[
607,
608
],
[
608,
609
],
[
609,
610
],
[
610,
611
],
[
610,
612
],
[
609,
613
],
[
613,
614
],
[
613,
615
],
[
615,
616
],
[
615,
617
],
[
613,
618
],
[
608,
619
],
[
619,
620
],
[
620,
621
],
[
619,
622
],
[
554,
623
],
[
623,
624
],
[
552,
625
],
[
625,
626
],
[
552,
627
],
[
627,
628
],
[
552,
629
],
[
629,
630
]
] | [
"import java.util.*;\nimport java.io.*;\n\nclass Main {\n\tvoid solve () {\n\t\t\n\t\tint n = nextInt();\n\t\tint[] A = nextIntArray(n);\n\t\t\n\t\tint m = nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}\n\t\t\n\t\tout.println(ans);\n\t\t\n\t\t\n\t}\n\n\n\t// <Main Method>\n\tpublic static PrintWriter out;\n\tpublic static void main(String[] args) {\n\t\tout = new PrintWriter(System.out);\n\t\tnew Main().solve();\n\t\tout.flush();\n\t}\n\n\t// <Default Field>\n\tstatic int maxInt = Integer.MAX_VALUE, minInt = Integer.MIN_VALUE;\n\tstatic int mod = 1000000007;\n\n\t// <Default Method>\n\tstatic int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}\n\tstatic int min (int... ar) {Arrays.sort(ar);return ar[0];}\n\tstatic int calcManhatDistance (int x1, int y1, int x2, int y2) {\n\t\tint d = Math.abs(x1-x2)+Math.abs(y1-y2);\n\t\treturn d;\n\t}\n\tstatic double calcEuclidDistance (double x1, double y1, double x2, double y2) {\n\t\tdouble d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\t\treturn d;\n\t}\n\tstatic boolean isPrime (int n) {\n\t\tif (n==2) return true;\n\t\tif (n<2 || n%2==0) return false;\n\t\tdouble d = Math.sqrt(n);\n\t\tfor (int i=3; i<=d; i+=2) if(n%i==0){return false;}\n\t\treturn true;\n\t}\n\tstatic void printChar2DArray (char[][] ar) {\n\t\tfor (int i=0; i<ar.length; i++) {\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t}\n\n\t// <Fast Scanner> START -------------------------------------------------\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static String[] nextStringArray (int n) {\n\t\tString[] ar = new String[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = next();\n\t\treturn ar;\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextIntArray (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n\tpublic static char[][] nextChar2DArray (int h, int w, boolean b) {\n\t\t//b(番兵)がtrueなら配列を余計に確保する\n\t\tchar[][] ar = new char[b?h+2:h][b?w+2:h];\n\t\tfor (int i=b?1:0; i<(b?h+1:h); i++) {\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}\n\t\treturn ar;\n\t}\n\t// <Fast Scanner> END ----------------------------------------------------------\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main {\n\tvoid solve () {\n\t\t\n\t\tint n = nextInt();\n\t\tint[] A = nextIntArray(n);\n\t\t\n\t\tint m = nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}\n\t\t\n\t\tout.println(ans);\n\t\t\n\t\t\n\t}\n\n\n\t// <Main Method>\n\tpublic static PrintWriter out;\n\tpublic static void main(String[] args) {\n\t\tout = new PrintWriter(System.out);\n\t\tnew Main().solve();\n\t\tout.flush();\n\t}\n\n\t// <Default Field>\n\tstatic int maxInt = Integer.MAX_VALUE, minInt = Integer.MIN_VALUE;\n\tstatic int mod = 1000000007;\n\n\t// <Default Method>\n\tstatic int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}\n\tstatic int min (int... ar) {Arrays.sort(ar);return ar[0];}\n\tstatic int calcManhatDistance (int x1, int y1, int x2, int y2) {\n\t\tint d = Math.abs(x1-x2)+Math.abs(y1-y2);\n\t\treturn d;\n\t}\n\tstatic double calcEuclidDistance (double x1, double y1, double x2, double y2) {\n\t\tdouble d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\t\treturn d;\n\t}\n\tstatic boolean isPrime (int n) {\n\t\tif (n==2) return true;\n\t\tif (n<2 || n%2==0) return false;\n\t\tdouble d = Math.sqrt(n);\n\t\tfor (int i=3; i<=d; i+=2) if(n%i==0){return false;}\n\t\treturn true;\n\t}\n\tstatic void printChar2DArray (char[][] ar) {\n\t\tfor (int i=0; i<ar.length; i++) {\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t}\n\n\t// <Fast Scanner> START -------------------------------------------------\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static String[] nextStringArray (int n) {\n\t\tString[] ar = new String[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = next();\n\t\treturn ar;\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextIntArray (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}\n\tpublic static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}\n\tpublic static char[][] nextChar2DArray (int h, int w, boolean b) {\n\t\t//b(番兵)がtrueなら配列を余計に確保する\n\t\tchar[][] ar = new char[b?h+2:h][b?w+2:h];\n\t\tfor (int i=b?1:0; i<(b?h+1:h); i++) {\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}\n\t\treturn ar;\n\t}\n\t// <Fast Scanner> END ----------------------------------------------------------\n}",
"Main",
"// <Main Method>\n\tpublic static PrintWriter out;",
"out",
"// <Default Field>\n\tstatic int maxInt = Integer.MAX_VALUE",
"maxInt",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"minInt = Integer.MIN_VALUE;",
"minInt",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"static int mod = 1000000007;",
"mod",
"1000000007",
"// <Fast Scanner> START -------------------------------------------------\n\tstatic InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"static byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"static int length = 0",
"length",
"0",
"p = 0;",
"p",
"0",
"void solve () {\n\t\t\n\t\tint n = nextInt();\n\t\tint[] A = nextIntArray(n);\n\t\t\n\t\tint m = nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}\n\t\t\n\t\tout.println(ans);\n\t\t\n\t\t\n\t}",
"solve",
"{\n\t\t\n\t\tint n = nextInt();\n\t\tint[] A = nextIntArray(n);\n\t\t\n\t\tint m = nextInt();\n\t\tint ans = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}\n\t\t\n\t\tout.println(ans);\n\t\t\n\t\t\n\t}",
"int n = nextInt();",
"n",
"nextInt()",
"nextInt",
"int[] A = nextIntArray(n);",
"A",
"nextIntArray(n)",
"nextIntArray",
"n",
"int m = nextInt();",
"m",
"nextInt()",
"nextInt",
"int ans = 0;",
"ans",
"0",
"for (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}",
"{\n\t\t\tif (Arrays.binarySearch(A, nextInt()) >= 0) ans++;\n\t\t}",
"if (Arrays.binarySearch(A, nextInt()) >= 0) ans++;",
"Arrays.binarySearch(A, nextInt()) >= 0",
"Arrays.binarySearch(A, nextInt())",
"Arrays.binarySearch",
"Arrays",
"A",
"nextInt()",
"nextInt",
"0",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"public static void main(String[] args) {\n\t\tout = new PrintWriter(System.out);\n\t\tnew Main().solve();\n\t\tout.flush();\n\t}",
"main",
"{\n\t\tout = new PrintWriter(System.out);\n\t\tnew Main().solve();\n\t\tout.flush();\n\t}",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"new Main().solve()",
"new Main().solve",
"new Main()",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"// <Default Method>\n\tstatic int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}",
"max",
"{Arrays.sort(ar);return ar[ar.length-1];}",
"Arrays.sort(ar)",
"Arrays.sort",
"Arrays",
"ar",
"return ar[ar.length-1];",
"ar[ar.length-1]",
"ar",
"ar.length-1",
"ar.length",
"ar",
"ar.length",
"1",
"int... ar",
"ar",
"static int min (int... ar) {Arrays.sort(ar);return ar[0];}",
"min",
"{Arrays.sort(ar);return ar[0];}",
"Arrays.sort(ar)",
"Arrays.sort",
"Arrays",
"ar",
"return ar[0];",
"ar[0]",
"ar",
"0",
"int... ar",
"ar",
"static int calcManhatDistance (int x1, int y1, int x2, int y2) {\n\t\tint d = Math.abs(x1-x2)+Math.abs(y1-y2);\n\t\treturn d;\n\t}",
"calcManhatDistance",
"{\n\t\tint d = Math.abs(x1-x2)+Math.abs(y1-y2);\n\t\treturn d;\n\t}",
"int d = Math.abs(x1-x2)+Math.abs(y1-y2);",
"d",
"Math.abs(x1-x2)+Math.abs(y1-y2)",
"Math.abs(x1-x2)",
"Math.abs",
"Math",
"x1-x2",
"x1",
"x2",
"Math.abs(y1-y2)",
"Math.abs",
"Math",
"y1-y2",
"y1",
"y2",
"return d;",
"d",
"int x1",
"x1",
"int y1",
"y1",
"int x2",
"x2",
"int y2",
"y2",
"static double calcEuclidDistance (double x1, double y1, double x2, double y2) {\n\t\tdouble d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\t\treturn d;\n\t}",
"calcEuclidDistance",
"{\n\t\tdouble d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n\t\treturn d;\n\t}",
"double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));",
"d",
"Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))",
"Math.sqrt",
"Math",
"(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)",
"(x2-x1)*(x2-x1)",
"(x2-x1)",
"x2",
"x1",
"(x2-x1)",
"x2",
"x1",
"(y2-y1)*(y2-y1)",
"(y2-y1)",
"y2",
"y1",
"(y2-y1)",
"y2",
"y1",
"return d;",
"d",
"double x1",
"x1",
"double y1",
"y1",
"double x2",
"x2",
"double y2",
"y2",
"static boolean isPrime (int n) {\n\t\tif (n==2) return true;\n\t\tif (n<2 || n%2==0) return false;\n\t\tdouble d = Math.sqrt(n);\n\t\tfor (int i=3; i<=d; i+=2) if(n%i==0){return false;}\n\t\treturn true;\n\t}",
"isPrime",
"{\n\t\tif (n==2) return true;\n\t\tif (n<2 || n%2==0) return false;\n\t\tdouble d = Math.sqrt(n);\n\t\tfor (int i=3; i<=d; i+=2) if(n%i==0){return false;}\n\t\treturn true;\n\t}",
"if (n==2) return true;",
"n==2",
"n",
"2",
"return true;",
"true",
"if (n<2 || n%2==0) return false;",
"n<2 || n%2==0",
"n<2",
"n",
"2",
"n%2==0",
"n%2",
"n",
"2",
"0",
"return false;",
"false",
"double d = Math.sqrt(n);",
"d",
"Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"for (int i=3; i<=d; i+=2) if(n%i==0){return false;}",
"int i=3;",
"int i=3;",
"i",
"3",
"i<=d",
"i",
"d",
"i+=2",
"i+=2",
"i",
"2",
"if(n%i==0){return false;}",
"if(n%i==0){return false;}",
"n%i==0",
"n%i",
"n",
"i",
"0",
"{return false;}",
"return false;",
"false",
"return true;",
"true",
"int n",
"n",
"static void printChar2DArray (char[][] ar) {\n\t\tfor (int i=0; i<ar.length; i++) {\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t}",
"printChar2DArray",
"{\n\t\tfor (int i=0; i<ar.length; i++) {\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t}",
"for (int i=0; i<ar.length; i++) {\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ar.length",
"i",
"ar.length",
"ar",
"ar.length",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}",
"{\n\t\t\tfor (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}",
"for (int j=0; j<ar[0].length; j++) {\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<ar[0].length",
"j",
"ar[0].length",
"ar[0]",
"ar",
"0",
"ar[0].length",
"j++",
"j++",
"j",
"{\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}",
"{\n\t\t\t\tout.print(ar[i][j]);\n\t\t\t}",
"out.print(ar[i][j])",
"out.print",
"out",
"ar[i][j]",
"ar[i]",
"ar",
"i",
"j",
"out.println()",
"out.println",
"out",
"char[][] ar",
"ar",
"public static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}",
"if (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}",
"p < length",
"p",
"length",
"return true;",
"true",
"{\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}",
"p = 0",
"p",
"0",
"try {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}",
"catch (Exception e) {e.printStackTrace();}",
"Exception e",
"{e.printStackTrace();}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{length = in.read(buffer);}",
"length = in.read(buffer)",
"length",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (length == 0) return false;",
"length == 0",
"length",
"0",
"return false;",
"false",
"return true;",
"true",
"public static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}",
"readByte",
"{\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}",
"if (hasNextByte() == true) return buffer[p++];",
"hasNextByte() == true",
"hasNextByte()",
"hasNextByte",
"true",
"return buffer[p++];",
"buffer[p++]",
"buffer",
"p++",
"p",
"return -1;",
"-1",
"1",
"public static boolean isPrintable (int n) {return 33<=n&&n<=126;}",
"isPrintable",
"{return 33<=n&&n<=126;}",
"return 33<=n&&n<=126;",
"33<=n&&n<=126",
"33<=n",
"33",
"n",
"n<=126",
"n",
"126",
"int n",
"n",
"public static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}",
"skip",
"{\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}",
"while (hasNextByte() && !isPrintable(buffer[p])) p++;",
"hasNextByte() && !isPrintable(buffer[p])",
"hasNextByte()",
"hasNextByte",
"!isPrintable(buffer[p])",
"isPrintable(buffer[p])",
"isPrintable",
"buffer[p]",
"buffer",
"p",
"p++",
"p",
"public static boolean hasNext () {skip(); return hasNextByte();}",
"hasNext",
"{skip(); return hasNextByte();}",
"skip()",
"skip",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int temp = readByte();",
"temp",
"readByte()",
"readByte",
"while (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}",
"isPrintable(temp)",
"isPrintable",
"temp",
"{\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}",
"sb.appendCodePoint(temp)",
"sb.appendCodePoint",
"sb",
"temp",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public static String[] nextStringArray (int n) {\n\t\tString[] ar = new String[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = next();\n\t\treturn ar;\n\t}",
"nextStringArray",
"{\n\t\tString[] ar = new String[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = next();\n\t\treturn ar;\n\t}",
"String[] ar = new String[n];",
"ar",
"new String[n]",
"n",
"for (int i=0; i<n; i++) ar[i] = next();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"ar[i] = next();",
"ar[i] = next()",
"ar[i]",
"ar",
"i",
"next()",
"next",
"return ar;",
"ar",
"int n",
"n",
"public static int nextInt () {return Math.toIntExact(nextLong());}",
"nextInt",
"{return Math.toIntExact(nextLong());}",
"return Math.toIntExact(nextLong());",
"Math.toIntExact(nextLong())",
"Math.toIntExact",
"Math",
"nextLong()",
"nextLong",
"public static int[] nextIntArray (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}",
"nextIntArray",
"{\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) ar[i] = nextInt();\n\t\treturn ar;\n\t}",
"int[] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for (int i=0; i<n; i++) ar[i] = nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"ar[i] = nextInt();",
"ar[i] = nextInt()",
"ar[i]",
"ar",
"i",
"nextInt()",
"nextInt",
"return ar;",
"ar",
"int n",
"n",
"public static long nextLong () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tboolean minus = false;\n\t\tint temp = readByte();\n\t\tif (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}\n\t\tif (temp<'0' || '9'<temp) throw new NumberFormatException();\n\t\tlong n = 0;\n\t\twhile (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn minus? -n : n;\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"boolean minus = false;",
"minus",
"false",
"int temp = readByte();",
"temp",
"readByte()",
"readByte",
"if (temp == '-') {\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}",
"temp == '-'",
"temp",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\ttemp = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"if (temp<'0' || '9'<temp) throw new NumberFormatException();",
"temp<'0' || '9'<temp",
"temp<'0'",
"temp",
"'0'",
"'9'<temp",
"'9'",
"temp",
"throw new NumberFormatException();",
"new NumberFormatException()",
"long n = 0;",
"n",
"0",
"while (isPrintable(temp)) {\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}",
"isPrintable(temp)",
"isPrintable",
"temp",
"{\n\t\t\tif ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}\n\t\t\ttemp = readByte();\n\t\t}",
"if ('0'<=temp && temp<='9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}",
"'0'<=temp && temp<='9'",
"'0'<=temp",
"'0'",
"temp",
"temp<='9'",
"temp",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += temp - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += temp - '0'",
"n",
"temp - '0'",
"temp",
"'0'",
"temp = readByte()",
"temp",
"readByte()",
"readByte",
"return minus? -n : n;",
"minus? -n : n",
"minus",
"-n",
"n",
"n",
"public static char[][] nextChar2DArray (int h, int w, boolean b) {\n\t\t//b(番兵)がtrueなら配列を余計に確保する\n\t\tchar[][] ar = new char[b?h+2:h][b?w+2:h];\n\t\tfor (int i=b?1:0; i<(b?h+1:h); i++) {\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}\n\t\treturn ar;\n\t}",
"nextChar2DArray",
"{\n\t\t//b(番兵)がtrueなら配列を余計に確保する\n\t\tchar[][] ar = new char[b?h+2:h][b?w+2:h];\n\t\tfor (int i=b?1:0; i<(b?h+1:h); i++) {\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}\n\t\treturn ar;\n\t}",
"char[][] ar = new char[b?h+2:h][b?w+2:h];",
"ar",
"new char[b?h+2:h][b?w+2:h]",
"b?h+2:h",
"b",
"h+2",
"h",
"2",
"h",
"b?w+2:h",
"b",
"w+2",
"w",
"2",
"h",
"for (int i=b?1:0; i<(b?h+1:h); i++) {\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}",
"int i=b?1:0;",
"int i=b?1:0;",
"i",
"b?1:0",
"b",
"1",
"0",
"i<(b?h+1:h)",
"i",
"(b?h+1:h)",
"b",
"h+1",
"h",
"1",
"h",
"i++",
"i++",
"i",
"{\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}",
"{\n\t\t\tString temp = next();\n\t\t\tfor (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}\n\t\t}",
"String temp = next();",
"temp",
"next()",
"next",
"for (int j=0; j<w; j++) {\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<w",
"j",
"w",
"j++",
"j++",
"j",
"{\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}",
"{\n\t\t\t\tar[i][b?j+1:j] = temp.charAt(j);\n\t\t\t}",
"ar[i][b?j+1:j] = temp.charAt(j)",
"ar[i][b?j+1:j]",
"ar[i]",
"ar",
"i",
"b?j+1:j",
"b",
"j+1",
"j",
"1",
"j",
"temp.charAt(j)",
"temp.charAt",
"temp",
"j",
"return ar;",
"ar",
"int h",
"h",
"int w",
"w",
"boolean b",
"b"
] | import java.util.*;
import java.io.*;
class Main {
void solve () {
int n = nextInt();
int[] A = nextIntArray(n);
int m = nextInt();
int ans = 0;
for (int i=0; i<m; i++) {
if (Arrays.binarySearch(A, nextInt()) >= 0) ans++;
}
out.println(ans);
}
// <Main Method>
public static PrintWriter out;
public static void main(String[] args) {
out = new PrintWriter(System.out);
new Main().solve();
out.flush();
}
// <Default Field>
static int maxInt = Integer.MAX_VALUE, minInt = Integer.MIN_VALUE;
static int mod = 1000000007;
// <Default Method>
static int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}
static int min (int... ar) {Arrays.sort(ar);return ar[0];}
static int calcManhatDistance (int x1, int y1, int x2, int y2) {
int d = Math.abs(x1-x2)+Math.abs(y1-y2);
return d;
}
static double calcEuclidDistance (double x1, double y1, double x2, double y2) {
double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
return d;
}
static boolean isPrime (int n) {
if (n==2) return true;
if (n<2 || n%2==0) return false;
double d = Math.sqrt(n);
for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
return true;
}
static void printChar2DArray (char[][] ar) {
for (int i=0; i<ar.length; i++) {
for (int j=0; j<ar[0].length; j++) {
out.print(ar[i][j]);
}
out.println();
}
}
// <Fast Scanner> START -------------------------------------------------
static InputStream in = System.in;
static byte[] buffer = new byte[1024];
static int length = 0, p = 0;
public static boolean hasNextByte () {
if (p < length) return true;
else {
p = 0;
try {length = in.read(buffer);}
catch (Exception e) {e.printStackTrace();}
if (length == 0) return false;
}
return true;
}
public static int readByte () {
if (hasNextByte() == true) return buffer[p++];
return -1;
}
public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
public static void skip () {
while (hasNextByte() && !isPrintable(buffer[p])) p++;
}
public static boolean hasNext () {skip(); return hasNextByte();}
public static String next () {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int temp = readByte();
while (isPrintable(temp)) {
sb.appendCodePoint(temp);
temp = readByte();
}
return sb.toString();
}
public static String[] nextStringArray (int n) {
String[] ar = new String[n];
for (int i=0; i<n; i++) ar[i] = next();
return ar;
}
public static int nextInt () {return Math.toIntExact(nextLong());}
public static int[] nextIntArray (int n) {
int[] ar = new int[n];
for (int i=0; i<n; i++) ar[i] = nextInt();
return ar;
}
public static long nextLong () {
if (!hasNext()) throw new NoSuchElementException();
boolean minus = false;
int temp = readByte();
if (temp == '-') {
minus = true;
temp = readByte();
}
if (temp<'0' || '9'<temp) throw new NumberFormatException();
long n = 0;
while (isPrintable(temp)) {
if ('0'<=temp && temp<='9') {
n *= 10;
n += temp - '0';
}
temp = readByte();
}
return minus? -n : n;
}
public static char[][] nextChar2DArray (int h, int w, boolean b) {
//b(番兵)がtrueなら配列を余計に確保する
char[][] ar = new char[b?h+2:h][b?w+2:h];
for (int i=b?1:0; i<(b?h+1:h); i++) {
String temp = next();
for (int j=0; j<w; j++) {
ar[i][b?j+1:j] = temp.charAt(j);
}
}
return ar;
}
// <Fast Scanner> END ----------------------------------------------------------
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
41,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
4,
13,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
29,
35
],
[
35,
36
],
[
21,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
37,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
37,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
48,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
6,
59
],
[
59,
60
],
[
6,
61
],
[
61,
62
],
[
6,
63
],
[
63,
64
],
[
4,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
72
],
[
72,
73
],
[
67,
74
],
[
74,
75
],
[
67,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
67,
80
],
[
80,
81
],
[
67,
82
],
[
82,
83
],
[
82,
84
],
[
67,
85
],
[
85,
86
],
[
85,
87
],
[
67,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
67,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
67,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
67,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
118,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
130,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
137,
140
],
[
137,
141
],
[
136,
142
],
[
142,
143
],
[
67,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
65,
150
],
[
150,
151
]
] | [
"import java.util.Scanner;\n \n \n class Main{\n \n public static boolean search(int A[],int n,int key){\n\t\t\n\t\tint left =0;\n\t\tint mid;\n\t\tint right =n;\n\t\t\n\t\twhile(left<right){\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}\n\t\treturn false;\n\t}\n\n public static void main(String[] args) {\n int A[]=new int[1000000];\n int i,j,n,q,key,sum=0;\n \n Scanner s =new Scanner(System.in);\n n=s.nextInt();\n for(i=0;i<n;i++){\n A[i]=s.nextInt();\n }\n \n q=s.nextInt();\n for(j=0;j<q;j++){\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }\n System.out.println(sum);\n }\n \n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n \n public static boolean search(int A[],int n,int key){\n\t\t\n\t\tint left =0;\n\t\tint mid;\n\t\tint right =n;\n\t\t\n\t\twhile(left<right){\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}\n\t\treturn false;\n\t}\n\n public static void main(String[] args) {\n int A[]=new int[1000000];\n int i,j,n,q,key,sum=0;\n \n Scanner s =new Scanner(System.in);\n n=s.nextInt();\n for(i=0;i<n;i++){\n A[i]=s.nextInt();\n }\n \n q=s.nextInt();\n for(j=0;j<q;j++){\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }\n System.out.println(sum);\n }\n \n}",
"Main",
"public static boolean search(int A[],int n,int key){\n\t\t\n\t\tint left =0;\n\t\tint mid;\n\t\tint right =n;\n\t\t\n\t\twhile(left<right){\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}\n\t\treturn false;\n\t}",
"search",
"{\n\t\t\n\t\tint left =0;\n\t\tint mid;\n\t\tint right =n;\n\t\t\n\t\twhile(left<right){\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}\n\t\treturn false;\n\t}",
"int left =0;",
"left",
"0",
"int mid;",
"mid",
"int right =n;",
"right",
"n",
"while(left<right){\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}",
"left<right",
"left",
"right",
"{\n\t\t\tmid=(left+right)/2;\n\t\t\tif(key==A[mid]) \n\t\t\t\treturn true; \n\t\t\tif(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;\n\t\t}",
"mid=(left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(key==A[mid]) \n\t\t\t\treturn true;",
"key==A[mid]",
"key",
"A[mid]",
"A",
"mid",
"return true;",
"true",
"if(key>A[mid])\n\t\t\t\tleft=mid+1;\n\t\t\telse if(key<A[mid])\n\t\t\t\tright =mid;",
"key>A[mid]",
"key",
"A[mid]",
"A",
"mid",
"left=mid+1",
"left",
"mid+1",
"mid",
"1",
"if(key<A[mid])\n\t\t\t\tright =mid;",
"key<A[mid]",
"key",
"A[mid]",
"A",
"mid",
"right =mid",
"right",
"mid",
"return false;",
"false",
"int A[]",
"A",
"int n",
"n",
"int key",
"key",
"public static void main(String[] args) {\n int A[]=new int[1000000];\n int i,j,n,q,key,sum=0;\n \n Scanner s =new Scanner(System.in);\n n=s.nextInt();\n for(i=0;i<n;i++){\n A[i]=s.nextInt();\n }\n \n q=s.nextInt();\n for(j=0;j<q;j++){\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }\n System.out.println(sum);\n }",
"main",
"{\n int A[]=new int[1000000];\n int i,j,n,q,key,sum=0;\n \n Scanner s =new Scanner(System.in);\n n=s.nextInt();\n for(i=0;i<n;i++){\n A[i]=s.nextInt();\n }\n \n q=s.nextInt();\n for(j=0;j<q;j++){\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }\n System.out.println(sum);\n }",
"int A[]=new int[1000000];",
"A",
"new int[1000000]",
"1000000",
"int i",
"i",
"j",
"j",
"n",
"n",
"q",
"q",
"key",
"key",
"sum=0;",
"sum",
"0",
"Scanner s =new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"n=s.nextInt()",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"for(i=0;i<n;i++){\n A[i]=s.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i]=s.nextInt();\n }",
"{\n A[i]=s.nextInt();\n }",
"A[i]=s.nextInt()",
"A[i]",
"A",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"q=s.nextInt()",
"q",
"s.nextInt()",
"s.nextInt",
"s",
"for(j=0;j<q;j++){\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }",
"{\n key=s.nextInt();\n\n if(search(A,n,key))\n sum++;\n }",
"key=s.nextInt()",
"key",
"s.nextInt()",
"s.nextInt",
"s",
"if(search(A,n,key))\n sum++;",
"search(A,n,key)",
"search",
"A",
"n",
"key",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static boolean search(int A[],int n,int key){
int left =0;
int mid;
int right =n;
while(left<right){
mid=(left+right)/2;
if(key==A[mid])
return true;
if(key>A[mid])
left=mid+1;
else if(key<A[mid])
right =mid;
}
return false;
}
public static void main(String[] args) {
int A[]=new int[1000000];
int i,j,n,q,key,sum=0;
Scanner s =new Scanner(System.in);
n=s.nextInt();
for(i=0;i<n;i++){
A[i]=s.nextInt();
}
q=s.nextInt();
for(j=0;j<q;j++){
key=s.nextInt();
if(search(A,n,key))
sum++;
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
160,
5
],
[
160,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
8,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
8,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
8,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
8,
83
],
[
83,
84
],
[
83,
85
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
107,
109
],
[
8,
110
],
[
110,
111
],
[
110,
112
],
[
8,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
113,
124
],
[
125,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
126,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
144,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
8,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
6,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String line1 = sc.nextLine();",
"line1",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int n = Integer.parseInt(line1);",
"n",
"Integer.parseInt(line1)",
"Integer.parseInt",
"Integer",
"line1",
"String line2 = sc.nextLine();",
"line2",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] kari2 = line2.split(\" \");",
"kari2",
"line2.split(\" \")",
"line2.split",
"line2",
"\" \"",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}",
"{\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}",
"S[i] = Integer.parseInt(kari2[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(kari2[i])",
"Integer.parseInt",
"Integer",
"kari2[i]",
"kari2",
"i",
"String line3 = sc.nextLine();",
"line3",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int q = Integer.parseInt(line3);",
"q",
"Integer.parseInt(line3)",
"Integer.parseInt",
"Integer",
"line3",
"String line4 = sc.nextLine();",
"line4",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] kari4 = line4.split(\" \");",
"kari4",
"line4.split(\" \")",
"line4.split",
"line4",
"\" \"",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}",
"{\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}",
"T[i] = Integer.parseInt(kari4[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(kari4[i])",
"Integer.parseInt",
"Integer",
"kari4[i]",
"kari4",
"i",
"int C = 0;",
"C",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}",
"for (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"T[i] == S[j]",
"T[i]",
"T",
"i",
"S[j]",
"S",
"j",
"{\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C++",
"C",
"break;",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\t\t\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari2 = line2.split(\" \");\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = Integer.parseInt(kari2[i]);\n\t\t}\n\t\t\n\t\tString line3 = sc.nextLine();\n\t\tint q = Integer.parseInt(line3);\n\t\t\n\t\tString line4 = sc.nextLine();\n\t\tString[] kari4 = line4.split(\" \");\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = Integer.parseInt(kari4[i]);\n\t\t}\n\t\t\n\t\tint C = 0;\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (T[i] == S[j]) {\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
Scanner sc = new Scanner(System.in);
String line1 = sc.nextLine();
int n = Integer.parseInt(line1);
String line2 = sc.nextLine();
String[] kari2 = line2.split(" ");
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = Integer.parseInt(kari2[i]);
}
String line3 = sc.nextLine();
int q = Integer.parseInt(line3);
String line4 = sc.nextLine();
String[] kari4 = line4.split(" ");
int[] T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = Integer.parseInt(kari4[i]);
}
int C = 0;
for (int i = 0; i < q; i++) {
for (int j = 0; j < n; j++) {
if (T[i] == S[j]) {
C++;
break;
}
}
}
System.out.println(C);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
18,
13,
13,
13,
17,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
41,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
177,
5
],
[
177,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
17,
19
],
[
12,
20
],
[
20,
21
],
[
21,
22
],
[
12,
23
],
[
24,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
27,
33
],
[
27,
34
],
[
8,
35
],
[
35,
36
],
[
6,
37
],
[
37,
38
],
[
6,
39
],
[
39,
40
],
[
6,
41
],
[
41,
42
],
[
6,
43
],
[
43,
44
],
[
177,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
66,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
68,
74
],
[
74,
75
],
[
74,
76
],
[
68,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
47,
82
],
[
82,
83
],
[
45,
84
],
[
84,
85
],
[
45,
86
],
[
86,
87
],
[
45,
88
],
[
88,
89
],
[
45,
90
],
[
90,
91
],
[
177,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
94,
103
],
[
103,
104
],
[
94,
105
],
[
105,
106
],
[
94,
107
],
[
107,
108
],
[
107,
109
],
[
94,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
129,
130
],
[
94,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
94,
136
],
[
136,
137
],
[
136,
138
],
[
94,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
140,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
94,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
165,
166
],
[
165,
167
],
[
165,
168
],
[
165,
169
],
[
165,
170
],
[
94,
171
],
[
171,
172
],
[
172,
173
],
[
92,
174
],
[
174,
175
],
[
0,
176
],
[
176,
177
],
[
176,
178
]
] | [
"import java.util.*;\n\npublic class Main {\n static int calu(int n, int m, int A[], int S[]) {\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }\n static int bsearch(int si,int A[],int left,int right)\n { \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n static int calu(int n, int m, int A[], int S[]) {\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }\n static int bsearch(int si,int A[],int left,int right)\n { \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }\n}",
"Main",
"static int calu(int n, int m, int A[], int S[]) {\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }",
"calu",
"{\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }",
"int count=0;",
"count",
"0",
"for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\n count+=bsearch(S[i],A,0,n);\n }",
"{\n count+=bsearch(S[i],A,0,n);\n }",
"count+=bsearch(S[i],A,0,n)",
"count",
"bsearch(S[i],A,0,n)",
"bsearch",
"S[i]",
"S",
"i",
"A",
"0",
"n",
"return count;",
"count",
"int n",
"n",
"int m",
"m",
"int A[]",
"A",
"int S[]",
"S",
"static int bsearch(int si,int A[],int left,int right)\n { \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }",
"bsearch",
"{ \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }",
"while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;",
"A[mid] == si",
"A[mid]",
"A",
"mid",
"si",
"return 1;",
"1",
"if (si < A[mid]) right = mid;\n else left = mid + 1;",
"si < A[mid]",
"si",
"A[mid]",
"A",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return 0;",
"0",
"int si",
"si",
"int A[]",
"A",
"int left",
"left",
"int right",
"right",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A",
"A",
"S;",
"S",
"A = new int[n]",
"A",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextInt();\n }",
"{\n A[i] = sc.nextInt();\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = new int[m]",
"S",
"new int[m]",
"m",
"for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"System.out.println(calu(n,m,A,S))",
"System.out.println",
"System.out",
"System",
"System.out",
"calu(n,m,A,S)",
"calu",
"n",
"m",
"A",
"S",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n static int calu(int n, int m, int A[], int S[]) {\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }\n static int bsearch(int si,int A[],int left,int right)\n { \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }\n}",
"public class Main {\n static int calu(int n, int m, int A[], int S[]) {\n int count=0;\n for(int i=0;i<m;i++){\n count+=bsearch(S[i],A,0,n);\n }\n return count;\n }\n static int bsearch(int si,int A[],int left,int right)\n { \n while (left < right){\n int mid = (left + right) / 2;\n if (A[mid] == si) return 1;\n else if (si < A[mid]) right = mid;\n else left = mid + 1;\n }\n return 0;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] A,S;\n A = new int[n]; \n for(int i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n int m = sc.nextInt();\n S = new int[m];\n for(int i = 0; i < m; i++) {\n S[i] = sc.nextInt();\n }\n System.out.println(calu(n,m,A,S));\n sc.close();\n }\n}",
"Main"
] | import java.util.*;
public class Main {
static int calu(int n, int m, int A[], int S[]) {
int count=0;
for(int i=0;i<m;i++){
count+=bsearch(S[i],A,0,n);
}
return count;
}
static int bsearch(int si,int A[],int left,int right)
{
while (left < right){
int mid = (left + right) / 2;
if (A[mid] == si) return 1;
else if (si < A[mid]) right = mid;
else left = mid + 1;
}
return 0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A,S;
A = new int[n];
for(int i = 0; i < n; i++) {
A[i] = sc.nextInt();
}
int m = sc.nextInt();
S = new int[m];
for(int i = 0; i < m; i++) {
S[i] = sc.nextInt();
}
System.out.println(calu(n,m,A,S));
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
17,
41,
13,
41,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
14,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
172,
5
],
[
172,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
8,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
8,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
83,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
95,
104
],
[
104,
105
],
[
104,
106
],
[
95,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
95,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
116,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
134,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
95,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
8,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
6,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"\nimport java.util.*;\n\n/**\n * A\n */\npublic class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }\n}",
"Main",
"public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }",
"main",
"{\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int flag = 0",
"flag",
"0",
"count = 0",
"count",
"0",
"left",
"left",
"right;",
"right",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextInt();\n }",
"{\n T[i] = sc.nextInt();\n }",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.close()",
"sc.close",
"sc",
"for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }",
"{\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }",
"int key = T[i];",
"key",
"T[i]",
"T",
"i",
"flag = 0",
"flag",
"0",
"left = 0",
"left",
"0",
"right = S.length",
"right",
"S.length",
"S",
"S.length",
"while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }",
"left<right",
"left",
"right",
"{\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }",
"int mid = (left+right)/2;",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(key == S[mid]) {\n flag++;\n break;\n }",
"key == S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n flag++;\n break;\n }",
"flag++",
"flag",
"break;",
"if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }",
"key > S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n left = mid+1;\n }",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"if(key < S[mid]) {\n right = mid;\n }",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"if(flag >= 1) {\n count++;\n }",
"flag >= 1",
"flag",
"1",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int flag = 0, count = 0, left, right;\n\n int n = sc.nextInt();\n int[] S = new int[n];\n\n for(int i=0; i<n; i++) {\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n\n for (int i = 0; i<q; i++) {\n T[i] = sc.nextInt();\n }\n\n sc.close();\n\n for(int i=0; i<q; i++) {\n\n int key = T[i];\n flag = 0;\n left = 0;\n right = S.length;\n\n while(left<right) {\n\n int mid = (left+right)/2;\n\n if(key == S[mid]) {\n flag++;\n break;\n }\n\n if(key > S[mid]) {\n left = mid+1;\n } else if(key < S[mid]) {\n right = mid;\n }\n\n }\n\n if(flag >= 1) {\n count++;\n }\n\n }\n\n System.out.println(count);\n\n }\n}",
"Main"
] |
import java.util.*;
/**
* A
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int flag = 0, count = 0, left, right;
int n = sc.nextInt();
int[] S = new int[n];
for(int i=0; i<n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[q];
for (int i = 0; i<q; i++) {
T[i] = sc.nextInt();
}
sc.close();
for(int i=0; i<q; i++) {
int key = T[i];
flag = 0;
left = 0;
right = S.length;
while(left<right) {
int mid = (left+right)/2;
if(key == S[mid]) {
flag++;
break;
}
if(key > S[mid]) {
left = mid+1;
} else if(key < S[mid]) {
right = mid;
}
}
if(flag >= 1) {
count++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
4,
13,
13,
17,
2,
13,
17,
18,
13,
13,
4,
13,
13,
17,
2,
13,
17,
18,
13,
13,
17,
40,
13,
4,
18,
13,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
29,
2,
13,
17,
14,
2,
13,
18,
13,
13,
29,
13,
41,
13,
2,
13,
17,
41,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
2,
13,
13,
17,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
29,
2,
13,
17,
14,
2,
13,
18,
13,
13,
29,
13,
41,
13,
2,
13,
17,
41,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
2,
13,
13,
17,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
4,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
0,
18,
36,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
40,
2,
2,
13,
17,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
2,
2,
2,
13,
17,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
2,
2,
2,
13,
17,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
4,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
644,
17
],
[
644,
18
],
[
18,
19
],
[
644,
20
],
[
20,
21
],
[
644,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
24,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
24,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
24,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
24,
47
],
[
47,
48
],
[
47,
49
],
[
24,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
66,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
65,
76
],
[
76,
77
],
[
76,
78
],
[
76,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
76,
83
],
[
83,
84
],
[
83,
85
],
[
64,
86
],
[
63,
87
],
[
87,
88
],
[
24,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
644,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
95,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
112,
113
],
[
95,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
95,
119
],
[
119,
120
],
[
119,
121
],
[
95,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
122,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
131,
137
],
[
128,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
138,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
138,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
95,
152
],
[
152,
153
],
[
93,
154
],
[
154,
155
],
[
93,
156
],
[
156,
157
],
[
93,
158
],
[
158,
159
],
[
93,
160
],
[
160,
161
],
[
644,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
164,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
175,
181
],
[
181,
182
],
[
164,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
185,
187
],
[
164,
188
],
[
188,
189
],
[
188,
190
],
[
164,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
196
],
[
191,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
201,
205
],
[
200,
206
],
[
197,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
207,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
207,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
164,
221
],
[
221,
222
],
[
162,
223
],
[
223,
224
],
[
162,
225
],
[
225,
226
],
[
162,
227
],
[
227,
228
],
[
162,
229
],
[
229,
230
],
[
644,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
237,
239
],
[
233,
240
],
[
240,
241
],
[
233,
242
],
[
242,
243
],
[
243,
244
],
[
231,
245
],
[
245,
246
],
[
644,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
247,
251
],
[
251,
252
],
[
251,
253
],
[
247,
255
],
[
255,
256
],
[
247,
257
],
[
257,
258
],
[
247,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
262,
266
],
[
261,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
259,
276
],
[
276,
277
],
[
247,
278
],
[
278,
279
],
[
278,
280
],
[
280,
281
],
[
281,
282
],
[
282,
283
],
[
282,
284
],
[
281,
285
],
[
285,
286
],
[
286,
287
],
[
286,
288
],
[
285,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
289,
295
],
[
295,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
299,
300
],
[
298,
301
],
[
285,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
302,
306
],
[
306,
307
],
[
280,
308
],
[
308,
309
],
[
247,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
313,
314
],
[
314,
315
],
[
313,
316
],
[
316,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
313,
321
],
[
321,
322
],
[
322,
323
],
[
247,
324
],
[
324,
325
],
[
324,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
329,
333
],
[
333,
334
],
[
333,
335
],
[
324,
336
],
[
336,
337
],
[
247,
338
],
[
338,
339
],
[
338,
340
],
[
340,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
342,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
347,
349
],
[
341,
350
],
[
350,
351
],
[
247,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
355,
356
],
[
354,
357
],
[
357,
358
],
[
358,
359
],
[
247,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
363,
364
],
[
364,
365
],
[
365,
366
],
[
363,
367
],
[
367,
368
],
[
362,
369
],
[
369,
370
],
[
369,
371
],
[
362,
372
],
[
372,
373
],
[
372,
374
],
[
374,
375
],
[
362,
376
],
[
376,
377
],
[
377,
378
],
[
378,
379
],
[
378,
380
],
[
376,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
382,
385
],
[
381,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
362,
390
],
[
390,
391
],
[
391,
392
],
[
392,
393
],
[
247,
394
],
[
394,
395
],
[
394,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
399,
400
],
[
397,
401
],
[
401,
402
],
[
396,
403
],
[
403,
404
],
[
403,
405
],
[
405,
406
],
[
396,
407
],
[
407,
408
],
[
408,
409
],
[
408,
410
],
[
407,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
396,
415
],
[
415,
416
],
[
415,
417
],
[
396,
418
],
[
418,
419
],
[
419,
420
],
[
419,
421
],
[
418,
422
],
[
422,
423
],
[
423,
424
],
[
423,
425
],
[
422,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
396,
430
],
[
430,
431
],
[
430,
432
],
[
396,
433
],
[
433,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
433,
438
],
[
438,
439
],
[
439,
440
],
[
440,
441
],
[
441,
442
],
[
441,
443
],
[
440,
444
],
[
444,
445
],
[
444,
446
],
[
439,
447
],
[
447,
448
],
[
438,
449
],
[
449,
450
],
[
449,
451
],
[
451,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
452,
456
],
[
451,
457
],
[
438,
458
],
[
458,
459
],
[
458,
460
],
[
460,
461
],
[
396,
462
],
[
462,
463
],
[
463,
464
],
[
463,
465
],
[
465,
466
],
[
463,
467
],
[
247,
468
],
[
468,
469
],
[
468,
470
],
[
470,
471
],
[
471,
472
],
[
472,
473
],
[
473,
474
],
[
471,
475
],
[
475,
476
],
[
470,
477
],
[
477,
478
],
[
477,
479
],
[
479,
480
],
[
470,
481
],
[
481,
482
],
[
482,
483
],
[
482,
484
],
[
481,
485
],
[
485,
486
],
[
485,
487
],
[
487,
488
],
[
470,
489
],
[
489,
490
],
[
489,
491
],
[
470,
492
],
[
492,
493
],
[
493,
494
],
[
493,
495
],
[
492,
496
],
[
496,
497
],
[
497,
498
],
[
497,
499
],
[
496,
500
],
[
500,
501
],
[
500,
502
],
[
502,
503
],
[
470,
504
],
[
504,
505
],
[
504,
506
],
[
470,
507
],
[
507,
508
],
[
508,
509
],
[
509,
510
],
[
509,
511
],
[
507,
512
],
[
512,
513
],
[
513,
514
],
[
514,
515
],
[
515,
516
],
[
515,
517
],
[
514,
518
],
[
518,
519
],
[
518,
520
],
[
513,
521
],
[
521,
522
],
[
512,
523
],
[
523,
524
],
[
523,
525
],
[
525,
526
],
[
526,
527
],
[
527,
528
],
[
527,
529
],
[
526,
530
],
[
525,
531
],
[
512,
532
],
[
532,
533
],
[
532,
534
],
[
534,
535
],
[
470,
536
],
[
536,
537
],
[
537,
538
],
[
537,
539
],
[
539,
540
],
[
537,
541
],
[
247,
542
],
[
542,
543
],
[
542,
544
],
[
544,
545
],
[
545,
546
],
[
546,
547
],
[
547,
548
],
[
546,
549
],
[
549,
550
],
[
247,
551
],
[
551,
552
],
[
551,
553
],
[
553,
554
],
[
554,
555
],
[
554,
556
],
[
553,
558
],
[
558,
559
],
[
559,
560
],
[
560,
561
],
[
560,
562
],
[
558,
563
],
[
563,
564
],
[
563,
565
],
[
558,
566
],
[
566,
567
],
[
567,
568
],
[
558,
569
],
[
569,
570
],
[
570,
571
],
[
571,
572
],
[
571,
573
],
[
570,
574
],
[
574,
575
],
[
553,
576
],
[
576,
577
],
[
551,
578
],
[
578,
579
],
[
247,
580
],
[
580,
581
],
[
580,
582
],
[
582,
583
],
[
583,
584
],
[
583,
585
],
[
582,
587
],
[
587,
588
],
[
588,
589
],
[
589,
590
],
[
589,
591
],
[
587,
592
],
[
592,
593
],
[
592,
594
],
[
587,
595
],
[
595,
596
],
[
596,
597
],
[
587,
598
],
[
598,
599
],
[
599,
600
],
[
600,
601
],
[
600,
602
],
[
599,
603
],
[
603,
604
],
[
582,
605
],
[
605,
606
],
[
580,
607
],
[
607,
608
],
[
247,
609
],
[
609,
610
],
[
609,
611
],
[
611,
612
],
[
612,
613
],
[
612,
614
],
[
611,
617
],
[
617,
618
],
[
618,
619
],
[
619,
620
],
[
619,
621
],
[
617,
622
],
[
622,
623
],
[
622,
624
],
[
617,
625
],
[
625,
626
],
[
626,
627
],
[
617,
628
],
[
628,
629
],
[
629,
630
],
[
630,
631
],
[
630,
632
],
[
629,
633
],
[
633,
634
],
[
634,
635
],
[
635,
636
],
[
611,
637
],
[
637,
638
],
[
609,
639
],
[
639,
640
],
[
609,
641
],
[
641,
642
],
[
0,
643
],
[
643,
644
],
[
643,
645
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tstatic PrintWriter out;\n\tstatic InputReader ir;\n\n\tstatic void solve() {\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}\n\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic class InputReader {\n\n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n\n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.NoSuchElementException;",
"NoSuchElementException",
"java.util",
"public class Main {\n\n\tstatic PrintWriter out;\n\tstatic InputReader ir;\n\n\tstatic void solve() {\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}\n\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic class InputReader {\n\n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n\n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"Main",
"static PrintWriter out;",
"out",
"static InputReader ir;",
"ir",
"static void solve() {\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}",
"solve",
"{\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}",
"int n=ir.nextInt();",
"n",
"ir.nextInt()",
"ir.nextInt",
"ir",
"int[] s=ir.nextIntArray(n);",
"s",
"ir.nextIntArray(n)",
"ir.nextIntArray",
"ir",
"n",
"int q=ir.nextInt();",
"q",
"ir.nextInt()",
"ir.nextInt",
"ir",
"int[] t=ir.nextIntArray(q);",
"t",
"ir.nextIntArray(q)",
"ir.nextIntArray",
"ir",
"q",
"int ret=0;",
"ret",
"0",
"for(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}",
"{\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}",
"if((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;",
"(upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0",
"(upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))",
"upper_bound(s,0,n-1,t[i])",
"upper_bound",
"s",
"0",
"n-1",
"n",
"1",
"t[i]",
"t",
"i",
"lower_bound(s,0,n-1,t[i])",
"lower_bound",
"s",
"0",
"n-1",
"n",
"1",
"t[i]",
"t",
"i",
"0",
"ret++",
"ret",
"out.println(ret)",
"out.println",
"out",
"ret",
"public static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"lower_bound",
"{\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"if (val > a[toIndex])\n\t\t\treturn toIndex + 1;",
"val > a[toIndex]",
"val",
"a[toIndex]",
"a",
"toIndex",
"return toIndex + 1;",
"toIndex + 1",
"toIndex",
"1",
"if (val <= a[fromIndex])\n\t\t\treturn fromIndex;",
"val <= a[fromIndex]",
"val",
"a[fromIndex]",
"a",
"fromIndex",
"return fromIndex;",
"fromIndex",
"int lb = fromIndex - 1",
"lb",
"fromIndex - 1",
"fromIndex",
"1",
"ub = toIndex;",
"ub",
"toIndex",
"while (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"ub - lb > 1",
"ub - lb",
"ub",
"lb",
"1",
"{\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"int mid = (ub - lb)/2+lb;",
"mid",
"(ub - lb)/2+lb",
"(ub - lb)/2",
"(ub - lb)",
"ub",
"lb",
"2",
"lb",
"if (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}",
"a[mid] >= val",
"a[mid]",
"a",
"mid",
"val",
"{\n\t\t\t\tub = mid;\n\t\t\t}",
"ub = mid",
"ub",
"mid",
"{\n\t\t\t\tlb = mid;\n\t\t\t}",
"lb = mid",
"lb",
"mid",
"return ub;",
"ub",
"int[] a",
"a",
"int fromIndex",
"fromIndex",
"int toIndex",
"toIndex",
"int val",
"val",
"public static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"upper_bound",
"{\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"if (val >= a[toIndex])\n\t\t\treturn toIndex + 1;",
"val >= a[toIndex]",
"val",
"a[toIndex]",
"a",
"toIndex",
"return toIndex + 1;",
"toIndex + 1",
"toIndex",
"1",
"if (val < a[fromIndex])\n\t\t\treturn fromIndex;",
"val < a[fromIndex]",
"val",
"a[fromIndex]",
"a",
"fromIndex",
"return fromIndex;",
"fromIndex",
"int lb = fromIndex - 1",
"lb",
"fromIndex - 1",
"fromIndex",
"1",
"ub = toIndex;",
"ub",
"toIndex",
"while (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"ub - lb > 1",
"ub - lb",
"ub",
"lb",
"1",
"{\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"int mid = (ub - lb)/2+lb;",
"mid",
"(ub - lb)/2+lb",
"(ub - lb)/2",
"(ub - lb)",
"ub",
"lb",
"2",
"lb",
"if (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}",
"a[mid] > val",
"a[mid]",
"a",
"mid",
"val",
"{\n\t\t\t\tub = mid;\n\t\t\t}",
"ub = mid",
"ub",
"mid",
"{\n\t\t\t\tlb = mid;\n\t\t\t}",
"lb = mid",
"lb",
"mid",
"return ub;",
"ub",
"int[] a",
"a",
"int fromIndex",
"fromIndex",
"int toIndex",
"toIndex",
"int val",
"val",
"public static void main(String[] args) throws Exception {\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}",
"main",
"{\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}",
"ir = new InputReader(System.in)",
"ir",
"new InputReader(System.in)",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"solve()",
"solve",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"static class InputReader {\n\n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n\n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}",
"InputReader",
"private InputStream in;",
"in",
"private byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int curbuf;",
"curbuf",
"private int lenbuf;",
"lenbuf",
"public InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}",
"InputReader",
"{\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}",
"this.in = in",
"this.in",
"this",
"this.in",
"in",
"this.curbuf = this.lenbuf = 0",
"this.curbuf",
"this",
"this.curbuf",
"this.lenbuf = 0",
"this.lenbuf",
"this",
"this.lenbuf",
"0",
"InputStream in",
"in",
"public boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"hasNextByte",
"{\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"if (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}",
"curbuf >= lenbuf",
"curbuf",
"lenbuf",
"{\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}",
"curbuf = 0",
"curbuf",
"0",
"try {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t}",
"lenbuf = in.read(buffer)",
"lenbuf",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (lenbuf <= 0)\n\t\t\t\t\treturn false;",
"lenbuf <= 0",
"lenbuf",
"0",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}",
"readByte",
"{\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}",
"if (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[curbuf++];",
"buffer[curbuf++]",
"buffer",
"curbuf++",
"curbuf",
"return -1;",
"-1",
"1",
"private boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}",
"isSpaceChar",
"{\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}",
"return !(c >= 33 && c <= 126);",
"!(c >= 33 && c <= 126)",
"(c >= 33 && c <= 126)",
"c >= 33",
"c",
"33",
"c <= 126",
"c",
"126",
"int c",
"c",
"private void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}",
"skip",
"{\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}",
"while (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;",
"hasNextByte() && isSpaceChar(buffer[curbuf])",
"hasNextByte()",
"hasNextByte",
"isSpaceChar(buffer[curbuf])",
"isSpaceChar",
"buffer[curbuf]",
"buffer",
"curbuf",
"curbuf++",
"curbuf",
"public boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}",
"hasNext",
"{\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}",
"skip()",
"skip",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"next",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"!isSpaceChar(b)",
"isSpaceChar(b)",
"isSpaceChar",
"b",
"{\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"nextInt",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"int c = readByte();",
"c",
"readByte()",
"readByte",
"while (isSpaceChar(c))\n\t\t\t\tc = readByte();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = readByte()",
"c",
"readByte()",
"readByte",
"boolean minus = false;",
"minus",
"false",
"if (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"minus = true",
"minus",
"true",
"c = readByte()",
"c",
"readByte()",
"readByte",
"int res = 0;",
"res",
"0",
"do {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res = res * 10 + c - '0'",
"res",
"res * 10 + c - '0'",
"res * 10 + c",
"res * 10",
"res",
"10",
"c",
"'0'",
"c = readByte()",
"c",
"readByte()",
"readByte",
"return (minus) ? -res : res;",
"(minus) ? -res : res",
"(minus)",
"-res",
"res",
"res",
"public long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"nextLong",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"int c = readByte();",
"c",
"readByte()",
"readByte",
"while (isSpaceChar(c))\n\t\t\t\tc = readByte();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = readByte()",
"c",
"readByte()",
"readByte",
"boolean minus = false;",
"minus",
"false",
"if (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"minus = true",
"minus",
"true",
"c = readByte()",
"c",
"readByte()",
"readByte",
"long res = 0;",
"res",
"0",
"do {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res = res * 10 + c - '0'",
"res",
"res * 10 + c - '0'",
"res * 10 + c",
"res * 10",
"res",
"10",
"c",
"'0'",
"c = readByte()",
"c",
"readByte()",
"readByte",
"return (minus) ? -res : res;",
"(minus) ? -res : res",
"(minus)",
"-res",
"res",
"res",
"public double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"nextDouble",
"{\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"nextIntArray",
"{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"nextLongArray",
"{\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}",
"nextCharMap",
"{\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}",
"char[][] map = new char[n][m];",
"map",
"new char[n][m]",
"n",
"m",
"for (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"map[i] = next().toCharArray();",
"map[i] = next().toCharArray()",
"map[i]",
"map",
"i",
"next().toCharArray()",
"next().toCharArray",
"next()",
"next",
"return map;",
"map",
"int n",
"n",
"int m",
"m",
"public class Main {\n\n\tstatic PrintWriter out;\n\tstatic InputReader ir;\n\n\tstatic void solve() {\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}\n\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic class InputReader {\n\n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n\n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"public class Main {\n\n\tstatic PrintWriter out;\n\tstatic InputReader ir;\n\n\tstatic void solve() {\n\t\tint n=ir.nextInt();\n\t\tint[] s=ir.nextIntArray(n);\n\t\tint q=ir.nextInt();\n\t\tint[] t=ir.nextIntArray(q);\n\t\tint ret=0;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tif((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)\n\t\t\t\tret++;\n\t\t}\n\t\tout.println(ret);\n\t}\n\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tir = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic class InputReader {\n\n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n\n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
static PrintWriter out;
static InputReader ir;
static void solve() {
int n=ir.nextInt();
int[] s=ir.nextIntArray(n);
int q=ir.nextInt();
int[] t=ir.nextIntArray(q);
int ret=0;
for(int i=0;i<q;i++){
if((upper_bound(s,0,n-1,t[i])-lower_bound(s,0,n-1,t[i]))>0)
ret++;
}
out.println(ret);
}
public static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {
if (val > a[toIndex])
return toIndex + 1;
if (val <= a[fromIndex])
return fromIndex;
int lb = fromIndex - 1, ub = toIndex;
while (ub - lb > 1) {
int mid = (ub - lb)/2+lb;
if (a[mid] >= val) {
ub = mid;
} else {
lb = mid;
}
}
return ub;
}
public static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {
if (val >= a[toIndex])
return toIndex + 1;
if (val < a[fromIndex])
return fromIndex;
int lb = fromIndex - 1, ub = toIndex;
while (ub - lb > 1) {
int mid = (ub - lb)/2+lb;
if (a[mid] > val) {
ub = mid;
} else {
lb = mid;
}
}
return ub;
}
public static void main(String[] args) throws Exception {
ir = new InputReader(System.in);
out = new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer = new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {
this.in = in;
this.curbuf = this.lenbuf = 0;
}
public boolean hasNextByte() {
if (curbuf >= lenbuf) {
curbuf = 0;
try {
lenbuf = in.read(buffer);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0)
return false;
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[curbuf++];
else
return -1;
}
private boolean isSpaceChar(int c) {
return !(c >= 33 && c <= 126);
}
private void skip() {
while (hasNextByte() && isSpaceChar(buffer[curbuf]))
curbuf++;
}
public boolean hasNext() {
skip();
return hasNextByte();
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (!isSpaceChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public int nextInt() {
if (!hasNext())
throw new NoSuchElementException();
int c = readByte();
while (isSpaceChar(c))
c = readByte();
boolean minus = false;
if (c == '-') {
minus = true;
c = readByte();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res = res * 10 + c - '0';
c = readByte();
} while (!isSpaceChar(c));
return (minus) ? -res : res;
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
int c = readByte();
while (isSpaceChar(c))
c = readByte();
boolean minus = false;
if (c == '-') {
minus = true;
c = readByte();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res = res * 10 + c - '0';
c = readByte();
} while (!isSpaceChar(c));
return (minus) ? -res : res;
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public char[][] nextCharMap(int n, int m) {
char[][] map = new char[n][m];
for (int i = 0; i < n; i++)
map[i] = next().toCharArray();
return map;
}
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
4,
9
],
[
9,
10
],
[
4,
11
],
[
11,
12
],
[
4,
13
],
[
13,
14
],
[
4,
15
],
[
15,
16
],
[
4,
17
],
[
17,
18
],
[
4,
19
],
[
19,
20
],
[
4,
21
],
[
21,
22
],
[
4,
23
],
[
23,
24
],
[
4,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
27,
33
],
[
33,
34
],
[
33,
35
],
[
27,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
27,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
27,
62
],
[
62,
63
],
[
62,
64
],
[
27,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
27,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
86,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
117,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
129,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
141,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
27,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
4,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
161,
167
],
[
167,
168
]
] | [
"import java.util.Scanner;\nclass Main{\n\tScanner sc = new Scanner(System.in);\n\tint n;\n\tint[] S;\n\tint q;\n\tint[] T;\n\tint C;\n\tint left;\n\tint right;\n\tint mid;\n\tvoid n(){\n\t\tn=sc.nextInt();\n\t\tS=new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tS[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tT=new int[q];\n\t\tfor(int j=0; j<q; j++){\n\t\t\tT[j]=sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0; j<q; j++){\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n\tpublic static void main(String[]agrs){\n\t\tnew Main().n();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\tScanner sc = new Scanner(System.in);\n\tint n;\n\tint[] S;\n\tint q;\n\tint[] T;\n\tint C;\n\tint left;\n\tint right;\n\tint mid;\n\tvoid n(){\n\t\tn=sc.nextInt();\n\t\tS=new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tS[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tT=new int[q];\n\t\tfor(int j=0; j<q; j++){\n\t\t\tT[j]=sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0; j<q; j++){\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}\n\tpublic static void main(String[]agrs){\n\t\tnew Main().n();\n\t}\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n;",
"n",
"int[] S;",
"S",
"int q;",
"q",
"int[] T;",
"T",
"int C;",
"C",
"int left;",
"left",
"int right;",
"right",
"int mid;",
"mid",
"void n(){\n\t\tn=sc.nextInt();\n\t\tS=new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tS[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tT=new int[q];\n\t\tfor(int j=0; j<q; j++){\n\t\t\tT[j]=sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0; j<q; j++){\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"n",
"{\n\t\tn=sc.nextInt();\n\t\tS=new int[n];\n\t\tfor(int i=0; i<n; i++){\n\t\t\tS[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tT=new int[q];\n\t\tfor(int j=0; j<q; j++){\n\t\t\tT[j]=sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int j=0; j<q; j++){\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(C);\n\t}",
"n=sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S=new int[n]",
"S",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n\t\t\tS[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tS[i]=sc.nextInt();\n\t\t}",
"S[i]=sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q=sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T=new int[q]",
"T",
"new int[q]",
"q",
"for(int j=0; j<q; j++){\n\t\t\tT[j]=sc.nextInt();\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tT[j]=sc.nextInt();\n\t\t}",
"{\n\t\t\tT[j]=sc.nextInt();\n\t\t}",
"T[j]=sc.nextInt()",
"T[j]",
"T",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j=0; j<q; j++){\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tleft=0;\n\t\t\tright=n;\n\t\t\twhile(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"left=0",
"left",
"0",
"right=n",
"right",
"n",
"while(left<right){\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}",
"left<right",
"left",
"right",
"{\n\t\t\t\tmid=(left+right)/2;\n\t\t\t\t\n\t\t\t\tif(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}\n\t\t\t}",
"mid=(left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(T[j]==S[mid]){\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}",
"T[j]==S[mid]",
"T[j]",
"T",
"j",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tC++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C++",
"C",
"break;",
"if(T[j]<S[mid]){\n\t\t\t\t\tright=mid;\n\t\t\t\t}else if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}",
"T[j]<S[mid]",
"T[j]",
"T",
"j",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tright=mid;\n\t\t\t\t}",
"right=mid",
"right",
"mid",
"if(T[j]>S[mid]){\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}",
"T[j]>S[mid]",
"T[j]",
"T",
"j",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tleft=mid+1;\n\t\t\t\t}",
"left=mid+1",
"left",
"mid+1",
"mid",
"1",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"public static void main(String[]agrs){\n\t\tnew Main().n();\n\t}",
"main",
"{\n\t\tnew Main().n();\n\t}",
"new Main().n()",
"new Main().n",
"new Main()",
"String[]agrs",
"agrs"
] | import java.util.Scanner;
class Main{
Scanner sc = new Scanner(System.in);
int n;
int[] S;
int q;
int[] T;
int C;
int left;
int right;
int mid;
void n(){
n=sc.nextInt();
S=new int[n];
for(int i=0; i<n; i++){
S[i]=sc.nextInt();
}
q=sc.nextInt();
T=new int[q];
for(int j=0; j<q; j++){
T[j]=sc.nextInt();
}
for(int j=0; j<q; j++){
left=0;
right=n;
while(left<right){
mid=(left+right)/2;
if(T[j]==S[mid]){
C++;
break;
}else if(T[j]<S[mid]){
right=mid;
}else if(T[j]>S[mid]){
left=mid+1;
}
}
}
System.out.println(C);
}
public static void main(String[]agrs){
new Main().n();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
4,
13,
18,
13,
17,
13,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
4,
13,
18,
13,
17,
13,
14,
4,
13,
13,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
13,
13,
13,
17,
2,
18,
13,
13,
17,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
13,
29,
17,
29,
17,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
17,
13,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
13,
13,
2,
13,
17,
29,
4,
13,
13,
13,
2,
13,
17,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
243,
5
],
[
243,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
16,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
23,
25
],
[
16,
26
],
[
26,
27
],
[
27,
28
],
[
16,
29
],
[
30,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
35,
36
],
[
36,
37
],
[
8,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
8,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
88,
92
],
[
88,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
87,
98
],
[
86,
99
],
[
99,
100
],
[
100,
101
],
[
77,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
6,
108
],
[
108,
109
],
[
243,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
118,
119
],
[
118,
120
],
[
118,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
112,
133
],
[
133,
134
],
[
110,
135
],
[
135,
136
],
[
243,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
142,
146
],
[
139,
147
],
[
147,
148
],
[
147,
149
],
[
150,
151
],
[
150,
152
],
[
139,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
153,
166
],
[
167,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
175,
176
],
[
175,
177
],
[
139,
178
],
[
178,
179
],
[
137,
180
],
[
180,
181
],
[
137,
182
],
[
182,
183
],
[
243,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
191,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
199,
205
],
[
205,
206
],
[
199,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
208,
212
],
[
207,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
214,
217
],
[
214,
218
],
[
214,
219
],
[
219,
220
],
[
219,
221
],
[
207,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
223,
226
],
[
223,
227
],
[
227,
228
],
[
227,
229
],
[
223,
230
],
[
186,
231
],
[
231,
232
],
[
232,
233
],
[
184,
234
],
[
234,
235
],
[
184,
236
],
[
236,
237
],
[
184,
238
],
[
238,
239
],
[
184,
240
],
[
240,
241
],
[
0,
242
],
[
242,
243
],
[
242,
244
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}\n\t\n\tpublic static boolean sortedCheck(int[] nums) {\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tpublic static int[] stringToIntArray(String str, int len) {\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}\n\t\n\tpublic static int binarySearch(int[] sorted, int x, int start, int end) {\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}\n\t\n\tpublic static boolean sortedCheck(int[] nums) {\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tpublic static int[] stringToIntArray(String str, int len) {\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}\n\t\n\tpublic static int binarySearch(int[] sorted, int x, int start, int end) {\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String[] str = new String[4];",
"str",
"new String[4]",
"4",
"for(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < str.length",
"i",
"str.length",
"str",
"str.length",
"i++",
"i++",
"i",
"{\n\t\t\tstr[i] = sc.nextLine();\n\t\t}",
"{\n\t\t\tstr[i] = sc.nextLine();\n\t\t}",
"str[i] = sc.nextLine()",
"str[i]",
"str",
"i",
"sc.nextLine()",
"sc.nextLine",
"sc",
"sc.close()",
"sc.close",
"sc",
"int lenSort = Integer.parseInt(str[0]);",
"lenSort",
"Integer.parseInt(str[0])",
"Integer.parseInt",
"Integer",
"str[0]",
"str",
"0",
"int[] sorted = stringToIntArray(str[1], lenSort);",
"sorted",
"stringToIntArray(str[1], lenSort)",
"stringToIntArray",
"str[1]",
"str",
"1",
"lenSort",
"int lenUn = Integer.parseInt(str[2]);",
"lenUn",
"Integer.parseInt(str[2])",
"Integer.parseInt",
"Integer",
"str[2]",
"str",
"2",
"int[] unsorted = stringToIntArray(str[3], lenUn);",
"unsorted",
"stringToIntArray(str[3], lenUn)",
"stringToIntArray",
"str[3]",
"str",
"3",
"lenUn",
"if (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}",
"sortedCheck(sorted)",
"sortedCheck",
"sorted",
"{\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}",
"int n = 0;",
"n",
"0",
"for(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}",
"int u",
"unsorted",
"{\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}",
"if (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}",
"binarySearch(sorted, u, 0, sorted.length - 1) > 0",
"binarySearch(sorted, u, 0, sorted.length - 1)",
"binarySearch",
"sorted",
"u",
"0",
"sorted.length - 1",
"sorted.length",
"sorted",
"sorted.length",
"1",
"0",
"{\n\t\t\t\t\tn++;\n\t\t\t\t}",
"n++",
"n",
"System.out.println(n)",
"System.out.println",
"System.out",
"System",
"System.out",
"n",
"String[] args",
"args",
"public static boolean sortedCheck(int[] nums) {\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}",
"sortedCheck",
"{\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}",
"int n = nums[0];",
"n",
"nums[0]",
"nums",
"0",
"for(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}",
"int i",
"nums",
"{\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}",
"{\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}",
"if(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;",
"n <= i",
"n",
"i",
"{\n\t\t\t\tn = i;\n\t\t\t}",
"n = i",
"n",
"i",
"return false;",
"false",
"return true;",
"true",
"int[] nums",
"nums",
"public static int[] stringToIntArray(String str, int len) {\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}",
"stringToIntArray",
"{\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}",
"String[] strings = str.split(\" \", len);",
"strings",
"str.split(\" \", len)",
"str.split",
"str",
"\" \"",
"len",
"int[] nums = new int[strings.length];",
"nums",
"new int[strings.length]",
"strings.length",
"strings",
"strings.length",
"for(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < strings.length",
"i",
"strings.length",
"strings",
"strings.length",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}",
"{\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}",
"nums[i] = Integer.parseInt(strings[i])",
"nums[i]",
"nums",
"i",
"Integer.parseInt(strings[i])",
"Integer.parseInt",
"Integer",
"strings[i]",
"strings",
"i",
"return nums;",
"nums",
"String str",
"str",
"int len",
"len",
"public static int binarySearch(int[] sorted, int x, int start, int end) {\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}",
"if (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}",
"start <= end",
"start",
"end",
"{\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}",
"int mid = (start + end) / 2;",
"mid",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"if (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);",
"sorted[mid] == x",
"sorted[mid]",
"sorted",
"mid",
"x",
"return 1;",
"1",
"if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);",
"sorted[mid] > x",
"sorted[mid]",
"sorted",
"mid",
"x",
"return binarySearch(sorted, x, start, mid - 1);",
"binarySearch(sorted, x, start, mid - 1)",
"binarySearch",
"sorted",
"x",
"start",
"mid - 1",
"mid",
"1",
"return binarySearch(sorted, x, mid + 1, end);",
"binarySearch(sorted, x, mid + 1, end)",
"binarySearch",
"sorted",
"x",
"mid + 1",
"mid",
"1",
"end",
"return -1;",
"-1",
"1",
"int[] sorted",
"sorted",
"int x",
"x",
"int start",
"start",
"int end",
"end",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}\n\t\n\tpublic static boolean sortedCheck(int[] nums) {\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tpublic static int[] stringToIntArray(String str, int len) {\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}\n\t\n\tpublic static int binarySearch(int[] sorted, int x, int start, int end) {\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] str = new String[4];\n\t\tfor(int i = 0; i < str.length; i++) {\n\t\t\tstr[i] = sc.nextLine();\n\t\t}\n\t\tsc.close();\n\t\tint lenSort = Integer.parseInt(str[0]);\n\t\tint[] sorted = stringToIntArray(str[1], lenSort);\n\t\tint lenUn = Integer.parseInt(str[2]);\n\t\tint[] unsorted = stringToIntArray(str[3], lenUn);\n\t\tif (sortedCheck(sorted)) {\n\t\t\tint n = 0;\n\t\t\tfor(int u: unsorted) {\n\t\t\t\tif (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(n);\n\t\t}\n\t}\n\t\n\tpublic static boolean sortedCheck(int[] nums) {\n\t\tint n = nums[0];\n\t\tfor(int i: nums) {\n\t\t\tif(n <= i) {\n\t\t\t\tn = i;\n\t\t\t}\n\t\t\telse return false;\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tpublic static int[] stringToIntArray(String str, int len) {\n\t\tString[] strings = str.split(\" \", len);\n\t\tint[] nums = new int[strings.length];\n\t\tfor(int i = 0; i < strings.length; i++) {\n\t\t\tnums[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn nums;\n\t}\n\t\n\tpublic static int binarySearch(int[] sorted, int x, int start, int end) {\n\t\tif (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif (sorted[mid] == x)\n\t\t\t\treturn 1;\n\t\t\telse if (sorted[mid] > x)\n\t\t\t\treturn binarySearch(sorted, x, start, mid - 1);\n\t\t\telse\n\t\t\t\treturn binarySearch(sorted, x, mid + 1, end);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] str = new String[4];
for(int i = 0; i < str.length; i++) {
str[i] = sc.nextLine();
}
sc.close();
int lenSort = Integer.parseInt(str[0]);
int[] sorted = stringToIntArray(str[1], lenSort);
int lenUn = Integer.parseInt(str[2]);
int[] unsorted = stringToIntArray(str[3], lenUn);
if (sortedCheck(sorted)) {
int n = 0;
for(int u: unsorted) {
if (binarySearch(sorted, u, 0, sorted.length - 1) > 0) {
n++;
}
}
System.out.println(n);
}
}
public static boolean sortedCheck(int[] nums) {
int n = nums[0];
for(int i: nums) {
if(n <= i) {
n = i;
}
else return false;
}
return true;
}
public static int[] stringToIntArray(String str, int len) {
String[] strings = str.split(" ", len);
int[] nums = new int[strings.length];
for(int i = 0; i < strings.length; i++) {
nums[i] = Integer.parseInt(strings[i]);
}
return nums;
}
public static int binarySearch(int[] sorted, int x, int start, int end) {
if (start <= end) {
int mid = (start + end) / 2;
if (sorted[mid] == x)
return 1;
else if (sorted[mid] > x)
return binarySearch(sorted, x, start, mid - 1);
else
return binarySearch(sorted, x, mid + 1, end);
}
return -1;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
14,
2,
2,
18,
13,
13,
17,
2,
4,
18,
18,
13,
17,
17,
17,
30,
0,
13,
4,
13,
17,
30,
0,
13,
4,
13,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
18,
13,
13,
13,
17,
30,
4,
13,
18,
13,
13,
0,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
2,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
13,
18,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
2,
13,
2,
2,
13,
13,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
13,
30,
0,
13,
17,
3,
14,
2,
4,
18,
13,
13,
13,
30,
4,
18,
13,
13,
13,
0,
13,
17,
3,
14,
2,
13,
17,
30,
4,
18,
13,
13,
23,
13,
12,
13,
30,
29,
20,
12,
13,
30,
29,
20,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
13,
29,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
23,
13,
23,
13,
12,
13,
30,
4,
13,
13,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
2,
4,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
30,
30,
14,
2,
2,
13,
13,
17,
30,
29,
17,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
472,
14
],
[
472,
15
],
[
15,
16
],
[
15,
17
],
[
472,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
24,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
30,
37
],
[
23,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
23,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
20,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
20,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
20,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
20,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
20,
69
],
[
69,
70
],
[
69,
71
],
[
20,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
72,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
88,
95
],
[
87,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
20,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
20,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
18,
113
],
[
113,
114
],
[
472,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
117,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
117,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
148,
149
],
[
149,
150
],
[
142,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
151,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
141,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
117,
178
],
[
178,
179
],
[
115,
180
],
[
180,
181
],
[
115,
182
],
[
182,
183
],
[
472,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
190,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
190,
200
],
[
200,
201
],
[
201,
202
],
[
190,
203
],
[
204,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
207,
210
],
[
206,
211
],
[
205,
212
],
[
212,
213
],
[
213,
214
],
[
213,
215
],
[
212,
216
],
[
205,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
218,
223
],
[
217,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
225,
228
],
[
225,
229
],
[
224,
230
],
[
230,
231
],
[
230,
232
],
[
224,
233
],
[
186,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
239,
242
],
[
184,
243
],
[
243,
244
],
[
472,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
472,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
250,
255
],
[
255,
256
],
[
472,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
262,
263
],
[
263,
264
],
[
259,
265
],
[
265,
266
],
[
266,
267
],
[
267,
268
],
[
266,
269
],
[
257,
270
],
[
270,
271
],
[
472,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
278,
279
],
[
274,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
282,
285
],
[
274,
286
],
[
286,
287
],
[
272,
288
],
[
288,
289
],
[
472,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
296,
297
],
[
292,
298
],
[
298,
299
],
[
298,
300
],
[
300,
301
],
[
301,
302
],
[
300,
303
],
[
292,
304
],
[
304,
305
],
[
304,
306
],
[
307,
308
],
[
307,
309
],
[
292,
310
],
[
310,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
310,
315
],
[
315,
316
],
[
315,
317
],
[
317,
318
],
[
317,
319
],
[
310,
320
],
[
320,
321
],
[
321,
322
],
[
310,
323
],
[
324,
324
],
[
324,
325
],
[
325,
326
],
[
326,
327
],
[
326,
328
],
[
325,
329
],
[
329,
330
],
[
330,
331
],
[
329,
332
],
[
332,
333
],
[
332,
334
],
[
292,
335
],
[
335,
336
],
[
290,
337
],
[
337,
338
],
[
472,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
344,
345
],
[
344,
346
],
[
341,
347
],
[
347,
348
],
[
347,
349
],
[
341,
351
],
[
351,
352
],
[
352,
353
],
[
353,
354
],
[
353,
355
],
[
351,
356
],
[
356,
357
],
[
356,
358
],
[
351,
359
],
[
359,
360
],
[
360,
361
],
[
351,
362
],
[
363,
363
],
[
363,
364
],
[
364,
365
],
[
365,
366
],
[
365,
367
],
[
364,
368
],
[
368,
369
],
[
368,
370
],
[
341,
371
],
[
371,
372
],
[
339,
373
],
[
373,
374
],
[
472,
375
],
[
375,
376
],
[
375,
377
],
[
377,
378
],
[
378,
379
],
[
379,
380
],
[
380,
381
],
[
380,
382
],
[
378,
383
],
[
383,
384
],
[
383,
385
],
[
378,
386
],
[
386,
387
],
[
387,
388
],
[
378,
389
],
[
390,
390
],
[
390,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
391,
396
],
[
396,
397
],
[
396,
398
],
[
390,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
402,
403
],
[
402,
404
],
[
399,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
408,
409
],
[
408,
410
],
[
406,
411
],
[
377,
412
],
[
412,
413
],
[
413,
414
],
[
414,
415
],
[
414,
416
],
[
412,
417
],
[
375,
418
],
[
418,
419
],
[
375,
420
],
[
420,
421
],
[
472,
422
],
[
422,
423
],
[
422,
424
],
[
424,
425
],
[
425,
426
],
[
425,
427
],
[
425,
428
],
[
428,
429
],
[
428,
430
],
[
422,
431
],
[
431,
432
],
[
472,
433
],
[
433,
434
],
[
433,
435
],
[
435,
436
],
[
436,
437
],
[
436,
438
],
[
438,
439
],
[
439,
440
],
[
440,
441
],
[
439,
442
],
[
438,
443
],
[
435,
444
],
[
444,
445
],
[
445,
446
],
[
446,
447
],
[
446,
448
],
[
444,
449
],
[
449,
450
],
[
449,
451
],
[
444,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
444,
456
],
[
457,
457
],
[
457,
458
],
[
458,
459
],
[
459,
460
],
[
460,
461
],
[
460,
462
],
[
459,
463
],
[
458,
464
],
[
464,
465
],
[
465,
466
],
[
435,
467
],
[
467,
468
],
[
433,
469
],
[
469,
470
],
[
0,
471
],
[
471,
472
],
[
471,
473
]
] | [
"import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\n\n\npublic class Main {\n\tstatic ArrayList<Integer> list = new ArrayList<Integer>();\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n\tpublic static boolean member( int t, int[] num ) {\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}\n\tpublic static void slist(int v) {\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}\n\tpublic static BufferedReader getReader() {\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}\n\tpublic static BufferedReader getReader(String path) throws Exception{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}\n\tpublic static int getInt(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}\n\tpublic static String[] getAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}\n\tpublic static int[] getIntAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}\n\tpublic static int[] getAryMl(BufferedReader br)throws Exception {\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}\n\tpublic static void putAry(int[] ary, int num) {\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}\n\tpublic static void putAry(int[] ary) {\n\t\tputAry(ary, ary.length ) ;\n\t}\n\tpublic static boolean isPrime(int n) {\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.FileInputStream;",
"FileInputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n\tstatic ArrayList<Integer> list = new ArrayList<Integer>();\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n\tpublic static boolean member( int t, int[] num ) {\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}\n\tpublic static void slist(int v) {\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}\n\tpublic static BufferedReader getReader() {\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}\n\tpublic static BufferedReader getReader(String path) throws Exception{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}\n\tpublic static int getInt(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}\n\tpublic static String[] getAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}\n\tpublic static int[] getIntAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}\n\tpublic static int[] getAryMl(BufferedReader br)throws Exception {\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}\n\tpublic static void putAry(int[] ary, int num) {\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}\n\tpublic static void putAry(int[] ary) {\n\t\tputAry(ary, ary.length ) ;\n\t}\n\tpublic static boolean isPrime(int n) {\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n}",
"Main",
"static ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br;",
"br",
"if( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}",
"args.length > 0 && args[0].equals(\"File\") == true",
"args.length > 0",
"args.length",
"args",
"args.length",
"0",
"args[0].equals(\"File\") == true",
"args[0].equals(\"File\")",
"args[0].equals",
"args[0]",
"args",
"0",
"\"File\"",
"true",
"{\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t}",
"br = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\")",
"br",
"getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\")",
"getReader",
"\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\"",
"{\n\t\t\tbr = getReader();\n\t\t}",
"br = getReader()",
"br",
"getReader()",
"getReader",
"int snum = getInt(br);",
"snum",
"getInt(br)",
"getInt",
"br",
"int[] snumAry = getIntAry(br);",
"snumAry",
"getIntAry(br)",
"getIntAry",
"br",
"int tnum = getInt(br);",
"tnum",
"getInt(br)",
"getInt",
"br",
"int[] tnumAry = getIntAry(br);",
"tnumAry",
"getIntAry(br)",
"getIntAry",
"br",
"int count = 0;",
"count",
"0",
"for( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int t = 0;",
"int t = 0;",
"t",
"0",
"t < tnumAry.length",
"t",
"tnumAry.length",
"tnumAry",
"tnumAry.length",
"t++",
"t++",
"t",
"{\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}",
"member(tnumAry[t], snumAry) == true",
"member(tnumAry[t], snumAry)",
"member",
"tnumAry[t]",
"tnumAry",
"t",
"snumAry",
"true",
"{\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}",
"slist(tnumAry[t])",
"slist",
"tnumAry[t]",
"tnumAry",
"t",
"count = list.size()",
"count",
"list.size()",
"list.size",
"list",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static boolean member( int t, int[] num ) {\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}",
"member",
"{\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}",
"int i = 0;",
"i",
"0",
"int j = num.length-1;",
"j",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"int k = i + (j-i)/2 ;",
"k",
"i + (j-i)/2",
"i",
"(j-i)/2",
"(j-i)",
"j",
"i",
"2",
"while(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}",
"i<=j",
"i",
"j",
"{\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}",
"if (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}",
"t == num[k]",
"t",
"num[k]",
"num",
"k",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}",
"t > num[k]",
"t",
"num[k]",
"num",
"k",
"{\n\t\t\t\ti = k+1;\n\t\t\t}",
"i = k+1",
"i",
"k+1",
"k",
"1",
"{\n\t\t\t\tj = k-1;\n\t\t\t}",
"j = k-1",
"j",
"k-1",
"k",
"1",
"k = i + (j-i)/2",
"k",
"i + (j-i)/2",
"i",
"(j-i)/2",
"(j-i)",
"j",
"i",
"2",
"return false;",
"false",
"int t",
"t",
"int[] num",
"num",
"public static void slist(int v) {\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}",
"slist",
"{\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}",
"boolean insert = false;",
"insert",
"false",
"for( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < list.size()",
"i",
"list.size()",
"list.size",
"list",
"i++",
"i++",
"i",
"{\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}",
"list.get(i) == v",
"list.get(i)",
"list.get",
"list",
"i",
"v",
"{\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}",
"insert = true",
"insert",
"true",
"break;",
"if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}",
"list.get(i) > v",
"list.get(i)",
"list.get",
"list",
"i",
"v",
"{\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}",
"list.add(i,v)",
"list.add",
"list",
"i",
"v",
"insert = true",
"insert",
"true",
"break;",
"if ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}",
"insert == false",
"insert",
"false",
"{\n\t\t\tlist.add(v);\n\t\t}",
"list.add(v)",
"list.add",
"list",
"v",
"int v",
"v",
"public static BufferedReader getReader() {\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}",
"getReader",
"{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}",
"return( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));",
"( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)))",
"public static BufferedReader getReader(String path) throws Exception{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}",
"getReader",
"{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}",
"return( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));",
"( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))))",
"String path",
"path",
"public static int getInt(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}",
"getInt",
"{\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}",
"String line = br.readLine();",
"line",
"br.readLine()",
"br.readLine",
"br",
"return Integer.valueOf(line);",
"Integer.valueOf(line)",
"Integer.valueOf",
"Integer",
"line",
"BufferedReader br",
"br",
"public static String[] getAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}",
"getAry",
"{\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}",
"String line = br.readLine();",
"line",
"br.readLine()",
"br.readLine",
"br",
"String[] nstr = line.split(\" \");",
"nstr",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"return nstr;",
"nstr",
"BufferedReader br",
"br",
"public static int[] getIntAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}",
"getIntAry",
"{\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}",
"String line = br.readLine();",
"line",
"br.readLine()",
"br.readLine",
"br",
"String[] nstr = line.split(\" \");",
"nstr",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int[] n = new int[nstr.length];",
"n",
"new int[nstr.length]",
"nstr.length",
"nstr",
"nstr.length",
"for( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i < nstr.length",
"i",
"nstr.length",
"nstr",
"nstr.length",
"i++",
"i++",
"i",
"{\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}",
"{\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}",
"n[i] = Integer.valueOf(nstr[i])",
"n[i]",
"n",
"i",
"Integer.valueOf(nstr[i])",
"Integer.valueOf",
"Integer",
"nstr[i]",
"nstr",
"i",
"return n;",
"n",
"BufferedReader br",
"br",
"public static int[] getAryMl(BufferedReader br)throws Exception {\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}",
"getAryMl",
"{\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}",
"int n = getInt(br);",
"n",
"getInt(br)",
"getInt",
"br",
"int[] ary = new int[n];",
"ary",
"new int[n]",
"n",
"for( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = getInt(br);\n\t\t}",
"{\n\t\t\tary[i] = getInt(br);\n\t\t}",
"ary[i] = getInt(br)",
"ary[i]",
"ary",
"i",
"getInt(br)",
"getInt",
"br",
"return ary;",
"ary",
"BufferedReader br",
"br",
"public static void putAry(int[] ary, int num) {\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}",
"putAry",
"{\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}",
"for( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(ary[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"ary[i]",
"ary",
"i",
"if ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i < num-1",
"i",
"num-1",
"num",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"int[] ary",
"ary",
"int num",
"num",
"public static void putAry(int[] ary) {\n\t\tputAry(ary, ary.length ) ;\n\t}",
"putAry",
"{\n\t\tputAry(ary, ary.length ) ;\n\t}",
"putAry(ary, ary.length )",
"putAry",
"ary",
"ary.length",
"ary",
"ary.length",
"int[] ary",
"ary",
"public static boolean isPrime(int n) {\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"isPrime",
"{\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"int r = (int)Math.sqrt((double)n)+1;",
"r",
"(int)Math.sqrt((double)n)+1",
"(int)Math.sqrt((double)n)",
"Math.sqrt",
"Math",
"(double)n",
"1",
"for( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"int j = 2 ;",
"int j = 2 ;",
"j",
"2",
"j < r",
"j",
"r",
"j += 1",
"j += 1",
"j",
"1",
"{\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"if ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}",
"n%j == 0",
"n%j",
"n",
"j",
"0",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"int n",
"n",
"public class Main {\n\tstatic ArrayList<Integer> list = new ArrayList<Integer>();\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n\tpublic static boolean member( int t, int[] num ) {\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}\n\tpublic static void slist(int v) {\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}\n\tpublic static BufferedReader getReader() {\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}\n\tpublic static BufferedReader getReader(String path) throws Exception{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}\n\tpublic static int getInt(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}\n\tpublic static String[] getAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}\n\tpublic static int[] getIntAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}\n\tpublic static int[] getAryMl(BufferedReader br)throws Exception {\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}\n\tpublic static void putAry(int[] ary, int num) {\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}\n\tpublic static void putAry(int[] ary) {\n\t\tputAry(ary, ary.length ) ;\n\t}\n\tpublic static boolean isPrime(int n) {\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n}",
"public class Main {\n\tstatic ArrayList<Integer> list = new ArrayList<Integer>();\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br;\n\t\tif( args.length > 0 && args[0].equals(\"File\") == true ) {\n\t\t\tbr = getReader(\"C:\\\\Users\\\\USER\\\\Downloads\\\\ALDS1_4_A-in8.txt\");\n\t\t} else {\n\t\t\tbr = getReader();\n\t\t}\n\t\tint snum = getInt(br);\n\t\tint[] snumAry = getIntAry(br);\n\t\tint tnum = getInt(br);\n\t\tint[] tnumAry = getIntAry(br);\n\t\tint count = 0;\n\t\tfor( int t = 0; t < tnumAry.length ; t++ ) {\n\t\t\tif ( member(tnumAry[t], snumAry) == true ) {\n\t\t\t\tslist(tnumAry[t]);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcount = list.size();\n//\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n\tpublic static boolean member( int t, int[] num ) {\n\t\tint i = 0;\n\t\tint j = num.length-1;\n\t\tint k = i + (j-i)/2 ;\n\t\twhile(i<=j) {\n\t\t\tif (t == num[k]) {\n\t\t\t\treturn true;\n\t\t\t} else if ( t > num[k]) {\n\t\t\t\ti = k+1;\n\t\t\t} else {\n\t\t\t\tj = k-1;\n\t\t\t}\n\t\t\tk = i + (j-i)/2;\n\t\t}\n\t\treturn false;\n\t}\n\tpublic static void slist(int v) {\n\t\tboolean insert = false;\n\t\tfor( int i = 0 ; i < list.size() ; i++ ) {\n\t\t\tif ( list.get(i) == v) {\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t} else if ( list.get(i) > v ) {\n\t\t\t\tlist.add(i,v);\n\t\t\t\tinsert = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( insert == false ) {\n\t\t\tlist.add(v);\n\t\t}\n\t}\n\tpublic static BufferedReader getReader() {\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in)));\n\t}\n\tpublic static BufferedReader getReader(String path) throws Exception{\n\t\treturn( new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(path))));\n\t}\n\tpublic static int getInt(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\treturn Integer.valueOf(line);\n\t}\n\tpublic static String[] getAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\treturn nstr;\n\t}\n\tpublic static int[] getIntAry(BufferedReader br)throws Exception {\n\t\tString line = br.readLine();\n\t\tString[] nstr = line.split(\" \");\n\t\tint[] n = new int[nstr.length];\n\t\tfor( int i=0 ; i < nstr.length ; i++ ) {\n\t\t\tn[i] = Integer.valueOf(nstr[i]);\n\t\t}\n\t\treturn n;\n\t}\n\tpublic static int[] getAryMl(BufferedReader br)throws Exception {\n\t\tint n = getInt(br);\n\t\tint[] ary = new int[n];\n\t\tfor( int i=0 ; i < n ; i++ ) {\n\t\t\tary[i] = getInt(br);\n\t\t}\n\t\treturn ary;\n\t}\n\tpublic static void putAry(int[] ary, int num) {\n\t\tfor( int i = 0; i < num ; i++ ) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif ( i < num-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}\n\tpublic static void putAry(int[] ary) {\n\t\tputAry(ary, ary.length ) ;\n\t}\n\tpublic static boolean isPrime(int n) {\n\t\tint r = (int)Math.sqrt((double)n)+1;\n\t\tfor( int j = 2 ; j < r ; j += 1) {\n\t\t\tif ( n%j == 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
static ArrayList<Integer> list = new ArrayList<Integer>();
public static void main(String[] args) throws Exception {
BufferedReader br;
if( args.length > 0 && args[0].equals("File") == true ) {
br = getReader("C:\\Users\\USER\\Downloads\\ALDS1_4_A-in8.txt");
} else {
br = getReader();
}
int snum = getInt(br);
int[] snumAry = getIntAry(br);
int tnum = getInt(br);
int[] tnumAry = getIntAry(br);
int count = 0;
for( int t = 0; t < tnumAry.length ; t++ ) {
if ( member(tnumAry[t], snumAry) == true ) {
slist(tnumAry[t]);
// break;
}
}
count = list.size();
// System.out.println("");
System.out.println(count);
}
public static boolean member( int t, int[] num ) {
int i = 0;
int j = num.length-1;
int k = i + (j-i)/2 ;
while(i<=j) {
if (t == num[k]) {
return true;
} else if ( t > num[k]) {
i = k+1;
} else {
j = k-1;
}
k = i + (j-i)/2;
}
return false;
}
public static void slist(int v) {
boolean insert = false;
for( int i = 0 ; i < list.size() ; i++ ) {
if ( list.get(i) == v) {
insert = true;
break;
} else if ( list.get(i) > v ) {
list.add(i,v);
insert = true;
break;
}
}
if ( insert == false ) {
list.add(v);
}
}
public static BufferedReader getReader() {
return( new BufferedReader(new InputStreamReader(
System.in)));
}
public static BufferedReader getReader(String path) throws Exception{
return( new BufferedReader(new InputStreamReader(
new FileInputStream(path))));
}
public static int getInt(BufferedReader br)throws Exception {
String line = br.readLine();
return Integer.valueOf(line);
}
public static String[] getAry(BufferedReader br)throws Exception {
String line = br.readLine();
String[] nstr = line.split(" ");
return nstr;
}
public static int[] getIntAry(BufferedReader br)throws Exception {
String line = br.readLine();
String[] nstr = line.split(" ");
int[] n = new int[nstr.length];
for( int i=0 ; i < nstr.length ; i++ ) {
n[i] = Integer.valueOf(nstr[i]);
}
return n;
}
public static int[] getAryMl(BufferedReader br)throws Exception {
int n = getInt(br);
int[] ary = new int[n];
for( int i=0 ; i < n ; i++ ) {
ary[i] = getInt(br);
}
return ary;
}
public static void putAry(int[] ary, int num) {
for( int i = 0; i < num ; i++ ) {
System.out.print(ary[i]);
if ( i < num-1) {
System.out.print(" ");
}
}
System.out.println("");
}
public static void putAry(int[] ary) {
putAry(ary, ary.length ) ;
}
public static boolean isPrime(int n) {
int r = (int)Math.sqrt((double)n)+1;
for( int j = 2 ; j < r ; j += 1) {
if ( n%j == 0 ) {
return false;
}
}
return true;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
4,
18,
13,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
41,
13,
4,
18,
13,
20,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
167,
11
],
[
167,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
14,
52
],
[
52,
53
],
[
52,
54
],
[
14,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
14,
76
],
[
76,
77
],
[
76,
78
],
[
14,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
91,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
120,
125
],
[
112,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
126,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
14,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
148,
151
],
[
14,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
14,
161
],
[
161,
162
],
[
162,
163
],
[
12,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}\n\n}\n",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"S[i] = scan.nextInt()",
"S[i]",
"S",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"T[i] = scan.nextInt()",
"T[i]",
"T",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Set<Integer> C = new HashSet<Integer>();",
"C",
"new HashSet<Integer>()",
"for (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int head = 0;",
"head",
"0",
"int tail = n - 1;",
"tail",
"n - 1",
"n",
"1",
"while(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}",
"head <= tail",
"head",
"tail",
"{\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}",
"int center = (head + tail) / 2;",
"center",
"(head + tail) / 2",
"(head + tail)",
"head",
"tail",
"2",
"if(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}",
"S[center] == T[i]",
"S[center]",
"S",
"center",
"T[i]",
"T",
"i",
"{\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"C.add(i)",
"C.add",
"C",
"i",
"break;",
"if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}",
"S[center] < T[i]",
"S[center]",
"S",
"center",
"T[i]",
"T",
"i",
"{\n\t\t\t\t\thead = center + 1;\n\t\t\t\t}",
"head = center + 1",
"head",
"center + 1",
"center",
"1",
"{\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}",
"tail = center - 1",
"tail",
"center - 1",
"center",
"1",
"Integer[] afterC = C.toArray(new Integer[0]);",
"afterC",
"C.toArray(new Integer[0])",
"C.toArray",
"C",
"new Integer[0]",
"0",
"System.out.println(afterC.length)",
"System.out.println",
"System.out",
"System",
"System.out",
"afterC.length",
"afterC",
"afterC.length",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\n\t\tSet<Integer> C = new HashSet<Integer>();\n\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint head = 0;\n\t\t\tint tail = n - 1;\n\n\t\t\twhile(head <= tail) {\n\t\t\t\tint center = (head + tail) / 2;\n\t\t\t\tif(S[center] == T[i]){\n\t\t\t\t\tC.add(i);\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (S[center] < T[i]) {\n\t\t\t\t\thead = center + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttail = center - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tInteger[] afterC = C.toArray(new Integer[0]);\n\t\tSystem.out.println(afterC.length);\n\n\t\tscan.close();\n\t}\n\n}",
"Main"
] | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = scan.nextInt();
}
int q = scan.nextInt();
int[] T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = scan.nextInt();
}
Set<Integer> C = new HashSet<Integer>();
for (int i = 0; i < q; i++) {
int head = 0;
int tail = n - 1;
while(head <= tail) {
int center = (head + tail) / 2;
if(S[center] == T[i]){
C.add(i);
break;
} else if (S[center] < T[i]) {
head = center + 1;
} else {
tail = center - 1;
}
}
}
Integer[] afterC = C.toArray(new Integer[0]);
System.out.println(afterC.length);
scan.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
13,
17,
0,
13,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
40,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
164,
5
],
[
164,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
8,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
8,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
101,
110
],
[
110,
111
],
[
110,
112
],
[
101,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
125,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
139,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"import java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args){\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}",
"int n",
"n",
"q",
"q",
"i",
"i",
"j",
"j",
"ans=0",
"ans",
"0",
"left",
"left",
"right",
"right",
"mid",
"mid",
"key;",
"key",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n=sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int s[]=new int[n];",
"s",
"new int[n]",
"n",
"for(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\ts[i]=sc.nextInt();\n\t\t}",
"s[i]=sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"q=sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int t[]=new int[q];",
"t",
"new int[q]",
"q",
"for(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tt[j]=sc.nextInt();\n\t\t}",
"{\n\t\t\tt[j]=sc.nextInt();\n\t\t}",
"t[j]=sc.nextInt()",
"t[j]",
"t",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}",
"{\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}",
"key=t[j]",
"key",
"t[j]",
"t",
"j",
"left=0",
"left",
"0",
"right=n",
"right",
"n",
"while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}",
"left<right",
"left",
"right",
"{\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}",
"mid=(left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }",
"s[mid]==key",
"s[mid]",
"s",
"mid",
"key",
"{\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }",
"left=right+1",
"left",
"right+1",
"right",
"1",
"ans++",
"ans",
"if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }",
"key<s[mid]",
"key",
"s[mid]",
"s",
"mid",
"{\n\t\t\t \tright=mid;\n\t\t\t }",
"right=mid",
"right",
"mid",
"{\n\t\t\t \tleft=mid+1;\n\t\t\t }",
"left=mid+1",
"left",
"mid+1",
"mid",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// TODO ?????????????????????????????????????????????\n\t\tint n,q,i,j,ans=0,left,right,mid,key;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tint s[]=new int[n];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=sc.nextInt();\n\t\t}\n\t\tq=sc.nextInt();\n\t\tint t[]=new int[q];\n\t\tfor(j=0;j<q;j++){\n\t\t\tt[j]=sc.nextInt();\n\t\t}\n\n\t\tfor(j=0;j<q;j++){\n\t\t\tkey=t[j];\n\t\t\tleft=0;\n\t\t right=n;\n\t\t while(left<right){\n\t\t \tmid=(left+right)/2;\n\n\t\t\t if(s[mid]==key){\n\t\t\t \tleft=right+1;\n\t\t\t ans++;\n\t\t\t }else if(key<s[mid]){\n\t\t\t \tright=mid;\n\t\t\t }else{\n\t\t\t \tleft=mid+1;\n\t\t\t }\n\t\t\t}\n\n\n\t\t}\n\t\tSystem.out.println(ans);\n\n\n\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args){
// TODO ?????????????????????????????????????????????
int n,q,i,j,ans=0,left,right,mid,key;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
int s[]=new int[n];
for(i=0;i<n;i++){
s[i]=sc.nextInt();
}
q=sc.nextInt();
int t[]=new int[q];
for(j=0;j<q;j++){
t[j]=sc.nextInt();
}
for(j=0;j<q;j++){
key=t[j];
left=0;
right=n;
while(left<right){
mid=(left+right)/2;
if(s[mid]==key){
left=right+1;
ans++;
}else if(key<s[mid]){
right=mid;
}else{
left=mid+1;
}
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
13,
30,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
196,
11
],
[
196,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
77,
79
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
104,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
120,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
14,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
12,
137
],
[
137,
138
],
[
196,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
141,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
154,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
162,
168
],
[
168,
169
],
[
169,
170
],
[
162,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
171,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
171,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
141,
189
],
[
189,
190
],
[
139,
191
],
[
191,
192
],
[
139,
193
],
[
193,
194
],
[
0,
195
],
[
195,
196
],
[
195,
197
]
] | [
"import java.io.BufferedReader;\n//import java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n//import java.util.Arrays;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}\n\tpublic static boolean binarySearch(int t, int[] s){\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}\n\tpublic static boolean binarySearch(int t, int[] s){\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}",
"main",
"{\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] l = br.readLine().split(\" \");",
"l",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"{\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}",
"{\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}",
"s[i] = Integer.parseInt(l[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(l[i])",
"Integer.parseInt",
"Integer",
"l[i]",
"l",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"l = br.readLine().split(\" \")",
"l",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}",
"{\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}",
"t[i] = Integer.parseInt(l[i])",
"t[i]",
"t",
"i",
"Integer.parseInt(l[i])",
"Integer.parseInt",
"Integer",
"l[i]",
"l",
"i",
"int cnt = 0;",
"cnt",
"0",
"for(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}",
"if(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}",
"binarySearch(t[i], s)",
"binarySearch",
"t[i]",
"t",
"i",
"s",
"{\n\t\t\t\tcnt += 1;\n\t\t\t}",
"cnt += 1",
"cnt",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public static boolean binarySearch(int t, int[] s){\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"int l = 0;",
"l",
"0",
"int r = s.length;",
"r",
"s.length",
"s",
"s.length",
"while(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}",
"l <= r",
"l",
"r",
"{\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}",
"int mid = (l + r) / 2;",
"mid",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}",
"s[mid] == t",
"s[mid]",
"s",
"mid",
"t",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}",
"s[mid] < t",
"s[mid]",
"s",
"mid",
"t",
"{\n\t\t\t\tl = mid + 1;\n\t\t\t}",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"{\n\t\t\t\tr = mid - 1;\n\t\t\t}",
"r = mid - 1",
"r",
"mid - 1",
"mid",
"1",
"return false;",
"false",
"int t",
"t",
"int[] s",
"s",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}\n\tpublic static boolean binarySearch(int t, int[] s){\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//System.setIn(new FileInputStream(\"./ALDS1_4_B-in1.txt\"));\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t//int[] s = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tString[] l = br.readLine().split(\" \");\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\ts[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(br.readLine());\n\t\t//int[] t = Arrays.stream(br.readLine().split(\" \")).mapToInt(Integer::parseInt).toArray();\n\t\tl = br.readLine().split(\" \");\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tt[i] = Integer.parseInt(l[i]);\n\t\t}\n\t\t\n\t\t//long start = System.nanoTime();\n\t\tint cnt = 0;\n\t\tfor(int i = 0; i < q; ++i) {\n\t\t\tif(binarySearch(t[i], s)){\n\t\t\t\tcnt += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\t//System.out.println(\"Time:\" + (System.nanoTime() - start) / 1000000f + \" ms\");\n\n\t}\n\tpublic static boolean binarySearch(int t, int[] s){\n\t\tint l = 0;\n\t\tint r = s.length;\n\t\twhile(l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif(s[mid] == t) {\n\t\t\t\treturn true;\n\t\t\t}else if(s[mid] < t){\n\t\t\t\tl = mid + 1;\n\t\t\t}else{\n\t\t\t\tr = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.util.Arrays;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
//System.setIn(new FileInputStream("./ALDS1_4_B-in1.txt"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
//int[] s = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
String[] l = br.readLine().split(" ");
int[] s = new int[n];
for(int i = 0; i < n; ++i) {
s[i] = Integer.parseInt(l[i]);
}
int q = Integer.parseInt(br.readLine());
//int[] t = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
l = br.readLine().split(" ");
int[] t = new int[q];
for(int i = 0; i < q; ++i) {
t[i] = Integer.parseInt(l[i]);
}
//long start = System.nanoTime();
int cnt = 0;
for(int i = 0; i < q; ++i) {
if(binarySearch(t[i], s)){
cnt += 1;
}
}
System.out.println(cnt);
//System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms");
}
public static boolean binarySearch(int t, int[] s){
int l = 0;
int r = s.length;
while(l <= r) {
int mid = (l + r) / 2;
if(s[mid] == t) {
return true;
}else if(s[mid] < t){
l = mid + 1;
}else{
r = mid - 1;
}
}
return false;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
99,
5
],
[
99,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] S = new long[n];",
"S",
"new long[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextLong();\n\t\t}",
"S[i] = sc.nextLong()",
"S[i]",
"S",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"long T = sc.nextLong();",
"T",
"sc.nextLong()",
"sc.nextLong",
"sc",
"for(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"if(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"T == S[i]",
"T",
"S[i]",
"S",
"i",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] S = new long[n];\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextLong();\n\t\t}\n\n\t\tint q = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tlong T = sc.nextLong();\n\t\t\tfor(int i = 0; i < n; i++) {\n\t\t\t\tif(T == S[i]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] S = new long[n];
for(int i = 0; i < n; i++) {
S[i] = sc.nextLong();
}
int q = sc.nextInt();
int count = 0;
for(int j = 0; j < q; j++) {
long T = sc.nextLong();
for(int i = 0; i < n; i++) {
if(T == S[i]) {
count++;
break;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
13,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
17,
41,
13,
20,
17,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
4,
13,
13,
13,
18,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
22,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
33,
35
],
[
30,
36
],
[
36,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
49,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
6,
61
],
[
61,
62
],
[
6,
63
],
[
63,
64
],
[
6,
65
],
[
65,
66
],
[
4,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
69,
77
],
[
77,
78
],
[
77,
79
],
[
69,
81
],
[
81,
82
],
[
81,
83
],
[
69,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
69,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
69,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
69,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
113,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
69,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
132,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
146,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
145,
153
],
[
144,
154
],
[
154,
155
],
[
69,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
67,
162
],
[
162,
163
]
] | [
"import java.util.*;\n\nclass Main {\n\t//????????¢?´¢?????¬???\n\tpublic static int binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n ;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}\n\treturn -1;\n\t}\n\n\tpublic static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;\n\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\t//????????¢?´¢?????¬???\n\tpublic static int binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n ;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}\n\treturn -1;\n\t}\n\n\tpublic static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;\n\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"//????????¢?´¢?????¬???\n\tpublic static int binarySearch(int[] A, int n, int key) {\n\t\tint left = 0;\n\t\tint right = n ;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}\n\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n ;\n\t\tint mid = 0;\n\t\twhile(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}\n\treturn -1;\n\t}",
"int left = 0;",
"left",
"0",
"int right = n ;",
"right",
"n",
"int mid = 0;",
"mid",
"0",
"while(left < right) {\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t mid = (left + right) / 2;\n\t\t\tif ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;\n\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if ( key == A[mid] ) return mid;\n\t\t\telse if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;",
"key == A[mid]",
"key",
"A[mid]",
"A",
"mid",
"return mid;",
"mid",
"if ( key > A[mid] ) left = mid + 1;\n\t\t\telse if ( key < A[mid] ) right = mid;",
"key > A[mid]",
"key",
"A[mid]",
"A",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if ( key < A[mid] ) right = mid;",
"key < A[mid]",
"key",
"A[mid]",
"A",
"mid",
"right = mid",
"right",
"mid",
"return -1;",
"-1",
"1",
"int[] A",
"A",
"int n",
"n",
"int key",
"key",
"public static void main(String args[]) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint[] arrayS = new int[100000]; //??°???S\n\t\tint[] arrayT = new int[50000]; //??°???T\n\t\tint count = 0;\t\t\t\t\t\t //?????°????¨???????????????°\n\n\t\t//????´??????°???????????????ArrayS?????°???S???????????????\n\t\tint sNum = scan.nextInt();\n\t\tfor (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();\n\n\t\t//????´??????°???????????????ArrayT?????°???T???????????????\n\t\tint tNum = scan.nextInt();\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();\n\n\t\t//??°???T???????´??????°???A????????????????????????????????????\n\t\tfor (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;\n\n\t\tSystem.out.println(count);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int[] arrayS = new int[100000];",
"arrayS",
"new int[100000]",
"100000",
"int[] arrayT = new int[50000];",
"arrayT",
"new int[50000]",
"50000",
"int count = 0;",
"count",
"0",
"int sNum = scan.nextInt();",
"sNum",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int i = 0; i < sNum; i++)\n\t\t\tarrayS[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sNum",
"i",
"sNum",
"i++",
"i++",
"i",
"arrayS[i] = scan.nextInt();",
"arrayS[i] = scan.nextInt()",
"arrayS[i]",
"arrayS",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int tNum = scan.nextInt();",
"tNum",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int j = 0; j < tNum; j++)\n\t\t\tarrayT[j] = scan.nextInt();",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < tNum",
"j",
"tNum",
"j++",
"j++",
"j",
"arrayT[j] = scan.nextInt();",
"arrayT[j] = scan.nextInt()",
"arrayT[j]",
"arrayT",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int j = 0; j < tNum; j++)\n\t\t\tif(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < tNum",
"j",
"tNum",
"j++",
"j++",
"j",
"if(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;",
"if(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;",
"binarySearch(arrayS, sNum, arrayT[j]) >= 0",
"binarySearch(arrayS, sNum, arrayT[j])",
"binarySearch",
"arrayS",
"sNum",
"arrayT[j]",
"arrayT",
"j",
"0",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args"
] | import java.util.*;
class Main {
//????????¢?´¢?????¬???
public static int binarySearch(int[] A, int n, int key) {
int left = 0;
int right = n ;
int mid = 0;
while(left < right) {
mid = (left + right) / 2;
if ( key == A[mid] ) return mid;
else if ( key > A[mid] ) left = mid + 1;
else if ( key < A[mid] ) right = mid;
}
return -1;
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int[] arrayS = new int[100000]; //??°???S
int[] arrayT = new int[50000]; //??°???T
int count = 0; //?????°????¨???????????????°
//????´??????°???????????????ArrayS?????°???S???????????????
int sNum = scan.nextInt();
for (int i = 0; i < sNum; i++)
arrayS[i] = scan.nextInt();
//????´??????°???????????????ArrayT?????°???T???????????????
int tNum = scan.nextInt();
for (int j = 0; j < tNum; j++)
arrayT[j] = scan.nextInt();
//??°???T???????´??????°???A????????????????????????????????????
for (int j = 0; j < tNum; j++)
if(binarySearch(arrayS, sNum, arrayT[j]) >= 0) count++;
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
12,
13,
30,
41,
13,
20,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
14,
2,
13,
17,
30,
38,
5,
13,
30,
4,
18,
13,
30,
4,
18,
13,
30,
0,
13,
20,
4,
13,
13,
12,
13,
30,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
17,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
40,
13,
3,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
17,
41,
13,
2,
18,
13,
13,
8,
13,
17,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
214,
11
],
[
214,
12
],
[
12,
13
],
[
12,
14
],
[
214,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
15,
24
],
[
24,
25
],
[
214,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
32,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
45,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
32,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
60,
62
],
[
214,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
65,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
82,
87
],
[
65,
88
],
[
88,
89
],
[
88,
90
],
[
65,
91
],
[
91,
92
],
[
91,
93
],
[
91,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
95,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
110,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
110,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
65,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
63,
157
],
[
157,
158
],
[
214,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
161,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
174,
177
],
[
161,
178
],
[
178,
179
],
[
178,
180
],
[
161,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
182,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
189,
191
],
[
182,
192
],
[
192,
193
],
[
193,
194
],
[
182,
195
],
[
196,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
204,
205
],
[
204,
206
],
[
161,
207
],
[
207,
208
],
[
159,
209
],
[
209,
210
],
[
159,
211
],
[
211,
212
],
[
0,
213
],
[
213,
214
],
[
213,
215
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n/**\n * 境界部分には気をつける(そこだけ別で処理するというのもあり)\n * 逆再生することで簡単になることもある\n */\npublic class Main {\n public Main() {\n }\n\n public static void main(String[] args ) {\n Main main = new Main();\n main.exec();\n }\n\n public void exec() {\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }\n\n public void exec_body( BufferedReader bf ) throws IOException {\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }\n\n public int[] toList( String str, boolean isBanhei ) {\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public Main() {\n }\n\n public static void main(String[] args ) {\n Main main = new Main();\n main.exec();\n }\n\n public void exec() {\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }\n\n public void exec_body( BufferedReader bf ) throws IOException {\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }\n\n public int[] toList( String str, boolean isBanhei ) {\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }\n}",
"Main",
"public Main() {\n }",
"Main",
"{\n }",
"public static void main(String[] args ) {\n Main main = new Main();\n main.exec();\n }",
"main",
"{\n Main main = new Main();\n main.exec();\n }",
"Main main = new Main();",
"main",
"new Main()",
"main.exec()",
"main.exec",
"main",
"String[] args",
"args",
"public void exec() {\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }",
"exec",
"{\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }",
"BufferedReader bf = null;",
"bf",
"null",
"try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }",
"if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"bf != null",
"bf",
"null",
"{\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n bf.close();\n }",
"bf.close()",
"bf.close",
"bf",
"{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n }",
"bf = new BufferedReader(new InputStreamReader(System.in))",
"bf",
"new BufferedReader(new InputStreamReader(System.in))",
"exec_body(bf)",
"exec_body",
"bf",
"public void exec_body( BufferedReader bf ) throws IOException {\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }",
"exec_body",
"{\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }",
"bf.readLine()",
"bf.readLine",
"bf",
"int[] sAry = toList(bf.readLine(),false);",
"sAry",
"toList(bf.readLine(),false)",
"toList",
"bf.readLine()",
"bf.readLine",
"bf",
"false",
"bf.readLine()",
"bf.readLine",
"bf",
"int[] tAry = toList(bf.readLine(),false);",
"tAry",
"toList(bf.readLine(),false)",
"toList",
"bf.readLine()",
"bf.readLine",
"bf",
"false",
"int cnt = 0;",
"cnt",
"0",
"for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }",
"int tVal",
"tAry",
"{\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }",
"{\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }",
"int left = 0;",
"left",
"0",
"int right = sAry.length - 1;",
"right",
"sAry.length - 1",
"sAry.length",
"sAry",
"sAry.length",
"1",
"while( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}",
"left <= right",
"left",
"right",
"{\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}",
"int middle = ( left + right ) / 2;",
"middle",
"( left + right ) / 2",
"( left + right )",
"left",
"right",
"2",
"int middleVal = sAry[middle];",
"middleVal",
"sAry[middle]",
"sAry",
"middle",
"if( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}",
"middleVal == tVal",
"middleVal",
"tVal",
"{\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t}",
"cnt++",
"cnt",
"break;",
"if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}",
"middleVal > tVal",
"middleVal",
"tVal",
"{\n \t\t\t\tright = middle - 1;\n \t\t\t}",
"right = middle - 1",
"right",
"middle - 1",
"middle",
"1",
"if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}",
"middleVal < tVal",
"middleVal",
"tVal",
"{\n \t\t\t\tleft = middle +1;\n \t\t\t}",
"left = middle +1",
"left",
"middle +1",
"middle",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"BufferedReader bf",
"bf",
"public int[] toList( String str, boolean isBanhei ) {\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }",
"toList",
"{\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }",
"String[] elements = str.split(\" \");",
"elements",
"str.split(\" \")",
"str.split",
"str",
"\" \"",
"int arysize = elements.length + ( (isBanhei) ? 1 : 0 );",
"arysize",
"elements.length + ( (isBanhei) ? 1 : 0 )",
"elements.length",
"elements",
"elements.length",
"( (isBanhei) ? 1 : 0 )",
"(isBanhei)",
"1",
"0",
"int[] ret = new int [arysize];",
"ret",
"new int [arysize]",
"arysize",
"for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < elements.length",
"i",
"elements.length",
"elements",
"elements.length",
"i++",
"i++",
"i",
"{\n ret[i] = Integer.valueOf(elements[i]);\n }",
"{\n ret[i] = Integer.valueOf(elements[i]);\n }",
"ret[i] = Integer.valueOf(elements[i])",
"ret[i]",
"ret",
"i",
"Integer.valueOf(elements[i])",
"Integer.valueOf",
"Integer",
"elements[i]",
"elements",
"i",
"return ret;",
"ret",
"String str",
"str",
"boolean isBanhei",
"isBanhei",
"public class Main {\n public Main() {\n }\n\n public static void main(String[] args ) {\n Main main = new Main();\n main.exec();\n }\n\n public void exec() {\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }\n\n public void exec_body( BufferedReader bf ) throws IOException {\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }\n\n public int[] toList( String str, boolean isBanhei ) {\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }\n}",
"public class Main {\n public Main() {\n }\n\n public static void main(String[] args ) {\n Main main = new Main();\n main.exec();\n }\n\n public void exec() {\n BufferedReader bf = null;\n try{\n bf = new BufferedReader(new InputStreamReader(System.in));\n exec_body(bf);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally{\n if( bf != null ) {\n try {\n bf.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }\n\n public void exec_body( BufferedReader bf ) throws IOException {\n bf.readLine();\n int[] sAry = toList(bf.readLine(),false);\n bf.readLine();\n int[] tAry = toList(bf.readLine(),false);\n\n int cnt = 0;\n for( int tVal : tAry ) {\n \t\tint left = 0;\n \t\tint right = sAry.length - 1;\n \t\twhile( left <= right ) {\n \t\t\tint middle = ( left + right ) / 2;\n \t\t\tint middleVal = sAry[middle];\n \t\t\tif( middleVal == tVal ) {\n \t\t\t\tcnt++;\n \t\t\t\tbreak;\n \t\t\t} else if ( middleVal > tVal ) {\n \t\t\t\tright = middle - 1;\n \t\t\t} else if( middleVal < tVal ) {\n \t\t\t\tleft = middle +1;\n \t\t\t}\n \t\t}\n }\n\n System.out.println(cnt);\n }\n\n public int[] toList( String str, boolean isBanhei ) {\n String[] elements = str.split(\" \");\n int arysize = elements.length + ( (isBanhei) ? 1 : 0 );\n int[] ret = new int [arysize];\n for( int i = 0; i < elements.length; i++ ) {\n ret[i] = Integer.valueOf(elements[i]);\n }\n\n return ret;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* 境界部分には気をつける(そこだけ別で処理するというのもあり)
* 逆再生することで簡単になることもある
*/
public class Main {
public Main() {
}
public static void main(String[] args ) {
Main main = new Main();
main.exec();
}
public void exec() {
BufferedReader bf = null;
try{
bf = new BufferedReader(new InputStreamReader(System.in));
exec_body(bf);
} catch (IOException e) {
e.printStackTrace();
}
finally{
if( bf != null ) {
try {
bf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public void exec_body( BufferedReader bf ) throws IOException {
bf.readLine();
int[] sAry = toList(bf.readLine(),false);
bf.readLine();
int[] tAry = toList(bf.readLine(),false);
int cnt = 0;
for( int tVal : tAry ) {
int left = 0;
int right = sAry.length - 1;
while( left <= right ) {
int middle = ( left + right ) / 2;
int middleVal = sAry[middle];
if( middleVal == tVal ) {
cnt++;
break;
} else if ( middleVal > tVal ) {
right = middle - 1;
} else if( middleVal < tVal ) {
left = middle +1;
}
}
}
System.out.println(cnt);
}
public int[] toList( String str, boolean isBanhei ) {
String[] elements = str.split(" ");
int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
int[] ret = new int [arysize];
for( int i = 0; i < elements.length; i++ ) {
ret[i] = Integer.valueOf(elements[i]);
}
return ret;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
13,
17,
0,
13,
2,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
133,
5
],
[
133,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
8,
52
],
[
52,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
69,
75
],
[
75,
76
],
[
75,
77
],
[
69,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
69,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
95,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
105,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
8,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
123,
129
],
[
6,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
]
] | [
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int t",
"t",
"mid",
"mid",
"r",
"r",
"l",
"l",
"cnt=0;",
"cnt",
"0",
"for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }",
"{\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }",
"t = sc.nextInt()",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"l = 0",
"l",
"0",
"r = n - 1",
"r",
"n - 1",
"n",
"1",
"while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }",
"l <= r",
"l",
"r",
"{\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }",
"mid = (l + r) / 2",
"mid",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }",
"s[mid] == t",
"s[mid]",
"s",
"mid",
"t",
"{\n cnt++;\n break;\n }",
"cnt++",
"cnt",
"break;",
"if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }",
"s[mid] > t",
"s[mid]",
"s",
"mid",
"t",
"{\n r = mid - 1;\n }",
"r = mid - 1",
"r",
"mid - 1",
"mid",
"1",
"{\n l = mid + 1;\n }",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"System.out.printf(\"%d%n\",cnt)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d%n\"",
"cnt",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] s = new int[n];\n for(int i = 0; i < n; i++){\n s[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int t,mid,r,l,cnt=0;\n for(int i = 0; i < q; i++){\n t = sc.nextInt();\n l = 0;\n r = n - 1;\n while ( l <= r ){\n mid = (l + r) / 2;\n if(s[mid] == t) {\n cnt++;\n break;\n }\n else if (s[mid] > t) {\n r = mid - 1;\n }\n else {\n l = mid + 1;\n }\n }\n }\n System.out.printf(\"%d%n\",cnt);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
for(int i = 0; i < n; i++){
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int t,mid,r,l,cnt=0;
for(int i = 0; i < q; i++){
t = sc.nextInt();
l = 0;
r = n - 1;
while ( l <= r ){
mid = (l + r) / 2;
if(s[mid] == t) {
cnt++;
break;
}
else if (s[mid] > t) {
r = mid - 1;
}
else {
l = mid + 1;
}
}
}
System.out.printf("%d%n",cnt);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
4,
18,
13,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
14,
2,
2,
18,
13,
17,
13,
2,
18,
13,
2,
13,
17,
13,
29,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
2,
2,
13,
13,
17,
17,
14,
2,
18,
13,
13,
13,
29,
17,
29,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
166,
5
],
[
166,
6
],
[
6,
7
],
[
166,
8
],
[
8,
9
],
[
166,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
12,
21
],
[
21,
22
],
[
21,
23
],
[
12,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
12,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
12,
49
],
[
49,
50
],
[
49,
51
],
[
12,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
12,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
12,
79
],
[
79,
80
],
[
80,
81
],
[
10,
82
],
[
82,
83
],
[
166,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
93,
94
],
[
86,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
95,
109
],
[
109,
110
],
[
86,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
123,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
137,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
86,
161
],
[
161,
162
],
[
84,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\n\n\tstatic int S[];\n\tstatic int n;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}\n\n\tstatic boolean search(int t) {\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\n\tstatic int S[];\n\tstatic int n;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}\n\n\tstatic boolean search(int t) {\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n}",
"Main",
"static int S[];",
"S",
"static int n;",
"n",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for(int i = 0;i < n;i++)S[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = scan.nextInt();",
"S[i] = scan.nextInt()",
"S[i]",
"S",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int c = 0;",
"c",
"0",
"for(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}",
"{\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}",
"if(search(scan.nextInt()))c++;",
"search(scan.nextInt())",
"search",
"scan.nextInt()",
"scan.nextInt",
"scan",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"static boolean search(int t) {\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}",
"search",
"{\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}",
"int l = 0",
"l",
"0",
"r = n",
"r",
"n",
"mid;",
"mid",
"if(S[0] > t || S[n-1] < t)return false;",
"S[0] > t || S[n-1] < t",
"S[0] > t",
"S[0]",
"S",
"0",
"t",
"S[n-1] < t",
"S[n-1]",
"S",
"n-1",
"n",
"1",
"t",
"return false;",
"false",
"while(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}",
"l<r",
"l",
"r",
"{\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}",
"mid = (l+r)/2",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;",
"S[mid] > t",
"S[mid]",
"S",
"mid",
"t",
"{\n\t\t\t\tr = (l+r)/2;\n\t\t\t}",
"r = (l+r)/2",
"r",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;",
"S[mid] < t",
"S[mid]",
"S",
"mid",
"t",
"{\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}",
"l = (l+r)/2+1",
"l",
"(l+r)/2+1",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"1",
"if(S[mid] == t)return true;",
"S[mid] == t",
"S[mid]",
"S",
"mid",
"t",
"return true;",
"true",
"return false;",
"false",
"int t",
"t",
"public class Main {\n\n\n\tstatic int S[];\n\tstatic int n;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}\n\n\tstatic boolean search(int t) {\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n}",
"public class Main {\n\n\n\tstatic int S[];\n\tstatic int n;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tS = new int[n];\n\t\tfor(int i = 0;i < n;i++)S[i] = scan.nextInt();\n\t\tint q = scan.nextInt();\n\t\tint c = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tif(search(scan.nextInt()))c++;\n\n\t\t}\n\n\t\tSystem.out.println(c);\n\t\tscan.close();\n\n\t}\n\n\tstatic boolean search(int t) {\n\t\tint l = 0, r = n, mid;\n\t\tif(S[0] > t || S[n-1] < t)return false;\n\n\t\twhile(l<r) {\n\t\t\tmid = (l+r)/2;\n\t\t\tif(S[mid] > t) {\n\t\t\t\tr = (l+r)/2;\n\t\t\t}else if(S[mid] < t){\n\t\t\t\tl = (l+r)/2+1;\n\t\t\t}else if(S[mid] == t)return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static int S[];
static int n;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
S = new int[n];
for(int i = 0;i < n;i++)S[i] = scan.nextInt();
int q = scan.nextInt();
int c = 0;
for(int i = 0;i < q;i++) {
if(search(scan.nextInt()))c++;
}
System.out.println(c);
scan.close();
}
static boolean search(int t) {
int l = 0, r = n, mid;
if(S[0] > t || S[n-1] < t)return false;
while(l<r) {
mid = (l+r)/2;
if(S[mid] > t) {
r = (l+r)/2;
}else if(S[mid] < t){
l = (l+r)/2+1;
}else if(S[mid] == t)return true;
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
13,
14,
13,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
141,
5
],
[
141,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
69,
73
],
[
61,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
8,
84
],
[
84,
85
],
[
85,
86
],
[
6,
87
],
[
87,
88
],
[
141,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
91,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
110,
116
],
[
116,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
91,
132
],
[
132,
133
],
[
89,
134
],
[
134,
135
],
[
89,
136
],
[
136,
137
],
[
89,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }\n public static boolean binarySearch(int[] S, int n, int T) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }\n public static boolean binarySearch(int[] S, int n, int T) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int C = 0;",
"C",
"0",
"for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }",
"{\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }",
"int T = sc.nextInt();",
"T",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean answer = binarySearch(S, n, T);",
"answer",
"binarySearch(S, n, T)",
"binarySearch",
"S",
"n",
"T",
"if (answer) C++;",
"answer",
"C++",
"C",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public static boolean binarySearch(int[] S, int n, int T) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;",
"S[mid] == T",
"S[mid]",
"S",
"mid",
"T",
"return true;",
"true",
"if (T < S[mid]) right = mid;\n else left = mid + 1;",
"T < S[mid]",
"T",
"S[mid]",
"S",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] S",
"S",
"int n",
"n",
"int T",
"T",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }\n public static boolean binarySearch(int[] S, int n, int T) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int C = 0;\n for (int i = 0; i < q; i++) {\n int T = sc.nextInt();\n boolean answer = binarySearch(S, n, T);\n if (answer) C++;\n }\n System.out.println(C);\n sc.close();\n }\n public static boolean binarySearch(int[] S, int n, int T) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (S[mid] == T) return true;\n else if (T < S[mid]) right = mid;\n else left = mid + 1;\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int C = 0;
for (int i = 0; i < q; i++) {
int T = sc.nextInt();
boolean answer = binarySearch(S, n, T);
if (answer) C++;
}
System.out.println(C);
sc.close();
}
public static boolean binarySearch(int[] S, int n, int T) {
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right) / 2;
if (S[mid] == T) return true;
else if (T < S[mid]) right = mid;
else left = mid + 1;
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
105,
5
],
[
105,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }",
"main",
"{\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }",
"Scanner tx = new Scanner(System.in);",
"tx",
"new Scanner(System.in)",
"int a",
"a",
"b",
"b",
"c",
"c",
"cont = 0;",
"cont",
"0",
"a = tx.nextInt()",
"a",
"tx.nextInt()",
"tx.nextInt",
"tx",
"int arre[] = new int[a];",
"arre",
"new int[a]",
"a",
"for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n arre[i]=tx.nextInt();\n }",
"{\n arre[i]=tx.nextInt();\n }",
"arre[i]=tx.nextInt()",
"arre[i]",
"arre",
"i",
"tx.nextInt()",
"tx.nextInt",
"tx",
"b = tx.nextInt()",
"b",
"tx.nextInt()",
"tx.nextInt",
"tx",
"for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < b",
"i",
"b",
"i++",
"i++",
"i",
"{\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }",
"{\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }",
"c=tx.nextInt()",
"c",
"tx.nextInt()",
"tx.nextInt",
"tx",
"for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < a",
"j",
"a",
"j++",
"j++",
"j",
"{\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }",
"{\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }",
"if (c==arre[j]) {\n cont++;\n break;\n \n }",
"c==arre[j]",
"c",
"arre[j]",
"arre",
"j",
"{\n cont++;\n break;\n \n }",
"cont++",
"cont",
"break;",
"System.out.println(cont)",
"System.out.println",
"System.out",
"System",
"System.out",
"cont",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner tx = new Scanner(System.in);\n\n int a, b,c, cont = 0;\n\n a = tx.nextInt();\n int arre[] = new int[a];\n for (int i = 0; i < a; i++) {\n arre[i]=tx.nextInt();\n }\n b = tx.nextInt();\n for (int i = 0; i < b; i++) {\n c=tx.nextInt();\n for (int j = 0; j < a; j++) {\n if (c==arre[j]) {\n cont++;\n break;\n \n }\n }\n }\n System.out.println(cont);\n\n }\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner tx = new Scanner(System.in);
int a, b,c, cont = 0;
a = tx.nextInt();
int arre[] = new int[a];
for (int i = 0; i < a; i++) {
arre[i]=tx.nextInt();
}
b = tx.nextInt();
for (int i = 0; i < b; i++) {
c=tx.nextInt();
for (int j = 0; j < a; j++) {
if (c==arre[j]) {
cont++;
break;
}
}
}
System.out.println(cont);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
18,
13,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
109,
14
],
[
109,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
15,
20
],
[
20,
21
],
[
109,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
28,
30
],
[
24,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
24,
36
],
[
36,
37
],
[
36,
38
],
[
24,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
24,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
24,
65
],
[
65,
66
],
[
65,
67
],
[
24,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
24,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
0,
108
],
[
108,
109
],
[
108,
110
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tALDS1_4_B();\n\t}\n\n\tpublic static void ALDS1_4_B() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tALDS1_4_B();\n\t}\n\n\tpublic static void ALDS1_4_B() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tALDS1_4_B();\n\t}",
"main",
"{\n\t\tALDS1_4_B();\n\t}",
"ALDS1_4_B()",
"ALDS1_4_B",
"String[] args",
"args",
"public static void ALDS1_4_B() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"ALDS1_4_B",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int ans = 0;",
"ans",
"0",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = sc.nextInt();\n\t\t}",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[n];",
"T",
"new int[n]",
"n",
"for(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}",
"Arrays.binarySearch(S, T[i]) >= 0",
"Arrays.binarySearch(S, T[i])",
"Arrays.binarySearch",
"Arrays",
"S",
"T[i]",
"T",
"i",
"0",
"{\n\t\t\t\tans++;\n\t\t\t}",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tALDS1_4_B();\n\t}\n\n\tpublic static void ALDS1_4_B() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tALDS1_4_B();\n\t}\n\n\tpublic static void ALDS1_4_B() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint ans = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[n];\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(S, T[i]) >= 0) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) {
ALDS1_4_B();
}
public static void ALDS1_4_B() {
Scanner sc = new Scanner(System.in);
int ans = 0;
int n = sc.nextInt();
int[] S = new int[n];
for(int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[n];
for(int i = 0; i < q; i++) {
T[i] = sc.nextInt();
if(Arrays.binarySearch(S, T[i]) >= 0) {
ans++;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
4,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
13,
4,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
146,
11
],
[
146,
12
],
[
12,
13
],
[
146,
14
],
[
14,
15
],
[
146,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
18,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
40,
47
],
[
39,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
39,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
52,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
52,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
31,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
16,
76
],
[
76,
77
],
[
146,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
80,
89
],
[
89,
90
],
[
89,
91
],
[
80,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
92,
103
],
[
104,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
80,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
80,
116
],
[
116,
117
],
[
116,
118
],
[
80,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
119,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
80,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
78,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] | [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic List<Integer> s;\n\tstatic int count;\n\n\tpublic static void binarySearch(int value) {\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic List<Integer> s;\n\tstatic int count;\n\n\tpublic static void binarySearch(int value) {\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"static List<Integer> s;",
"s",
"static int count;",
"count",
"public static void binarySearch(int value) {\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}",
"binarySearch",
"{\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}",
"int left = 0",
"left",
"0",
"right = s.size();",
"right",
"s.size()",
"s.size",
"s",
"while (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"s.get(mid).intValue() == value",
"s.get(mid).intValue()",
"s.get(mid).intValue",
"s.get(mid)",
"s.get",
"s",
"mid",
"value",
"{\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t}",
"count++",
"count",
"break;",
"if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"value < s.get(mid)",
"value",
"s.get(mid)",
"s.get",
"s",
"mid",
"{\n\t\t\t\tright = mid;\n\t\t\t}",
"right = mid",
"right",
"mid",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"int value",
"value",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"s = new ArrayList<>()",
"s",
"new ArrayList<>()",
"for(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts.add(sc.nextInt());\n\t\t}",
"{\n\t\t\ts.add(sc.nextInt());\n\t\t}",
"s.add(sc.nextInt())",
"s.add",
"s",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"count = 0",
"count",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}",
"{\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}",
"binarySearch(sc.nextInt())",
"binarySearch",
"sc.nextInt()",
"sc.nextInt",
"sc",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tstatic List<Integer> s;\n\tstatic int count;\n\n\tpublic static void binarySearch(int value) {\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tstatic List<Integer> s;\n\tstatic int count;\n\n\tpublic static void binarySearch(int value) {\n\t\tint left = 0, right = s.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (s.get(mid).intValue() == value) {\n\t\t\t\tcount++;\n\t\t\t\tbreak;\n\t\t\t} else if(value < s.get(mid)){\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t\tmid = (left + right) / 2;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\ts = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ts.add(sc.nextInt());\n\t\t}\n\t\tint q = sc.nextInt();\n\t\tcount = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(sc.nextInt());\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
static List<Integer> s;
static int count;
public static void binarySearch(int value) {
int left = 0, right = s.size();
while (left < right) {
int mid = (left + right) / 2;
if (s.get(mid).intValue() == value) {
count++;
break;
} else if(value < s.get(mid)){
right = mid;
} else {
left = mid + 1;
}
mid = (left + right) / 2;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
s = new ArrayList<>();
for(int i = 0; i < n; i++) {
s.add(sc.nextInt());
}
int q = sc.nextInt();
count = 0;
for (int i = 0; i < q; i++) {
binarySearch(sc.nextInt());
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
172,
5
],
[
172,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
73,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
88,
95
],
[
95,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
6,
103
],
[
103,
104
],
[
172,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
107,
118
],
[
118,
119
],
[
107,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
132,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
141,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
141,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
107,
165
],
[
165,
166
],
[
105,
167
],
[
167,
168
],
[
105,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(final String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] S, int key) {\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(final String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] S, int key) {\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(final String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextInt();\n }",
"{\n T[i] = sc.nextInt();\n }",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n if (binarySearch(S, T[i]))\n count++;\n }",
"{\n if (binarySearch(S, T[i]))\n count++;\n }",
"if (binarySearch(S, T[i]))\n count++;",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"final String[] args",
"args",
"private static boolean binarySearch(int[] S, int key) {\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = S.length - 1;",
"right",
"S.length - 1",
"S.length",
"S",
"S.length",
"1",
"int mid;",
"mid",
"while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }",
"left <= right",
"left",
"right",
"{\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }",
"mid = (right + left) / 2",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }",
"S[mid] < key",
"S[mid]",
"S",
"mid",
"key",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if (S[mid] > key) {\n right = mid - 1;\n }",
"S[mid] > key",
"S[mid]",
"S",
"mid",
"key",
"{\n right = mid - 1;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"return false;",
"false",
"int[] S",
"S",
"int key",
"key",
"public class Main {\n public static void main(final String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] S, int key) {\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }\n}",
"public class Main {\n public static void main(final String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = sc.nextInt();\n }\n int q = sc.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]))\n count++;\n }\n System.out.println(count);\n }\n\n private static boolean binarySearch(int[] S, int key) {\n int left = 0;\n int right = S.length - 1;\n int mid;\n while (left <= right) {\n mid = (right + left) / 2;\n if (S[mid] == key) {\n return true;\n } else if (S[mid] < key) {\n left = mid + 1;\n } else if (S[mid] > key) {\n right = mid - 1;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(final String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[q];
for (int i = 0; i < q; i++) {
T[i] = sc.nextInt();
}
int count = 0;
for (int i = 0; i < T.length; i++) {
if (binarySearch(S, T[i]))
count++;
}
System.out.println(count);
}
private static boolean binarySearch(int[] S, int key) {
int left = 0;
int right = S.length - 1;
int mid;
while (left <= right) {
mid = (right + left) / 2;
if (S[mid] == key) {
return true;
} else if (S[mid] < key) {
left = mid + 1;
} else if (S[mid] > key) {
right = mid - 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
39,
40,
17,
17,
17,
17,
41,
13,
39,
17,
17,
17,
40,
17,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
13,
13,
17,
2,
13,
17,
18,
13,
13,
41,
13,
4,
13,
13,
17,
2,
13,
17,
18,
13,
13,
0,
13,
4,
18,
13,
17,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
29,
2,
13,
17,
14,
2,
13,
18,
13,
13,
29,
13,
41,
13,
2,
13,
17,
41,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
2,
13,
13,
17,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
13,
29,
2,
13,
17,
14,
2,
13,
18,
13,
13,
29,
13,
41,
13,
2,
13,
17,
41,
13,
13,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
2,
13,
13,
17,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
0,
18,
36,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
40,
2,
2,
13,
17,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
4,
13,
18,
13,
13,
40,
13,
12,
13,
30,
4,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
2,
2,
2,
13,
17,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
37,
20,
0,
13,
2,
2,
2,
13,
17,
13,
17,
0,
13,
4,
13,
29,
8,
13,
40,
13,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
4,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
659,
14
],
[
659,
15
],
[
15,
16
],
[
15,
17
],
[
659,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
20,
24
],
[
20,
25
],
[
659,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
28,
31
],
[
28,
32
],
[
32,
33
],
[
659,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
40,
42
],
[
36,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
36,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
36,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
36,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
36,
65
],
[
65,
66
],
[
65,
67
],
[
36,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
68,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
85,
92
],
[
92,
93
],
[
92,
94
],
[
82,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
97,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
97,
104
],
[
104,
105
],
[
104,
106
],
[
82,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
36,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
34,
122
],
[
122,
123
],
[
659,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
126,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
137,
143
],
[
143,
144
],
[
126,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
126,
150
],
[
150,
151
],
[
150,
152
],
[
126,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
162,
168
],
[
159,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
169,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
169,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
126,
183
],
[
183,
184
],
[
124,
185
],
[
185,
186
],
[
124,
187
],
[
187,
188
],
[
124,
189
],
[
189,
190
],
[
124,
191
],
[
191,
192
],
[
659,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
196,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
195,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
209,
211
],
[
206,
212
],
[
212,
213
],
[
195,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
216,
218
],
[
195,
219
],
[
219,
220
],
[
219,
221
],
[
195,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
223,
227
],
[
222,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
231,
237
],
[
228,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
239,
243
],
[
238,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
238,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
195,
252
],
[
252,
253
],
[
193,
254
],
[
254,
255
],
[
193,
256
],
[
256,
257
],
[
193,
258
],
[
258,
259
],
[
193,
260
],
[
260,
261
],
[
659,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
262,
266
],
[
266,
267
],
[
266,
268
],
[
262,
270
],
[
270,
271
],
[
262,
272
],
[
272,
273
],
[
262,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
281
],
[
276,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
282,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
286,
290
],
[
274,
291
],
[
291,
292
],
[
262,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
297,
299
],
[
296,
300
],
[
300,
301
],
[
301,
302
],
[
301,
303
],
[
300,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
308,
309
],
[
304,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
313,
316
],
[
300,
317
],
[
317,
318
],
[
318,
319
],
[
318,
320
],
[
317,
321
],
[
321,
322
],
[
295,
323
],
[
323,
324
],
[
262,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
328,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
334,
335
],
[
328,
336
],
[
336,
337
],
[
337,
338
],
[
262,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
344,
348
],
[
348,
349
],
[
348,
350
],
[
339,
351
],
[
351,
352
],
[
262,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
358,
359
],
[
357,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
362,
364
],
[
356,
365
],
[
365,
366
],
[
262,
367
],
[
367,
368
],
[
367,
369
],
[
369,
370
],
[
370,
371
],
[
369,
372
],
[
372,
373
],
[
373,
374
],
[
262,
375
],
[
375,
376
],
[
375,
377
],
[
377,
378
],
[
378,
379
],
[
379,
380
],
[
380,
381
],
[
378,
382
],
[
382,
383
],
[
377,
384
],
[
384,
385
],
[
384,
386
],
[
377,
387
],
[
387,
388
],
[
387,
389
],
[
389,
390
],
[
377,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
391,
396
],
[
396,
397
],
[
397,
398
],
[
398,
399
],
[
397,
400
],
[
396,
401
],
[
401,
402
],
[
401,
403
],
[
403,
404
],
[
377,
405
],
[
405,
406
],
[
406,
407
],
[
407,
408
],
[
262,
409
],
[
409,
410
],
[
409,
411
],
[
411,
412
],
[
412,
413
],
[
413,
414
],
[
414,
415
],
[
412,
416
],
[
416,
417
],
[
411,
418
],
[
418,
419
],
[
418,
420
],
[
420,
421
],
[
411,
422
],
[
422,
423
],
[
423,
424
],
[
423,
425
],
[
422,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
411,
430
],
[
430,
431
],
[
430,
432
],
[
411,
433
],
[
433,
434
],
[
434,
435
],
[
434,
436
],
[
433,
437
],
[
437,
438
],
[
438,
439
],
[
438,
440
],
[
437,
441
],
[
441,
442
],
[
441,
443
],
[
443,
444
],
[
411,
445
],
[
445,
446
],
[
445,
447
],
[
411,
448
],
[
448,
449
],
[
449,
450
],
[
450,
451
],
[
450,
452
],
[
448,
453
],
[
453,
454
],
[
454,
455
],
[
455,
456
],
[
456,
457
],
[
456,
458
],
[
455,
459
],
[
459,
460
],
[
459,
461
],
[
454,
462
],
[
462,
463
],
[
453,
464
],
[
464,
465
],
[
464,
466
],
[
466,
467
],
[
467,
468
],
[
468,
469
],
[
468,
470
],
[
467,
471
],
[
466,
472
],
[
453,
473
],
[
473,
474
],
[
473,
475
],
[
475,
476
],
[
411,
477
],
[
477,
478
],
[
478,
479
],
[
478,
480
],
[
480,
481
],
[
478,
482
],
[
262,
483
],
[
483,
484
],
[
483,
485
],
[
485,
486
],
[
486,
487
],
[
487,
488
],
[
488,
489
],
[
486,
490
],
[
490,
491
],
[
485,
492
],
[
492,
493
],
[
492,
494
],
[
494,
495
],
[
485,
496
],
[
496,
497
],
[
497,
498
],
[
497,
499
],
[
496,
500
],
[
500,
501
],
[
500,
502
],
[
502,
503
],
[
485,
504
],
[
504,
505
],
[
504,
506
],
[
485,
507
],
[
507,
508
],
[
508,
509
],
[
508,
510
],
[
507,
511
],
[
511,
512
],
[
512,
513
],
[
512,
514
],
[
511,
515
],
[
515,
516
],
[
515,
517
],
[
517,
518
],
[
485,
519
],
[
519,
520
],
[
519,
521
],
[
485,
522
],
[
522,
523
],
[
523,
524
],
[
524,
525
],
[
524,
526
],
[
522,
527
],
[
527,
528
],
[
528,
529
],
[
529,
530
],
[
530,
531
],
[
530,
532
],
[
529,
533
],
[
533,
534
],
[
533,
535
],
[
528,
536
],
[
536,
537
],
[
527,
538
],
[
538,
539
],
[
538,
540
],
[
540,
541
],
[
541,
542
],
[
542,
543
],
[
542,
544
],
[
541,
545
],
[
540,
546
],
[
527,
547
],
[
547,
548
],
[
547,
549
],
[
549,
550
],
[
485,
551
],
[
551,
552
],
[
552,
553
],
[
552,
554
],
[
554,
555
],
[
552,
556
],
[
262,
557
],
[
557,
558
],
[
557,
559
],
[
559,
560
],
[
560,
561
],
[
561,
562
],
[
562,
563
],
[
561,
564
],
[
564,
565
],
[
262,
566
],
[
566,
567
],
[
566,
568
],
[
568,
569
],
[
569,
570
],
[
569,
571
],
[
568,
573
],
[
573,
574
],
[
574,
575
],
[
575,
576
],
[
575,
577
],
[
573,
578
],
[
578,
579
],
[
578,
580
],
[
573,
581
],
[
581,
582
],
[
582,
583
],
[
573,
584
],
[
584,
585
],
[
585,
586
],
[
586,
587
],
[
586,
588
],
[
585,
589
],
[
589,
590
],
[
568,
591
],
[
591,
592
],
[
566,
593
],
[
593,
594
],
[
262,
595
],
[
595,
596
],
[
595,
597
],
[
597,
598
],
[
598,
599
],
[
598,
600
],
[
597,
602
],
[
602,
603
],
[
603,
604
],
[
604,
605
],
[
604,
606
],
[
602,
607
],
[
607,
608
],
[
607,
609
],
[
602,
610
],
[
610,
611
],
[
611,
612
],
[
602,
613
],
[
613,
614
],
[
614,
615
],
[
615,
616
],
[
615,
617
],
[
614,
618
],
[
618,
619
],
[
597,
620
],
[
620,
621
],
[
595,
622
],
[
622,
623
],
[
262,
624
],
[
624,
625
],
[
624,
626
],
[
626,
627
],
[
627,
628
],
[
627,
629
],
[
626,
632
],
[
632,
633
],
[
633,
634
],
[
634,
635
],
[
634,
636
],
[
632,
637
],
[
637,
638
],
[
637,
639
],
[
632,
640
],
[
640,
641
],
[
641,
642
],
[
632,
643
],
[
643,
644
],
[
644,
645
],
[
645,
646
],
[
645,
647
],
[
644,
648
],
[
648,
649
],
[
649,
650
],
[
650,
651
],
[
626,
652
],
[
652,
653
],
[
624,
654
],
[
654,
655
],
[
624,
656
],
[
656,
657
],
[
0,
658
],
[
658,
659
],
[
658,
660
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\npublic class Main {\n\tstatic long MOD=1000000007;\n\tstatic int[] dx= {-1,1,0,0};\n\tstatic int[] dy= {0,0,1,-1};\n\tpublic static void main(String[] args){\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}//val以上の一番左にある要素のindexを返す(指定した範囲で)\n \n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\tstatic class InputReader { \n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n \n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n \n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n \n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n \n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n \n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n \n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n \n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}\n",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tstatic long MOD=1000000007;\n\tstatic int[] dx= {-1,1,0,0};\n\tstatic int[] dy= {0,0,1,-1};\n\tpublic static void main(String[] args){\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}//val以上の一番左にある要素のindexを返す(指定した範囲で)\n \n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\tstatic class InputReader { \n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n \n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n \n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n \n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n \n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n \n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n \n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n \n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"Main",
"static long MOD=1000000007;",
"MOD",
"1000000007",
"static int[] dx= {-1,1,0,0};",
"dx",
"{-1,1,0,0}",
"-1",
"1",
"1",
"0",
"0",
"static int[] dy= {0,0,1,-1};",
"dy",
"{0,0,1,-1}",
"0",
"0",
"1",
"-1",
"1",
"public static void main(String[] args){\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"InputReader sc=new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"int N=sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] S=sc.nextIntArray(N);",
"S",
"sc.nextIntArray(N)",
"sc.nextIntArray",
"sc",
"N",
"int Q=sc.nextInt();",
"Q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T=sc.nextIntArray(Q);",
"T",
"sc.nextIntArray(Q)",
"sc.nextIntArray",
"sc",
"Q",
"int sum=0;",
"sum",
"0",
"for (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}",
"{\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}",
"int hd=lower_bound(S,0,N-1, T[i]);",
"hd",
"lower_bound(S,0,N-1, T[i])",
"lower_bound",
"S",
"0",
"N-1",
"N",
"1",
"T[i]",
"T",
"i",
"int tl=upper_bound(S, 0, N-1, T[i]);",
"tl",
"upper_bound(S, 0, N-1, T[i])",
"upper_bound",
"S",
"0",
"N-1",
"N",
"1",
"T[i]",
"T",
"i",
"sum+=Math.min(1, tl-hd)",
"sum",
"Math.min(1, tl-hd)",
"Math.min",
"Math",
"1",
"tl-hd",
"tl",
"hd",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}//val以上の一番左にある要素のindexを返す(指定した範囲で)",
"lower_bound",
"{\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"if (val > a[toIndex])\n\t\t\treturn toIndex + 1;",
"val > a[toIndex]",
"val",
"a[toIndex]",
"a",
"toIndex",
"return toIndex + 1;",
"toIndex + 1",
"toIndex",
"1",
"if (val <= a[fromIndex])\n\t\t\treturn fromIndex;",
"val <= a[fromIndex]",
"val",
"a[fromIndex]",
"a",
"fromIndex",
"return fromIndex;",
"fromIndex",
"int lb = fromIndex - 1",
"lb",
"fromIndex - 1",
"fromIndex",
"1",
"ub = toIndex;",
"ub",
"toIndex",
"while (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"ub - lb > 1",
"ub - lb",
"ub",
"lb",
"1",
"{\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"int mid = (ub - lb)/2+lb;",
"mid",
"(ub - lb)/2+lb",
"(ub - lb)/2",
"(ub - lb)",
"ub",
"lb",
"2",
"lb",
"if (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}",
"a[mid] >= val",
"a[mid]",
"a",
"mid",
"val",
"{\n\t\t\t\tub = mid;\n\t\t\t}",
"ub = mid",
"ub",
"mid",
"{\n\t\t\t\tlb = mid;\n\t\t\t}",
"lb = mid",
"lb",
"mid",
"return ub;",
"ub",
"int[] a",
"a",
"int fromIndex",
"fromIndex",
"int toIndex",
"toIndex",
"int val",
"val",
"public static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"upper_bound",
"{\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}",
"if (val >= a[toIndex])\n\t\t\treturn toIndex + 1;",
"val >= a[toIndex]",
"val",
"a[toIndex]",
"a",
"toIndex",
"return toIndex + 1;",
"toIndex + 1",
"toIndex",
"1",
"if (val < a[fromIndex])\n\t\t\treturn fromIndex;",
"val < a[fromIndex]",
"val",
"a[fromIndex]",
"a",
"fromIndex",
"return fromIndex;",
"fromIndex",
"int lb = fromIndex - 1",
"lb",
"fromIndex - 1",
"fromIndex",
"1",
"ub = toIndex;",
"ub",
"toIndex",
"while (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"ub - lb > 1",
"ub - lb",
"ub",
"lb",
"1",
"{\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}",
"int mid = (ub - lb)/2+lb;",
"mid",
"(ub - lb)/2+lb",
"(ub - lb)/2",
"(ub - lb)",
"ub",
"lb",
"2",
"lb",
"if (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}",
"a[mid] > val",
"a[mid]",
"a",
"mid",
"val",
"{\n\t\t\t\tub = mid;\n\t\t\t}",
"ub = mid",
"ub",
"mid",
"{\n\t\t\t\tlb = mid;\n\t\t\t}",
"lb = mid",
"lb",
"mid",
"return ub;",
"ub",
"int[] a",
"a",
"int fromIndex",
"fromIndex",
"int toIndex",
"toIndex",
"int val",
"val",
"static class InputReader { \n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n \n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n \n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n \n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n \n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n \n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n \n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n \n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}",
"InputReader",
"private InputStream in;",
"in",
"private byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int curbuf;",
"curbuf",
"private int lenbuf;",
"lenbuf",
"public InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}",
"InputReader",
"{\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}",
"this.in = in",
"this.in",
"this",
"this.in",
"in",
"this.curbuf = this.lenbuf = 0",
"this.curbuf",
"this",
"this.curbuf",
"this.lenbuf = 0",
"this.lenbuf",
"this",
"this.lenbuf",
"0",
"InputStream in",
"in",
"public boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"hasNextByte",
"{\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"if (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}",
"curbuf >= lenbuf",
"curbuf",
"lenbuf",
"{\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}",
"curbuf = 0",
"curbuf",
"0",
"try {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t}",
"lenbuf = in.read(buffer)",
"lenbuf",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (lenbuf <= 0)\n\t\t\t\t\treturn false;",
"lenbuf <= 0",
"lenbuf",
"0",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}",
"readByte",
"{\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}",
"if (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[curbuf++];",
"buffer[curbuf++]",
"buffer",
"curbuf++",
"curbuf",
"return -1;",
"-1",
"1",
"private boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}",
"isSpaceChar",
"{\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}",
"return !(c >= 33 && c <= 126);",
"!(c >= 33 && c <= 126)",
"(c >= 33 && c <= 126)",
"c >= 33",
"c",
"33",
"c <= 126",
"c",
"126",
"int c",
"c",
"private void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}",
"skip",
"{\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}",
"while (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;",
"hasNextByte() && isSpaceChar(buffer[curbuf])",
"hasNextByte()",
"hasNextByte",
"isSpaceChar(buffer[curbuf])",
"isSpaceChar",
"buffer[curbuf]",
"buffer",
"curbuf",
"curbuf++",
"curbuf",
"public boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}",
"hasNext",
"{\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}",
"skip()",
"skip",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"next",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"!isSpaceChar(b)",
"isSpaceChar(b)",
"isSpaceChar",
"b",
"{\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"nextInt",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"int c = readByte();",
"c",
"readByte()",
"readByte",
"while (isSpaceChar(c))\n\t\t\t\tc = readByte();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = readByte()",
"c",
"readByte()",
"readByte",
"boolean minus = false;",
"minus",
"false",
"if (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"minus = true",
"minus",
"true",
"c = readByte()",
"c",
"readByte()",
"readByte",
"int res = 0;",
"res",
"0",
"do {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res = res * 10 + c - '0'",
"res",
"res * 10 + c - '0'",
"res * 10 + c",
"res * 10",
"res",
"10",
"c",
"'0'",
"c = readByte()",
"c",
"readByte()",
"readByte",
"return (minus) ? -res : res;",
"(minus) ? -res : res",
"(minus)",
"-res",
"res",
"res",
"public long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"nextLong",
"{\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}",
"if (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"int c = readByte();",
"c",
"readByte()",
"readByte",
"while (isSpaceChar(c))\n\t\t\t\tc = readByte();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = readByte()",
"c",
"readByte()",
"readByte",
"boolean minus = false;",
"minus",
"false",
"if (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}",
"minus = true",
"minus",
"true",
"c = readByte()",
"c",
"readByte()",
"readByte",
"long res = 0;",
"res",
"0",
"do {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t}",
"if (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res = res * 10 + c - '0'",
"res",
"res * 10 + c - '0'",
"res * 10 + c",
"res * 10",
"res",
"10",
"c",
"'0'",
"c = readByte()",
"c",
"readByte()",
"readByte",
"return (minus) ? -res : res;",
"(minus) ? -res : res",
"(minus)",
"-res",
"res",
"res",
"public double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"nextDouble",
"{\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"nextIntArray",
"{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"nextLongArray",
"{\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}",
"nextCharMap",
"{\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}",
"char[][] map = new char[n][m];",
"map",
"new char[n][m]",
"n",
"m",
"for (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"map[i] = next().toCharArray();",
"map[i] = next().toCharArray()",
"map[i]",
"map",
"i",
"next().toCharArray()",
"next().toCharArray",
"next()",
"next",
"return map;",
"map",
"int n",
"n",
"int m",
"m",
"public class Main {\n\tstatic long MOD=1000000007;\n\tstatic int[] dx= {-1,1,0,0};\n\tstatic int[] dy= {0,0,1,-1};\n\tpublic static void main(String[] args){\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}//val以上の一番左にある要素のindexを返す(指定した範囲で)\n \n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\tstatic class InputReader { \n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n \n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n \n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n \n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n \n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n \n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n \n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n \n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"public class Main {\n\tstatic long MOD=1000000007;\n\tstatic int[] dx= {-1,1,0,0};\n\tstatic int[] dy= {0,0,1,-1};\n\tpublic static void main(String[] args){\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tInputReader sc=new InputReader(System.in);\n\t\tint N=sc.nextInt();\n\t\tint[] S=sc.nextIntArray(N);\n\t\tint Q=sc.nextInt();\n\t\tint[] T=sc.nextIntArray(Q);\n\t\tint sum=0;\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tint hd=lower_bound(S,0,N-1, T[i]);\n\t\t\tint tl=upper_bound(S, 0, N-1, T[i]);\n\t\t\tsum+=Math.min(1, tl-hd);\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val > a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val <= a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] >= val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}//val以上の一番左にある要素のindexを返す(指定した範囲で)\n \n\tpublic static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {\n\t\tif (val >= a[toIndex])\n\t\t\treturn toIndex + 1;\n\t\tif (val < a[fromIndex])\n\t\t\treturn fromIndex;\n\t\tint lb = fromIndex - 1, ub = toIndex;\n\t\twhile (ub - lb > 1) {\n\t\t\tint mid = (ub - lb)/2+lb;\n\t\t\tif (a[mid] > val) {\n\t\t\t\tub = mid;\n\t\t\t} else {\n\t\t\t\tlb = mid;\n\t\t\t}\n\t\t}\n\t\treturn ub;\n\t}\n\tstatic class InputReader { \n\t\tprivate InputStream in;\n\t\tprivate byte[] buffer = new byte[1024];\n\t\tprivate int curbuf;\n\t\tprivate int lenbuf;\n\t\tpublic InputReader(InputStream in) {\n\t\t\tthis.in = in;\n\t\t\tthis.curbuf = this.lenbuf = 0;\n\t\t}\n \n\t\tpublic boolean hasNextByte() {\n\t\t\tif (curbuf >= lenbuf) {\n\t\t\t\tcurbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n \n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[curbuf++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n \n\t\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n \n\t\tprivate void skip() {\n\t\t\twhile (hasNextByte() && isSpaceChar(buffer[curbuf]))\n\t\t\t\tcurbuf++;\n\t\t}\n \n\t\tpublic boolean hasNext() {\n\t\t\tskip();\n\t\t\treturn hasNextByte();\n\t\t}\n \n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (!isSpaceChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n \n\t\tpublic int nextInt() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tint c = readByte();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = readByte();\n\t\t\tboolean minus = false;\n\t\t\tif (c == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tc = readByte();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres = res * 10 + c - '0';\n\t\t\t\tc = readByte();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn (minus) ? -res : res;\n\t\t}\n \n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic char[][] nextCharMap(int n, int m) {\n\t\t\tchar[][] map = new char[n][m];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next().toCharArray();\n\t\t\treturn map;\n\t\t}\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static long MOD=1000000007;
static int[] dx= {-1,1,0,0};
static int[] dy= {0,0,1,-1};
public static void main(String[] args){
PrintWriter out = new PrintWriter(System.out);
InputReader sc=new InputReader(System.in);
int N=sc.nextInt();
int[] S=sc.nextIntArray(N);
int Q=sc.nextInt();
int[] T=sc.nextIntArray(Q);
int sum=0;
for (int i = 0; i < T.length; i++) {
int hd=lower_bound(S,0,N-1, T[i]);
int tl=upper_bound(S, 0, N-1, T[i]);
sum+=Math.min(1, tl-hd);
}
System.out.println(sum);
}
public static int lower_bound(int[] a, int fromIndex, int toIndex, int val) {
if (val > a[toIndex])
return toIndex + 1;
if (val <= a[fromIndex])
return fromIndex;
int lb = fromIndex - 1, ub = toIndex;
while (ub - lb > 1) {
int mid = (ub - lb)/2+lb;
if (a[mid] >= val) {
ub = mid;
} else {
lb = mid;
}
}
return ub;
}//val以上の一番左にある要素のindexを返す(指定した範囲で)
public static int upper_bound(int[] a, int fromIndex, int toIndex, int val) {
if (val >= a[toIndex])
return toIndex + 1;
if (val < a[fromIndex])
return fromIndex;
int lb = fromIndex - 1, ub = toIndex;
while (ub - lb > 1) {
int mid = (ub - lb)/2+lb;
if (a[mid] > val) {
ub = mid;
} else {
lb = mid;
}
}
return ub;
}
static class InputReader {
private InputStream in;
private byte[] buffer = new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {
this.in = in;
this.curbuf = this.lenbuf = 0;
}
public boolean hasNextByte() {
if (curbuf >= lenbuf) {
curbuf = 0;
try {
lenbuf = in.read(buffer);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0)
return false;
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[curbuf++];
else
return -1;
}
private boolean isSpaceChar(int c) {
return !(c >= 33 && c <= 126);
}
private void skip() {
while (hasNextByte() && isSpaceChar(buffer[curbuf]))
curbuf++;
}
public boolean hasNext() {
skip();
return hasNextByte();
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (!isSpaceChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public int nextInt() {
if (!hasNext())
throw new NoSuchElementException();
int c = readByte();
while (isSpaceChar(c))
c = readByte();
boolean minus = false;
if (c == '-') {
minus = true;
c = readByte();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res = res * 10 + c - '0';
c = readByte();
} while (!isSpaceChar(c));
return (minus) ? -res : res;
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
int c = readByte();
while (isSpaceChar(c))
c = readByte();
boolean minus = false;
if (c == '-') {
minus = true;
c = readByte();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res = res * 10 + c - '0';
c = readByte();
} while (!isSpaceChar(c));
return (minus) ? -res : res;
}
public double nextDouble() {
return Double.parseDouble(next());
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public char[][] nextCharMap(int n, int m) {
char[][] map = new char[n][m];
for (int i = 0; i < n; i++)
map[i] = next().toCharArray();
return map;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
104,
5
],
[
104,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
8,
98
],
[
98,
99
],
[
99,
100
],
[
6,
101
],
[
101,
102
],
[
0,
103
],
[
103,
104
],
[
103,
105
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = scanner.nextInt();\n }",
"{\n s[i] = scanner.nextInt();\n }",
"s[i] = scanner.nextInt()",
"s[i]",
"s",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = scanner.nextInt();\n }",
"{\n t[i] = scanner.nextInt();\n }",
"t[i] = scanner.nextInt()",
"t[i]",
"t",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int number = 0;",
"number",
"0",
"for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }",
"{\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }",
"int min = 0;",
"min",
"0",
"int sup = n;",
"sup",
"n",
"System.out.println(number)",
"System.out.println",
"System.out",
"System",
"System.out",
"number",
"scanner.close()",
"scanner.close",
"scanner",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int[] t = new int[q];\n for (int i = 0; i < q; i++) {\n t[i] = scanner.nextInt();\n }\n\n int number = 0;\n\n for (int i = 0; i < q; i++) {\n int min = 0;\n int sup = n;\n LOOP: while(true) {\n if (t[i] >= s[(min + sup) / 2]) {\n min = (min + sup) / 2;\n } else {\n sup = (min + sup) / 2;\n }\n if (sup - min <= 1) {\n if (t[i] == s[min]) number++;\n break LOOP;\n }\n }\n\n }\n\n System.out.println(number);\n scanner.close();\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = scanner.nextInt();
}
int q = scanner.nextInt();
int[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = scanner.nextInt();
}
int number = 0;
for (int i = 0; i < q; i++) {
int min = 0;
int sup = n;
LOOP: while(true) {
if (t[i] >= s[(min + sup) / 2]) {
min = (min + sup) / 2;
} else {
sup = (min + sup) / 2;
}
if (sup - min <= 1) {
if (t[i] == s[min]) number++;
break LOOP;
}
}
}
System.out.println(number);
scanner.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
163,
11
],
[
163,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
14,
52
],
[
52,
53
],
[
52,
54
],
[
14,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
56,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
14,
78
],
[
78,
79
],
[
78,
80
],
[
14,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
87,
90
],
[
86,
91
],
[
91,
92
],
[
92,
93
],
[
14,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
14,
100
],
[
100,
101
],
[
101,
102
],
[
12,
103
],
[
103,
104
],
[
163,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
107,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
107,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
131,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
140,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
107,
156
],
[
156,
157
],
[
105,
158
],
[
158,
159
],
[
105,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"\nimport java.util.Arrays;\nimport java.util.Scanner;\n\nimport javax.sound.midi.MidiChannel;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n\t\n\tpublic static boolean binarySearch2(int[] S, int key) {\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import javax.sound.midi.MidiChannel;",
"MidiChannel",
"javax.sound.midi",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n\t\n\tpublic static boolean binarySearch2(int[] S, int key) {\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = scan.nextInt();\n\t\t}",
"S[i] = scan.nextInt()",
"S[i]",
"S",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = scan.nextInt();\n\t\t}",
"T[i] = scan.nextInt()",
"T[i]",
"T",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"for(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}",
"int t",
"T",
"{\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}",
"{\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}",
"if (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}",
"binarySearch2(S, t)",
"binarySearch2",
"S",
"t",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public static boolean binarySearch2(int[] S, int key) {\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}",
"binarySearch2",
"{\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}",
"boolean ans = false;",
"ans",
"false",
"int left = 0;",
"left",
"0",
"int right = S.length;",
"right",
"S.length",
"S",
"S.length",
"while(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\tright = mid;\n\t\t\t}",
"right = mid",
"right",
"mid",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return ans;",
"ans",
"int[] S",
"S",
"int key",
"key",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n\t\n\tpublic static boolean binarySearch2(int[] S, int key) {\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int t: T){\n\t\t\tif (binarySearch2(S, t)) {\n\t\t\t\tcount++;\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n\t\n\tpublic static boolean binarySearch2(int[] S, int key) {\n\t\tboolean ans = false;\n\t\tint left = 0;\n\t\tint right = S.length;\n\t\twhile(left < right){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == key) {\n\t\t\t\treturn true;\n\t\t\t}else if (key < S[mid]) {\n\t\t\t\tright = mid;\n\t\t\t}else{\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t\t\n\t}\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
import javax.sound.midi.MidiChannel;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = scan.nextInt();
}
int q = scan.nextInt();
int[] T = new int[q];
for (int i = 0; i < T.length; i++) {
T[i] = scan.nextInt();
}
int count = 0;
for(int t: T){
if (binarySearch2(S, t)) {
count++;
}
}
System.out.println(count);
scan.close();
}
public static boolean binarySearch2(int[] S, int key) {
boolean ans = false;
int left = 0;
int right = S.length;
while(left < right){
int mid = (left + right) / 2;
if (S[mid] == key) {
return true;
}else if (key < S[mid]) {
right = mid;
}else{
left = mid + 1;
}
}
return ans;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
2,
2,
13,
13,
2,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
42,
2,
2,
13,
13,
2,
18,
13,
13,
18,
13,
13,
40,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
4,
18,
13,
4,
18,
13,
17,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
23,
13,
12,
13,
30,
4,
13,
29,
18,
13,
13,
12,
13,
30,
4,
13,
29,
18,
13,
13,
12,
13,
30,
41,
13,
18,
13,
13,
38,
5,
13,
30,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
240,
8
],
[
240,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
16,
17
],
[
9,
18
],
[
18,
19
],
[
240,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
22,
31
],
[
31,
32
],
[
31,
33
],
[
22,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
22,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
22,
59
],
[
59,
60
],
[
59,
61
],
[
22,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
80,
81
],
[
22,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
22,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
22,
90
],
[
90,
91
],
[
90,
92
],
[
22,
93
],
[
93,
94
],
[
93,
95
],
[
22,
96
],
[
96,
97
],
[
96,
98
],
[
22,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
139,
141
],
[
130,
142
],
[
142,
143
],
[
119,
144
],
[
144,
145
],
[
145,
146
],
[
22,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
240,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
159,
161
],
[
159,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
165,
168
],
[
168,
169
],
[
169,
170
],
[
163,
171
],
[
155,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
153,
182
],
[
182,
183
],
[
240,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
184,
188
],
[
188,
189
],
[
184,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
196
],
[
196,
197
],
[
196,
198
],
[
190,
199
],
[
199,
200
],
[
184,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
203,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
184,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
184,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
224,
226
],
[
221,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
221,
237
],
[
237,
238
],
[
0,
239
],
[
239,
240
],
[
239,
241
]
] | [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }\n \n private void print(Object[] xs) {\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }\n \n private static class Scanner {\n BufferedReader r;\n StreamTokenizer st;\n \n public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }\n \n public String next() {\n nextToken();\n return st.sval;\n }\n \n public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }\n \n private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }\n \n private void print(Object[] xs) {\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }\n \n private static class Scanner {\n BufferedReader r;\n StreamTokenizer st;\n \n public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }\n \n public String next() {\n nextToken();\n return st.sval;\n }\n \n public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }\n \n private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }",
"main",
"{\n Main main = new Main();\n main.solv();\n }",
"Main main = new Main();",
"main",
"new Main()",
"main.solv()",
"main.solv",
"main",
"String[] args",
"args",
"private void solv() {\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }",
"solv",
"{\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int n = input.nextInt();",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) S[i] = input.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"S[i] = input.nextInt();",
"S[i] = input.nextInt()",
"S[i]",
"S",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"int q = input.nextInt();",
"q",
"input.nextInt()",
"input.nextInt",
"input",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) T[i] = input.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"T[i] = input.nextInt();",
"T[i] = input.nextInt()",
"T[i]",
"T",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int i = 0",
"i",
"0",
"j = 0",
"j",
"0",
"count = 0;",
"count",
"0",
"while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }",
"j < q && i < n",
"j < q",
"j",
"q",
"i < n",
"i",
"n",
"{\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }",
"if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }",
"S[i] < T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n i++;\n }",
"i++",
"i",
"if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }",
"S[i] == T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"{\n count++;\n while (i < n && S[i] == T[j]) i++;\n }",
"count++",
"count",
"while (i < n && S[i] == T[j]) i++;",
"i < n && S[i] == T[j]",
"i < n",
"i",
"n",
"S[i] == T[j]",
"S[i]",
"S",
"i",
"T[j]",
"T",
"j",
"i++",
"i",
"{\n j++;\n }",
"j++",
"j",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"private void print(Object[] xs) {\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }",
"print",
"{\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (Object x : xs) sb.append(x.toString()).append(' ');",
"Object x",
"xs",
"sb.append(x.toString()).append(' ');",
"sb.append(x.toString()).append(' ')",
"sb.append(x.toString()).append",
"sb.append(x.toString())",
"sb.append",
"sb",
"x.toString()",
"x.toString",
"x",
"' '",
"System.out.println(sb.toString().trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString().trim()",
"sb.toString().trim",
"sb.toString()",
"sb.toString",
"sb",
"Object[] xs",
"xs",
"private static class Scanner {\n BufferedReader r;\n StreamTokenizer st;\n \n public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }\n \n public String next() {\n nextToken();\n return st.sval;\n }\n \n public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }\n \n private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n }",
"Scanner",
"BufferedReader r;",
"r",
"StreamTokenizer st;",
"st",
"public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }",
"Scanner",
"{\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }",
"r = new BufferedReader(new InputStreamReader(in))",
"r",
"new BufferedReader(new InputStreamReader(in))",
"st = new StreamTokenizer(r)",
"st",
"new StreamTokenizer(r)",
"InputStream in",
"in",
"public String next() {\n nextToken();\n return st.sval;\n }",
"next",
"{\n nextToken();\n return st.sval;\n }",
"nextToken()",
"nextToken",
"return st.sval;",
"st.sval",
"st",
"st.sval",
"public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }",
"nextInt",
"{\n nextToken();\n return (int)st.nval;\n }",
"nextToken()",
"nextToken",
"return (int)st.nval;",
"(int)st.nval",
"st",
"st.nval",
"private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }",
"nextToken",
"{\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }",
"int token = st.TT_EOF;",
"token",
"st.TT_EOF",
"st",
"st.TT_EOF",
"try {\n token = st.nextToken();\n } catch (IOException e) {\n }",
"catch (IOException e) {\n }",
"IOException e",
"{\n }",
"{\n token = st.nextToken();\n }",
"token = st.nextToken()",
"token",
"st.nextToken()",
"st.nextToken",
"st",
"return token;",
"token",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }\n \n private void print(Object[] xs) {\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }\n \n private static class Scanner {\n BufferedReader r;\n StreamTokenizer st;\n \n public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }\n \n public String next() {\n nextToken();\n return st.sval;\n }\n \n public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }\n \n private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n \n int n = input.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) S[i] = input.nextInt();\n \n int q = input.nextInt();\n int[] T = new int[q];\n for (int i = 0; i < q; i++) T[i] = input.nextInt();\n \n Arrays.sort(S);\n Arrays.sort(T);\n \n int i = 0, j = 0, count = 0;\n while (j < q && i < n) {\n if (S[i] < T[j]) {\n i++;\n } else if (S[i] == T[j]) {\n count++;\n while (i < n && S[i] == T[j]) i++;\n } else {\n j++;\n }\n }\n \n System.out.println(count);\n }\n \n private void print(Object[] xs) {\n StringBuilder sb = new StringBuilder();\n for (Object x : xs) sb.append(x.toString()).append(' ');\n System.out.println(sb.toString().trim());\n }\n \n private static class Scanner {\n BufferedReader r;\n StreamTokenizer st;\n \n public Scanner(InputStream in) {\n r = new BufferedReader(new InputStreamReader(in));\n st = new StreamTokenizer(r);\n }\n \n public String next() {\n nextToken();\n return st.sval;\n }\n \n public Integer nextInt() {\n nextToken();\n return (int)st.nval;\n }\n \n private int nextToken() {\n int token = st.TT_EOF;\n try {\n token = st.nextToken();\n } catch (IOException e) {\n }\n return token;\n }\n }\n}",
"Main"
] | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solv();
}
private void solv() {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) S[i] = input.nextInt();
int q = input.nextInt();
int[] T = new int[q];
for (int i = 0; i < q; i++) T[i] = input.nextInt();
Arrays.sort(S);
Arrays.sort(T);
int i = 0, j = 0, count = 0;
while (j < q && i < n) {
if (S[i] < T[j]) {
i++;
} else if (S[i] == T[j]) {
count++;
while (i < n && S[i] == T[j]) i++;
} else {
j++;
}
}
System.out.println(count);
}
private void print(Object[] xs) {
StringBuilder sb = new StringBuilder();
for (Object x : xs) sb.append(x.toString()).append(' ');
System.out.println(sb.toString().trim());
}
private static class Scanner {
BufferedReader r;
StreamTokenizer st;
public Scanner(InputStream in) {
r = new BufferedReader(new InputStreamReader(in));
st = new StreamTokenizer(r);
}
public String next() {
nextToken();
return st.sval;
}
public Integer nextInt() {
nextToken();
return (int)st.nval;
}
private int nextToken() {
int token = st.TT_EOF;
try {
token = st.nextToken();
} catch (IOException e) {
}
return token;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
41,
13,
13,
0,
13,
13,
0,
13,
13,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
11,
1,
41,
13,
18,
13,
2,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
40,
13,
9,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
11,
1,
41,
13,
18,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
9,
14,
2,
18,
13,
2,
18,
13,
13,
17,
18,
13,
13,
30,
40,
13,
9,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
376,
5
],
[
376,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
64,
69
],
[
8,
70
],
[
70,
71
],
[
70,
72
],
[
8,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
101,
104
],
[
6,
105
],
[
105,
106
],
[
376,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
109,
128
],
[
128,
129
],
[
128,
130
],
[
109,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
109,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
138,
148
],
[
148,
149
],
[
149,
150
],
[
138,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
164,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
175,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
175,
189
],
[
189,
190
],
[
190,
191
],
[
175,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
198,
199
],
[
198,
200
],
[
193,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
164,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
206,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
212,
214
],
[
205,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
220,
222
],
[
216,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
225,
227
],
[
216,
228
],
[
228,
229
],
[
229,
230
],
[
216,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
237,
239
],
[
232,
240
],
[
240,
241
],
[
241,
242
],
[
240,
243
],
[
205,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
248,
250
],
[
245,
251
],
[
251,
252
],
[
251,
253
],
[
244,
254
],
[
254,
255
],
[
255,
256
],
[
254,
257
],
[
153,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
265,
267
],
[
258,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
270,
274
],
[
274,
275
],
[
274,
276
],
[
269,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
284,
286
],
[
278,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
289,
291
],
[
278,
292
],
[
292,
293
],
[
293,
294
],
[
278,
295
],
[
295,
296
],
[
296,
297
],
[
297,
298
],
[
298,
299
],
[
298,
300
],
[
297,
301
],
[
301,
302
],
[
301,
303
],
[
296,
304
],
[
304,
305
],
[
305,
306
],
[
304,
307
],
[
269,
308
],
[
308,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
309,
313
],
[
313,
314
],
[
313,
315
],
[
308,
316
],
[
316,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
317,
322
],
[
322,
323
],
[
322,
324
],
[
317,
325
],
[
325,
326
],
[
326,
327
],
[
317,
328
],
[
328,
329
],
[
329,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
330,
334
],
[
334,
335
],
[
334,
336
],
[
329,
337
],
[
337,
338
],
[
338,
339
],
[
337,
340
],
[
308,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
342,
346
],
[
346,
347
],
[
346,
348
],
[
341,
349
],
[
349,
350
],
[
350,
351
],
[
349,
352
],
[
258,
353
],
[
353,
354
],
[
354,
355
],
[
355,
356
],
[
355,
357
],
[
357,
358
],
[
358,
359
],
[
358,
360
],
[
357,
361
],
[
354,
362
],
[
362,
363
],
[
362,
364
],
[
353,
365
],
[
365,
366
],
[
366,
367
],
[
365,
368
],
[
109,
369
],
[
369,
370
],
[
107,
371
],
[
371,
372
],
[
107,
373
],
[
373,
374
],
[
0,
375
],
[
375,
376
],
[
375,
377
]
] | [
"import java.io.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }\n \n}",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }\n \n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n=Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] str=br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] S=new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i]=Integer.parseInt(str[i]);",
"S[i]=Integer.parseInt(str[i])",
"S[i]",
"S",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int q=Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"str=br.readLine().split(\" \")",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] T=new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"T[i]=Integer.parseInt(str[i]);",
"T[i]=Integer.parseInt(str[i])",
"T[i]",
"T",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"System.out.println(method(S,T))",
"System.out.println",
"System.out",
"System",
"System.out",
"method(S,T)",
"method",
"S",
"T",
"String[] args",
"args",
"static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }",
"method",
"{\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }",
"if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }",
"s.length<t.length",
"s.length",
"s",
"s.length",
"t.length",
"t",
"t.length",
"{\n int[] tmp=s;\n s=t;\n t=tmp;\n }",
"int[] tmp=s;",
"tmp",
"s",
"s=t",
"s",
"t",
"t=tmp",
"t",
"tmp",
"int count=0;",
"count",
"0",
"int q=s.length/4;",
"q",
"s.length/4",
"s.length",
"s",
"s.length",
"4",
"for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<t.length",
"i",
"t.length",
"t",
"t.length",
"i++",
"i++",
"i",
"{\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }",
"{\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }",
"if(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}",
"t[i]>s[q*2]",
"t[i]",
"t",
"i",
"s[q*2]",
"s",
"q*2",
"q",
"2",
"{\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}",
"if(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}",
"t[i]>s[q*3]",
"t[i]",
"t",
"i",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"{\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}",
"for(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"int j=s[q*3];",
"int j=s[q*3];",
"j",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"j<s.length",
"j",
"s.length",
"s",
"s.length",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}",
"t[i]<s[q*3]",
"t[i]",
"t",
"i",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"{\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}",
"for(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}",
"int j=q*2;",
"int j=q*2;",
"j",
"q*2",
"q",
"2",
"j<q*3",
"j",
"q*3",
"q",
"3",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(s[q*3]==t[i]){count++;continue;}",
"s[q*3]==t[i]",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"t[i]",
"t",
"i",
"{count++;continue;}",
"count++",
"count",
"continue;",
"if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}",
"t[i]<s[q*2]",
"t[i]",
"t",
"i",
"s[q*2]",
"s",
"q*2",
"q",
"2",
"{\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}",
"if(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}",
"t[i]>s[q]",
"t[i]",
"t",
"i",
"s[q]",
"s",
"q",
"{\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}",
"for(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}",
"int j=s[q+1];",
"int j=s[q+1];",
"j",
"s[q+1]",
"s",
"q+1",
"q",
"1",
"j<q*2",
"j",
"q*2",
"q",
"2",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}",
"t[i]<s[q]",
"t[i]",
"t",
"i",
"s[q]",
"s",
"q",
"{\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}",
"for(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"if(t[i]==s[j]){count++;break;}",
"if(t[i]==s[j]){count++;break;}",
"t[i]==s[j]",
"t[i]",
"t",
"i",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(s[q]==t[i]){count++;continue;}",
"s[q]==t[i]",
"s[q]",
"s",
"q",
"t[i]",
"t",
"i",
"{count++;continue;}",
"count++",
"count",
"continue;",
"if(s[s.length/2]==t[i]){count++;continue;}",
"s[s.length/2]==t[i]",
"s[s.length/2]",
"s",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"t[i]",
"t",
"i",
"{count++;continue;}",
"count++",
"count",
"continue;",
"return count;",
"count",
"int[] s",
"s",
"int[] t",
"t",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }\n \n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t\tint n=Integer.parseInt(br.readLine());\n String[] str=br.readLine().split(\" \");\n int[] S=new int[n];\n for(int i=0;i<n;i++)\n S[i]=Integer.parseInt(str[i]);\n \n int q=Integer.parseInt(br.readLine());\n str=br.readLine().split(\" \");\n int[] T=new int[q];\n for(int i=0;i<q;i++)\n T[i]=Integer.parseInt(str[i]);\n \n System.out.println(method(S,T));\n \n \n }\n static int method(int[] s,int[] t){\n if(s.length<t.length){\n int[] tmp=s;\n s=t;\n t=tmp;\n }\n \n int count=0;\n int q=s.length/4;\n for(int i=0;i<t.length;i++){\n \tif(t[i]>s[q*2]){\n \t\tif(t[i]>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q*3]==t[i]){count++;continue;}}\n \t\n \telse if(t[i]<s[q*2]){\n \t\tif(t[i]>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t[i]==s[j]){count++;break;}}\n \telse if(t[i]<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}\n \telse if(s[q]==t[i]){count++;continue;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t[i]){count++;continue;}\n \t\t\n \t\n }\n \n \n return count;\n }\n \n}",
"Main"
] | import java.io.*;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
String[] str=br.readLine().split(" ");
int[] S=new int[n];
for(int i=0;i<n;i++)
S[i]=Integer.parseInt(str[i]);
int q=Integer.parseInt(br.readLine());
str=br.readLine().split(" ");
int[] T=new int[q];
for(int i=0;i<q;i++)
T[i]=Integer.parseInt(str[i]);
System.out.println(method(S,T));
}
static int method(int[] s,int[] t){
if(s.length<t.length){
int[] tmp=s;
s=t;
t=tmp;
}
int count=0;
int q=s.length/4;
for(int i=0;i<t.length;i++){
if(t[i]>s[q*2]){
if(t[i]>s[q*3]){
for(int j=s[q*3];j<s.length;j++)
if(t[i]==s[j]){count++;break;}}
else if(t[i]<s[q*3]){
for(int j=q*2;j<q*3;j++)if(t[i]==s[j]){count++;break;}}
else if(s[q*3]==t[i]){count++;continue;}}
else if(t[i]<s[q*2]){
if(t[i]>s[q]){
for(int j=s[q+1];j<q*2;j++)
if(t[i]==s[j]){count++;break;}}
else if(t[i]<s[q]){
for(int j=0;j<q;j++)if(t[i]==s[j]){count++;break;}}
else if(s[q]==t[i]){count++;continue;}}
else if(s[s.length/2]==t[i]){count++;continue;}
}
return count;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
14,
2,
13,
13,
29,
17,
14,
2,
13,
13,
0,
13,
2,
13,
17,
0,
13,
13,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
4,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
21,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
31,
33
],
[
21,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
34,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
40,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
6,
54
],
[
54,
55
],
[
6,
56
],
[
56,
57
],
[
4,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
60,
69
],
[
69,
70
],
[
69,
71
],
[
60,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
60,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
60,
97
],
[
97,
98
],
[
97,
99
],
[
60,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
112,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
118,
123
],
[
123,
124
],
[
60,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
58,
131
],
[
131,
132
]
] | [
"import java.util.Scanner;\n\nclass Main{\n\n static boolean binarySearch(int[] a, int x){\n int left = 0;\n int right = a.length;\n\n while(left < right){\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }\n\n return false;\n }\n\n public static void main(String[] arsg){\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n\n for(int i = 0; i < n; i++)\n a[i] = stdIn.nextInt();\n\n int q = stdIn.nextInt();\n int count = 0;\n for(int i = 0; i < q; i++){\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }\n\n\n System.out.println(count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\n static boolean binarySearch(int[] a, int x){\n int left = 0;\n int right = a.length;\n\n while(left < right){\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }\n\n return false;\n }\n\n public static void main(String[] arsg){\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n\n for(int i = 0; i < n; i++)\n a[i] = stdIn.nextInt();\n\n int q = stdIn.nextInt();\n int count = 0;\n for(int i = 0; i < q; i++){\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }\n\n\n System.out.println(count);\n }\n}",
"Main",
"static boolean binarySearch(int[] a, int x){\n int left = 0;\n int right = a.length;\n\n while(left < right){\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }\n\n return false;\n }",
"binarySearch",
"{\n int left = 0;\n int right = a.length;\n\n while(left < right){\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }\n\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = a.length;",
"right",
"a.length",
"a",
"a.length",
"while(left < right){\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }",
"left < right",
"left",
"right",
"{\n int k = (left + right) / 2;\n int w = a[k];\n if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;\n }",
"int k = (left + right) / 2;",
"k",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"int w = a[k];",
"w",
"a[k]",
"a",
"k",
"if(w == x)\n return true;\n else if(x > w)\n left = k + 1;\n else\n right = k;",
"w == x",
"w",
"x",
"return true;",
"true",
"if(x > w)\n left = k + 1;\n else\n right = k;",
"x > w",
"x",
"w",
"left = k + 1",
"left",
"k + 1",
"k",
"1",
"right = k",
"right",
"k",
"return false;",
"false",
"int[] a",
"a",
"int x",
"x",
"public static void main(String[] arsg){\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n\n for(int i = 0; i < n; i++)\n a[i] = stdIn.nextInt();\n\n int q = stdIn.nextInt();\n int count = 0;\n for(int i = 0; i < q; i++){\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }\n\n\n System.out.println(count);\n }",
"main",
"{\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n\n for(int i = 0; i < n; i++)\n a[i] = stdIn.nextInt();\n\n int q = stdIn.nextInt();\n int count = 0;\n for(int i = 0; i < q; i++){\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }\n\n\n System.out.println(count);\n }",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for(int i = 0; i < n; i++)\n a[i] = stdIn.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = stdIn.nextInt();",
"a[i] = stdIn.nextInt()",
"a[i]",
"a",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int q = stdIn.nextInt();",
"q",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++){\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }",
"{\n int x = stdIn.nextInt();\n if(binarySearch(a, x))\n count++;\n }",
"int x = stdIn.nextInt();",
"x",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"if(binarySearch(a, x))\n count++;",
"binarySearch(a, x)",
"binarySearch",
"a",
"x",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] arsg",
"arsg"
] | import java.util.Scanner;
class Main{
static boolean binarySearch(int[] a, int x){
int left = 0;
int right = a.length;
while(left < right){
int k = (left + right) / 2;
int w = a[k];
if(w == x)
return true;
else if(x > w)
left = k + 1;
else
right = k;
}
return false;
}
public static void main(String[] arsg){
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++)
a[i] = stdIn.nextInt();
int q = stdIn.nextInt();
int count = 0;
for(int i = 0; i < q; i++){
int x = stdIn.nextInt();
if(binarySearch(a, x))
count++;
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
20,
17,
41,
13,
17,
41,
13,
20,
17,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
17,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
30,
29,
17,
14,
2,
18,
13,
2,
2,
13,
13,
17,
13,
30,
29,
4,
13,
13,
2,
2,
2,
13,
13,
17,
17,
13,
30,
29,
4,
13,
2,
2,
2,
13,
13,
17,
17,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
185,
5
],
[
185,
6
],
[
6,
7
],
[
6,
8
],
[
185,
9
],
[
9,
10
],
[
9,
11
],
[
185,
13
],
[
13,
14
],
[
13,
15
],
[
185,
16
],
[
16,
17
],
[
16,
18
],
[
185,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
22,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
22,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
22,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
22,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
22,
84
],
[
84,
85
],
[
84,
86
],
[
22,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
102,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
108,
110
],
[
22,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
20,
117
],
[
117,
118
],
[
185,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
130,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
129,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
143,
151
],
[
142,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
154,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
157,
163
],
[
154,
164
],
[
142,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
169,
175
],
[
167,
176
],
[
167,
177
],
[
119,
178
],
[
178,
179
],
[
119,
180
],
[
180,
181
],
[
119,
182
],
[
182,
183
],
[
0,
184
],
[
184,
185
],
[
184,
186
]
] | [
"import java.util.*;\n\npublic class Main {\n public static int n = 0;\n public static int[] data = new int[100000];\n public static int q = 0;\n public static int[] targets = new int[50000];\n\n public static void main(String[] args) {\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }\n\n public static int calc(int left, int right, int target) {\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static int n = 0;\n public static int[] data = new int[100000];\n public static int q = 0;\n public static int[] targets = new int[50000];\n\n public static void main(String[] args) {\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }\n\n public static int calc(int left, int right, int target) {\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }\n}",
"Main",
"public static int n = 0;",
"n",
"0",
"public static int[] data = new int[100000];",
"data",
"new int[100000]",
"100000",
"public static int q = 0;",
"q",
"0",
"public static int[] targets = new int[50000];",
"targets",
"new int[50000]",
"50000",
"public static void main(String[] args) {\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }",
"main",
"{\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }",
"Scanner num = new Scanner(System.in);",
"num",
"new Scanner(System.in)",
"n = num.nextInt()",
"n",
"num.nextInt()",
"num.nextInt",
"num",
"for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n data[i] = num.nextInt();\n }",
"{\n data[i] = num.nextInt();\n }",
"data[i] = num.nextInt()",
"data[i]",
"data",
"i",
"num.nextInt()",
"num.nextInt",
"num",
"q = num.nextInt()",
"q",
"num.nextInt()",
"num.nextInt",
"num",
"for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n targets[i] = num.nextInt();\n }",
"{\n targets[i] = num.nextInt();\n }",
"targets[i] = num.nextInt()",
"targets[i]",
"targets",
"i",
"num.nextInt()",
"num.nextInt",
"num",
"if(num != null) {\n num.close();\n }",
"num != null",
"num",
"null",
"{\n num.close();\n }",
"num.close()",
"num.close",
"num",
"int result = 0;",
"result",
"0",
"for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n result += calc(0, n - 1, targets[i]);\n }",
"{\n result += calc(0, n - 1, targets[i]);\n }",
"result += calc(0, n - 1, targets[i])",
"result",
"calc(0, n - 1, targets[i])",
"calc",
"0",
"n - 1",
"n",
"1",
"targets[i]",
"targets",
"i",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public static int calc(int left, int right, int target) {\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }",
"calc",
"{\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }",
"if(left > right) {\n return 0;\n }",
"left > right",
"left",
"right",
"{\n return 0;\n }",
"return 0;",
"0",
"if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }",
"data[(left + right) / 2] == target",
"data[(left + right) / 2]",
"data",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"target",
"{\n return 1;\n }",
"return 1;",
"1",
"if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }",
"data[(left + right) / 2] > target",
"data[(left + right) / 2]",
"data",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"target",
"{\n return calc(left, (left + right) / 2 - 1, target);\n }",
"return calc(left, (left + right) / 2 - 1, target);",
"calc(left, (left + right) / 2 - 1, target)",
"calc",
"left",
"(left + right) / 2 - 1",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"1",
"target",
"{\n return calc((left + right) / 2 + 1, right, target);\n }",
"return calc((left + right) / 2 + 1, right, target);",
"calc((left + right) / 2 + 1, right, target)",
"calc",
"(left + right) / 2 + 1",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"1",
"right",
"target",
"int left",
"left",
"int right",
"right",
"int target",
"target",
"public class Main {\n public static int n = 0;\n public static int[] data = new int[100000];\n public static int q = 0;\n public static int[] targets = new int[50000];\n\n public static void main(String[] args) {\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }\n\n public static int calc(int left, int right, int target) {\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }\n}",
"public class Main {\n public static int n = 0;\n public static int[] data = new int[100000];\n public static int q = 0;\n public static int[] targets = new int[50000];\n\n public static void main(String[] args) {\n Scanner num = new Scanner(System.in);\n n = num.nextInt();\n\n for(int i = 0; i < n; i++) {\n data[i] = num.nextInt();\n }\n\n q = num.nextInt();\n\n for(int i = 0; i < q; i++) {\n targets[i] = num.nextInt();\n }\n\n if(num != null) {\n num.close();\n }\n int result = 0;\n\n for(int i = 0; i < q; i++) {\n result += calc(0, n - 1, targets[i]);\n }\n\n System.out.println(result);\n }\n\n public static int calc(int left, int right, int target) {\n if(left > right) {\n return 0;\n }\n \n if(data[(left + right) / 2] == target) {\n return 1;\n } else if(data[(left + right) / 2] > target) {\n return calc(left, (left + right) / 2 - 1, target);\n } else {\n return calc((left + right) / 2 + 1, right, target);\n }\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static int n = 0;
public static int[] data = new int[100000];
public static int q = 0;
public static int[] targets = new int[50000];
public static void main(String[] args) {
Scanner num = new Scanner(System.in);
n = num.nextInt();
for(int i = 0; i < n; i++) {
data[i] = num.nextInt();
}
q = num.nextInt();
for(int i = 0; i < q; i++) {
targets[i] = num.nextInt();
}
if(num != null) {
num.close();
}
int result = 0;
for(int i = 0; i < q; i++) {
result += calc(0, n - 1, targets[i]);
}
System.out.println(result);
}
public static int calc(int left, int right, int target) {
if(left > right) {
return 0;
}
if(data[(left + right) / 2] == target) {
return 1;
} else if(data[(left + right) / 2] > target) {
return calc(left, (left + right) / 2 - 1, target);
} else {
return calc((left + right) / 2 + 1, right, target);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
123,
8
],
[
123,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
9,
120
],
[
120,
121
],
[
0,
122
],
[
122,
123
],
[
122,
124
]
] | [
"import java.io.*;\nimport java.util.*;\n\n\n\npublic class Main{\n public static void main(String[] args)throws IOException{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n } \n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args)throws IOException{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n } \n}",
"Main",
"public static void main(String[] args)throws IOException{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n }",
"main",
"{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[]S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = sc.nextInt();\n }",
"{\n S[i] = sc.nextInt();\n }",
"S[i] = sc.nextInt()",
"S[i]",
"S",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T[i] = sc.nextInt();\n }",
"{\n T[i] = sc.nextInt();\n }",
"T[i] = sc.nextInt()",
"T[i]",
"T",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }",
"{\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }",
"for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(T[i] == S[j]){\n count++;\n break;\n }\n }",
"{\n if(T[i] == S[j]){\n count++;\n break;\n }\n }",
"if(T[i] == S[j]){\n count++;\n break;\n }",
"T[i] == S[j]",
"T[i]",
"T",
"i",
"S[j]",
"S",
"j",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args)throws IOException{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n } \n}",
"public class Main{\n public static void main(String[] args)throws IOException{\n //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n //String str;\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[]S = new int[n];\n for(int i=0;i<n;i++){\n S[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int[] T = new int[q];\n for(int i=0;i<q;i++){\n T[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i=0;i<q;i++){\n for(int j=0;j<n;j++){\n if(T[i] == S[j]){\n count++;\n break;\n }\n }\n }\n\n System.out.println(count);\n } \n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args)throws IOException{
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//String str;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[]S = new int[n];
for(int i=0;i<n;i++){
S[i] = sc.nextInt();
}
int q = sc.nextInt();
int[] T = new int[q];
for(int i=0;i<q;i++){
T[i] = sc.nextInt();
}
int count = 0;
for(int i=0;i<q;i++){
for(int j=0;j<n;j++){
if(T[i] == S[j]){
count++;
break;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
13,
13,
17,
30,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
41,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
211,
5
],
[
211,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
19,
21
],
[
12,
22
],
[
22,
23
],
[
23,
24
],
[
12,
25
],
[
26,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
29,
32
],
[
32,
33
],
[
32,
34
],
[
28,
35
],
[
27,
36
],
[
36,
37
],
[
37,
38
],
[
8,
39
],
[
39,
40
],
[
6,
41
],
[
41,
42
],
[
6,
43
],
[
43,
44
],
[
211,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
47,
58
],
[
58,
59
],
[
47,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
79,
80
],
[
72,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
81,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
47,
99
],
[
99,
100
],
[
45,
101
],
[
101,
102
],
[
45,
103
],
[
103,
104
],
[
211,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
115,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
133,
134
],
[
107,
135
],
[
135,
136
],
[
136,
137
],
[
107,
138
],
[
138,
139
],
[
105,
140
],
[
140,
141
],
[
105,
142
],
[
142,
143
],
[
211,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
146,
152
],
[
152,
153
],
[
146,
154
],
[
154,
155
],
[
146,
156
],
[
156,
157
],
[
146,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
146,
163
],
[
163,
164
],
[
164,
165
],
[
146,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
146,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
146,
176
],
[
176,
177
],
[
177,
178
],
[
146,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
146,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
186,
189
],
[
146,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
192,
194
],
[
192,
195
],
[
146,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
196,
201
],
[
201,
202
],
[
201,
203
],
[
201,
204
],
[
146,
205
],
[
205,
206
],
[
206,
207
],
[
144,
208
],
[
208,
209
],
[
0,
210
],
[
210,
211
],
[
210,
212
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static int callBinarySearch(int[] first, int[] second) {\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\tpublic static int binarySearch(int[] array, int x) {\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic static int[] toArray(String s, int l) {\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static int callBinarySearch(int[] first, int[] second) {\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\tpublic static int binarySearch(int[] array, int x) {\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic static int[] toArray(String s, int l) {\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}\n}",
"Main",
"public static int callBinarySearch(int[] first, int[] second) {\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}",
"callBinarySearch",
"{\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}",
"int output = 0;",
"output",
"0",
"for(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}",
"int j = 0 ;",
"int j = 0 ;",
"j",
"0",
"j < second.length",
"j",
"second.length",
"second",
"second.length",
"j++",
"j++",
"j",
"{\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}",
"if(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}",
"binarySearch(first,second[j]) == 1",
"binarySearch(first,second[j])",
"binarySearch",
"first",
"second[j]",
"second",
"j",
"1",
"{\n\t\t\t\toutput++;\n\t\t\t}",
"output++",
"output",
"return output;",
"output",
"int[] first",
"first",
"int[] second",
"second",
"public static int binarySearch(int[] array, int x) {\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"binarySearch",
"{\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"int left = 0;",
"left",
"0",
"int right = array.length-1;",
"right",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"int mid ;",
"mid",
"while(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}",
"left <= right",
"left",
"right",
"{\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}",
"mid = (left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}",
"array[mid] == x",
"array[mid]",
"array",
"mid",
"x",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}",
"array[mid] > x",
"array[mid]",
"array",
"mid",
"x",
"{\n\t\t\t\tright = mid-1;\n\t\t\t}",
"right = mid-1",
"right",
"mid-1",
"mid",
"1",
"{\n\t\t\t\tleft = mid+1;\n\t\t\t}",
"left = mid+1",
"left",
"mid+1",
"mid",
"1",
"return 0;",
"0",
"int[] array",
"array",
"int x",
"x",
"public static int[] toArray(String s, int l) {\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}",
"toArray",
"{\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}",
"Scanner in = new Scanner(s);",
"in",
"new Scanner(s)",
"int[] output = new int[l];",
"output",
"new int[l]",
"l",
"for (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < l",
"i",
"l",
"i++",
"i++",
"i",
"{\n\t\t\toutput[i] = in.nextInt();\n\t\t}",
"{\n\t\t\toutput[i] = in.nextInt();\n\t\t}",
"output[i] = in.nextInt()",
"output[i]",
"output",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"in.close()",
"in.close",
"in",
"return output;",
"output",
"String s",
"s",
"int l",
"l",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int lengthOne",
"lengthOne",
"lengthTwo;",
"lengthTwo",
"String arrayOne",
"arrayOne",
"arrayTwo;",
"arrayTwo",
"lengthOne = in.nextInt()",
"lengthOne",
"in.nextInt()",
"in.nextInt",
"in",
"in.nextLine()",
"in.nextLine",
"in",
"arrayOne = in.nextLine()",
"arrayOne",
"in.nextLine()",
"in.nextLine",
"in",
"lengthTwo = in.nextInt()",
"lengthTwo",
"in.nextInt()",
"in.nextInt",
"in",
"in.nextLine()",
"in.nextLine",
"in",
"arrayTwo = in.nextLine()",
"arrayTwo",
"in.nextLine()",
"in.nextLine",
"in",
"int[] first = toArray(arrayOne, lengthOne);",
"first",
"toArray(arrayOne, lengthOne)",
"toArray",
"arrayOne",
"lengthOne",
"int[] second = toArray(arrayTwo, lengthTwo);",
"second",
"toArray(arrayTwo, lengthTwo)",
"toArray",
"arrayTwo",
"lengthTwo",
"System.out.println(callBinarySearch(first, second))",
"System.out.println",
"System.out",
"System",
"System.out",
"callBinarySearch(first, second)",
"callBinarySearch",
"first",
"second",
"in.close()",
"in.close",
"in",
"String[] args",
"args",
"public class Main {\n\n\tpublic static int callBinarySearch(int[] first, int[] second) {\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\tpublic static int binarySearch(int[] array, int x) {\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic static int[] toArray(String s, int l) {\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}\n}",
"public class Main {\n\n\tpublic static int callBinarySearch(int[] first, int[] second) {\n\t\tint output = 0;\n\n\t\tfor(int j = 0 ;j < second.length;j++) {\n\t\t\tif(binarySearch(first,second[j]) == 1) {\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\tpublic static int binarySearch(int[] array, int x) {\n\t\t\n\t\tint left = 0;\n\t\tint right = array.length-1;\n\t\tint mid ;\n\t\twhile(left <= right) {\n\t\t\tmid = (left+right)/2;\n\t\t\tif(array[mid] == x) {\n\t\t\t\treturn 1;\n\t\t\t}else if(array[mid] > x) {\n\t\t\t\tright = mid-1;\n\t\t\t}else {\n\t\t\t\tleft = mid+1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic static int[] toArray(String s, int l) {\n\t\tScanner in = new Scanner(s);\n\t\tint[] output = new int[l];\n\t\tfor (int i = 0; i < l; i++) {\n\t\t\toutput[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\treturn output;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint lengthOne, lengthTwo;\n\t\tString arrayOne, arrayTwo;\n\n\t\tlengthOne = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayOne = in.nextLine();\n\n\t\tlengthTwo = in.nextInt();\n\t\tin.nextLine();\n\t\tarrayTwo = in.nextLine();\n\n\t\tint[] first = toArray(arrayOne, lengthOne);\n\t\tint[] second = toArray(arrayTwo, lengthTwo);\n\t\tSystem.out.println(callBinarySearch(first, second));\n\t\t\n\n\t\tin.close();\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static int callBinarySearch(int[] first, int[] second) {
int output = 0;
for(int j = 0 ;j < second.length;j++) {
if(binarySearch(first,second[j]) == 1) {
output++;
}
}
return output;
}
public static int binarySearch(int[] array, int x) {
int left = 0;
int right = array.length-1;
int mid ;
while(left <= right) {
mid = (left+right)/2;
if(array[mid] == x) {
return 1;
}else if(array[mid] > x) {
right = mid-1;
}else {
left = mid+1;
}
}
return 0;
}
public static int[] toArray(String s, int l) {
Scanner in = new Scanner(s);
int[] output = new int[l];
for (int i = 0; i < l; i++) {
output[i] = in.nextInt();
}
in.close();
return output;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int lengthOne, lengthTwo;
String arrayOne, arrayTwo;
lengthOne = in.nextInt();
in.nextLine();
arrayOne = in.nextLine();
lengthTwo = in.nextInt();
in.nextLine();
arrayTwo = in.nextLine();
int[] first = toArray(arrayOne, lengthOne);
int[] second = toArray(arrayTwo, lengthTwo);
System.out.println(callBinarySearch(first, second));
in.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
4,
18,
13,
40,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
29,
13,
29,
40,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
143,
5
],
[
143,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
64,
67
],
[
67,
68
],
[
68,
69
],
[
63,
70
],
[
70,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
6,
81
],
[
81,
82
],
[
143,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
85,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
108,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
85,
135
],
[
135,
136
],
[
136,
137
],
[
83,
138
],
[
138,
139
],
[
83,
140
],
[
140,
141
],
[
0,
142
],
[
142,
143
],
[
142,
144
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }\n\n private static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }\n\n private static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = scanner.nextInt();\n }",
"{\n S[i] = scanner.nextInt();\n }",
"S[i] = scanner.nextInt()",
"S[i]",
"S",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }",
"{\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }",
"if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }",
"binarySearch(S, scanner.nextInt()) != -1",
"binarySearch(S, scanner.nextInt())",
"binarySearch",
"S",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"-1",
"1",
"{\n cnt++;\n }",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"private static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }",
"binarySearch",
"{\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }",
"int lo = 0;",
"lo",
"0",
"int hi = a.length - 1;",
"hi",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }",
"lo <= hi",
"lo",
"hi",
"{\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }",
"int mid = (lo + hi) / 2;",
"mid",
"(lo + hi) / 2",
"(lo + hi)",
"lo",
"hi",
"2",
"if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }",
"a[mid] > key",
"a[mid]",
"a",
"mid",
"key",
"{\n hi = mid - 1;\n }",
"hi = mid - 1",
"hi",
"mid - 1",
"mid",
"1",
"if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }",
"a[mid] < key",
"a[mid]",
"a",
"mid",
"key",
"{\n lo = mid + 1;\n }",
"lo = mid + 1",
"lo",
"mid + 1",
"mid",
"1",
"{\n return mid;\n }",
"return mid;",
"mid",
"return -1;",
"-1",
"1",
"int[] a",
"a",
"int key",
"key",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }\n\n private static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] S = new int[n];\n for (int i = 0; i < n; i++) {\n S[i] = scanner.nextInt();\n }\n int q = scanner.nextInt();\n int cnt = 0;\n for (int i = 0; i < q; i++) {\n if (binarySearch(S, scanner.nextInt()) != -1) {\n cnt++;\n }\n }\n System.out.println(cnt);\n }\n\n private static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (a[mid] > key) {\n hi = mid - 1;\n } else if (a[mid] < key) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] S = new int[n];
for (int i = 0; i < n; i++) {
S[i] = scanner.nextInt();
}
int q = scanner.nextInt();
int cnt = 0;
for (int i = 0; i < q; i++) {
if (binarySearch(S, scanner.nextInt()) != -1) {
cnt++;
}
}
System.out.println(cnt);
}
private static int binarySearch(int[] a, int key) {
int lo = 0;
int hi = a.length - 1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (a[mid] > key) {
hi = mid - 1;
} else if (a[mid] < key) {
lo = mid + 1;
} else {
return mid;
}
}
return -1;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
4,
13,
18,
13,
13,
4,
13,
13,
30,
3,
14,
2,
4,
13,
18,
13,
13,
4,
13,
13,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
160,
11
],
[
160,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
16,
19
],
[
12,
20
],
[
20,
21
],
[
160,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
24,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
24,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
52,
57
],
[
24,
58
],
[
58,
59
],
[
58,
60
],
[
24,
61
],
[
61,
62
],
[
61,
63
],
[
61,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
65,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
65,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
100,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
110,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
100,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
123,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
65,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
24,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
22,
149
],
[
149,
150
],
[
160,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\n\n/**\n * Created by ??\\??? on 2016/12/7.\n */\npublic class Main {\n static int si(String s){\n return Integer.parseInt(s);\n }\n static void run(String[] args) throws Exception{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }\n public static void main(String[] args) throws Exception{\n run(args);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n static int si(String s){\n return Integer.parseInt(s);\n }\n static void run(String[] args) throws Exception{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }\n public static void main(String[] args) throws Exception{\n run(args);\n }\n}",
"Main",
"static int si(String s){\n return Integer.parseInt(s);\n }",
"si",
"{\n return Integer.parseInt(s);\n }",
"return Integer.parseInt(s);",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"String s",
"s",
"static void run(String[] args) throws Exception{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }",
"run",
"{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }",
"BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));",
"scan",
"new BufferedReader(new InputStreamReader(System.in))",
"int T = si(scan.readLine());",
"T",
"si(scan.readLine())",
"si",
"scan.readLine()",
"scan.readLine",
"scan",
"String[] lines1 = scan.readLine().split(\" \");",
"lines1",
"scan.readLine().split(\" \")",
"scan.readLine().split",
"scan.readLine()",
"scan.readLine",
"scan",
"\" \"",
"int Q = si(scan.readLine());",
"Q",
"si(scan.readLine())",
"si",
"scan.readLine()",
"scan.readLine",
"scan",
"String[] lines2 = scan.readLine().split(\" \");",
"lines2",
"scan.readLine().split(\" \")",
"scan.readLine().split",
"scan.readLine()",
"scan.readLine",
"scan",
"\" \"",
"int num = 0;",
"num",
"0",
"for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }",
"String a",
"lines2",
"{\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }",
"{\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }",
"int l = 0;",
"l",
"0",
"int r = lines1.length-1;",
"r",
"lines1.length-1",
"lines1.length",
"lines1",
"lines1.length",
"1",
"int m = (l+r)/2;",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }",
"l<=r",
"l",
"r",
"{\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }",
"if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }",
"si(lines1[m])==si(a)",
"si(lines1[m])",
"si",
"lines1[m]",
"lines1",
"m",
"si(a)",
"si",
"a",
"{\n break;\n }",
"break;",
"if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }",
"si(lines1[m]) < si(a)",
"si(lines1[m])",
"si",
"lines1[m]",
"lines1",
"m",
"si(a)",
"si",
"a",
"{\n l = m+1;\n m = (l+r)/2;\n }",
"l = m+1",
"l",
"m+1",
"m",
"1",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"{\n r = m - 1;\n m = (l+r)/2;\n }",
"r = m - 1",
"r",
"m - 1",
"m",
"1",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(l<=r){\n num++;\n }",
"l<=r",
"l",
"r",
"{\n num++;\n }",
"num++",
"num",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"String[] args",
"args",
"public static void main(String[] args) throws Exception{\n run(args);\n }",
"main",
"{\n run(args);\n }",
"run(args)",
"run",
"args",
"String[] args",
"args",
"public class Main {\n static int si(String s){\n return Integer.parseInt(s);\n }\n static void run(String[] args) throws Exception{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }\n public static void main(String[] args) throws Exception{\n run(args);\n }\n}",
"public class Main {\n static int si(String s){\n return Integer.parseInt(s);\n }\n static void run(String[] args) throws Exception{\n BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\n int T = si(scan.readLine());\n String[] lines1 = scan.readLine().split(\" \");\n int Q = si(scan.readLine());\n String[] lines2 = scan.readLine().split(\" \");\n int num = 0;\n for(String a : lines2){\n int l = 0;\n int r = lines1.length-1;\n int m = (l+r)/2;\n while(l<=r){\n if(si(lines1[m])==si(a)){\n break;\n }\n else if(si(lines1[m]) < si(a)){\n l = m+1;\n m = (l+r)/2;\n }\n else{\n r = m - 1;\n m = (l+r)/2;\n }\n }\n if(l<=r){\n num++;\n }\n }\n System.out.println(num);\n }\n public static void main(String[] args) throws Exception{\n run(args);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
* Created by ??\??? on 2016/12/7.
*/
public class Main {
static int si(String s){
return Integer.parseInt(s);
}
static void run(String[] args) throws Exception{
BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
int T = si(scan.readLine());
String[] lines1 = scan.readLine().split(" ");
int Q = si(scan.readLine());
String[] lines2 = scan.readLine().split(" ");
int num = 0;
for(String a : lines2){
int l = 0;
int r = lines1.length-1;
int m = (l+r)/2;
while(l<=r){
if(si(lines1[m])==si(a)){
break;
}
else if(si(lines1[m]) < si(a)){
l = m+1;
m = (l+r)/2;
}
else{
r = m - 1;
m = (l+r)/2;
}
}
if(l<=r){
num++;
}
}
System.out.println(num);
}
public static void main(String[] args) throws Exception{
run(args);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
128,
5
],
[
128,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
63,
69
],
[
69,
70
],
[
69,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
63,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
77,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
91,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
103,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
6,
125
],
[
125,
126
],
[
0,
127
],
[
127,
128
],
[
127,
129
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n + 1];",
"s",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }",
"{\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }",
"int target = sc.nextInt();",
"target",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int left = 0;",
"left",
"0",
"int right = n - 1;",
"right",
"n - 1",
"n",
"1",
"while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }",
"right - left >= 0",
"right - left",
"right",
"left",
"0",
"{\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }",
"s[mid] > target",
"s[mid]",
"s",
"mid",
"target",
"{\n right = mid - 1;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }",
"s[mid] < target",
"s[mid]",
"s",
"mid",
"target",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] s = new int[n + 1];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int q = sc.nextInt();\n int count = 0;\n \n for (int i = 0; i < q; i++) {\n int target = sc.nextInt();\n int left = 0;\n int right = n - 1;\n while (right - left >= 0) {\n int mid = (left + right) / 2;\n if (s[mid] > target) {\n right = mid - 1;\n } else if (s[mid] < target) {\n left = mid + 1;\n } else {\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n + 1];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int q = sc.nextInt();
int count = 0;
for (int i = 0; i < q; i++) {
int target = sc.nextInt();
int left = 0;
int right = n - 1;
while (right - left >= 0) {
int mid = (left + right) / 2;
if (s[mid] > target) {
right = mid - 1;
} else if (s[mid] < target) {
left = mid + 1;
} else {
count++;
break;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
4,
13,
13,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
29,
13,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
12,
13,
30,
38,
5,
13,
30,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
191,
8
],
[
191,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
11,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
64,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
72,
75
],
[
72,
76
],
[
71,
77
],
[
70,
78
],
[
78,
79
],
[
11,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
9,
86
],
[
86,
87
],
[
191,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
109,
115
],
[
115,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
117,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
117,
128
],
[
128,
129
],
[
128,
130
],
[
90,
131
],
[
131,
132
],
[
132,
133
],
[
88,
134
],
[
134,
135
],
[
88,
136
],
[
136,
137
],
[
88,
138
],
[
138,
139
],
[
191,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
140,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
155,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
149,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
140,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
176,
179
],
[
179,
180
],
[
140,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
188,
189
],
[
0,
190
],
[
190,
191
],
[
190,
192
]
] | [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }\n\n\n // 二分探索\n static int binarySearch(int[] a, int n, int key) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }\n\n static class MyScanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n\n String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }\n\n\n // 二分探索\n static int binarySearch(int[] a, int n, int key) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }\n\n static class MyScanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n\n String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }",
"main",
"{\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }",
"MyScanner sc = new MyScanner();",
"sc",
"new MyScanner()",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n }",
"{\n s[i] = sc.nextInt();\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans = 0;",
"ans",
"0",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }",
"{\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (binarySearch(s, n, t) >= 0)\n ans++;",
"binarySearch(s, n, t) >= 0",
"binarySearch(s, n, t)",
"binarySearch",
"s",
"n",
"t",
"0",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"// 二分探索\n static int binarySearch(int[] a, int n, int key) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;",
"a[mid] == key",
"a[mid]",
"a",
"mid",
"key",
"return mid;",
"mid",
"if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;",
"a[mid] < key",
"a[mid]",
"a",
"mid",
"key",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"right = mid",
"right",
"mid",
"return -1;",
"-1",
"1",
"int[] a",
"a",
"int n",
"n",
"int key",
"key",
"static class MyScanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n\n String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }",
"MyScanner",
"BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);",
"reader",
"new BufferedReader(new InputStreamReader(System.in), 1 << 15)",
"StringTokenizer tokenizer;",
"tokenizer",
"String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }",
"try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }",
"catch (IOException ignored) {\n }",
"IOException ignored",
"{\n }",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public class Main {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }\n\n\n // 二分探索\n static int binarySearch(int[] a, int n, int key) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }\n\n static class MyScanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n\n String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n\n int n = sc.nextInt();\n int[] s = new int[n];\n for (int i = 0; i < n; i++) {\n s[i] = sc.nextInt();\n }\n\n int ans = 0;\n int q = sc.nextInt();\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearch(s, n, t) >= 0)\n ans++;\n }\n\n System.out.println(ans);\n }\n\n\n // 二分探索\n static int binarySearch(int[] a, int n, int key) {\n int left = 0;\n int right = n;\n while (left < right) {\n int mid = (left + right) / 2;\n if (a[mid] == key)\n return mid;\n else if (a[mid] < key)\n left = mid + 1;\n else\n right = mid;\n }\n return -1;\n }\n\n static class MyScanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n\n String next() {\n try {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (IOException ignored) {\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
}
int ans = 0;
int q = sc.nextInt();
for (int i = 0; i < q; i++) {
int t = sc.nextInt();
if (binarySearch(s, n, t) >= 0)
ans++;
}
System.out.println(ans);
}
// 二分探索
static int binarySearch(int[] a, int n, int key) {
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right) / 2;
if (a[mid] == key)
return mid;
else if (a[mid] < key)
left = mid + 1;
else
right = mid;
}
return -1;
}
static class MyScanner {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
StringTokenizer tokenizer;
String next() {
try {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
} catch (IOException ignored) {
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
29,
4,
13,
13,
13,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
4,
13,
13,
13,
2,
13,
17,
13,
30,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
13,
13,
30,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
187,
5
],
[
187,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
8,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
25,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
33,
36
],
[
33,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
25,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
49,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
49,
56
],
[
41,
57
],
[
57,
58
],
[
58,
59
],
[
6,
60
],
[
60,
61
],
[
6,
62
],
[
62,
63
],
[
6,
64
],
[
64,
65
],
[
6,
66
],
[
66,
67
],
[
187,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
70,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
70,
84
],
[
84,
85
],
[
84,
86
],
[
84,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
90,
94
],
[
90,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
70,
99
],
[
99,
100
],
[
68,
101
],
[
101,
102
],
[
68,
103
],
[
103,
104
],
[
187,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
107,
116
],
[
116,
117
],
[
116,
118
],
[
107,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
120,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
107,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
107,
145
],
[
145,
146
],
[
145,
147
],
[
107,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
149,
160
],
[
161,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
107,
169
],
[
169,
170
],
[
170,
171
],
[
107,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
174,
177
],
[
107,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
105,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static Boolean search(int[] S, int t, int low, int high) {\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] S, int[] T) {\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}\n\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tpublic static Boolean search(int[] S, int t, int low, int high) {\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] S, int[] T) {\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}\n\n}",
"Main",
"public static Boolean search(int[] S, int t, int low, int high) {\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}",
"search",
"{\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}",
"int mid = low + (high-low)/2;",
"mid",
"low + (high-low)/2",
"low",
"(high-low)/2",
"(high-low)",
"high",
"low",
"2",
"if (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}",
"high < low",
"high",
"low",
"{\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}",
"return false; // the algorithm has iterated through without finding t",
"false",
"if (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}",
"S[mid] > t",
"S[mid]",
"S",
"mid",
"t",
"{\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}",
"return search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value",
"search(S,t,low,mid-1)",
"search",
"S",
"t",
"low",
"mid-1",
"mid",
"1",
"if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}",
"S[mid] < t",
"S[mid]",
"S",
"mid",
"t",
"{\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}",
"return search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value",
"search(S,t,mid+1,high)",
"search",
"S",
"t",
"mid+1",
"mid",
"1",
"high",
"{ // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"int[] S",
"S",
"int t",
"t",
"int low",
"low",
"int high",
"high",
"public static int contains(int[] S, int[] T) {\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}",
"contains",
"{\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}",
"int counter = 0;",
"counter",
"0",
"int low = 0;",
"low",
"0",
"int high = S.length - 1;",
"high",
"S.length - 1",
"S.length",
"S",
"S.length",
"1",
"for (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}",
"int t",
"T",
"{\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}",
"if (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}",
"search(S, t, low, high)",
"search",
"S",
"t",
"low",
"high",
"{ // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}",
"counter++",
"counter",
"return counter;",
"counter",
"int[] S",
"S",
"int[] T",
"T",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int sizeS = in.nextInt();",
"sizeS",
"in.nextInt()",
"in.nextInt",
"in",
"int[] S = new int[sizeS];",
"S",
"new int[sizeS]",
"sizeS",
"for (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sizeS",
"i",
"sizeS",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = in.nextInt();\n\t\t}",
"S[i] = in.nextInt()",
"S[i]",
"S",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int sizeT = in.nextInt();",
"sizeT",
"in.nextInt()",
"in.nextInt",
"in",
"int[] T = new int[sizeT];",
"T",
"new int[sizeT]",
"sizeT",
"for (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sizeT",
"i",
"sizeT",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = in.nextInt();\n\t\t}",
"T[i] = in.nextInt()",
"T[i]",
"T",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"in.close()",
"in.close",
"in",
"int result = contains(S,T);",
"result",
"contains(S,T)",
"contains",
"S",
"T",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n\t\n\tpublic static Boolean search(int[] S, int t, int low, int high) {\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] S, int[] T) {\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}\n\n}",
"public class Main {\n\t\n\tpublic static Boolean search(int[] S, int t, int low, int high) {\n\t\tint mid = low + (high-low)/2; // initializing middle value to search\n\t\tif (high < low) {\n\t\t\treturn false; // the algorithm has iterated through without finding t\n\t\t\t}\n\t\tif (S[mid] > t) {\n\t\t\treturn search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value\n\t\t\t}\n\t\telse if (S[mid] < t) {\n\t\t\treturn search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value\n\t\t\t}\n\t\telse /*(S[mid] == t)*/ { // this means mid = t, so t is in S\n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] S, int[] T) {\n\t\tint counter = 0;\n\t\tint low = 0;\n\t\tint high = S.length - 1;\n\t\tfor (int t : T) {\n\t\t\tif (search(S, t, low, high)) { // iterates through each value in T and searches for it in S\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint sizeS = in.nextInt();\n\t\tint[] S = new int[sizeS];\n\t\tfor (int i = 0; i < sizeS; i++) {\n\t\t\tS[i] = in.nextInt();\n\t\t}\n\t\tint sizeT = in.nextInt();\n\t\tint[] T = new int[sizeT];\n\t\tfor (int i = 0; i < sizeT; i++) {\n\t\t\tT[i] = in.nextInt();\n\t\t}\n\t\tin.close();\n\t\tint result = contains(S,T);\n\t\tSystem.out.println(result);\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static Boolean search(int[] S, int t, int low, int high) {
int mid = low + (high-low)/2; // initializing middle value to search
if (high < low) {
return false; // the algorithm has iterated through without finding t
}
if (S[mid] > t) {
return search(S,t,low,mid-1); // if t is in S, it'll be in the half of the array less than the middle value
}
else if (S[mid] < t) {
return search(S,t,mid+1,high); // if t is in S, it'll be in the half of the array greater than the middle value
}
else /*(S[mid] == t)*/ { // this means mid = t, so t is in S
return true;
}
}
public static int contains(int[] S, int[] T) {
int counter = 0;
int low = 0;
int high = S.length - 1;
for (int t : T) {
if (search(S, t, low, high)) { // iterates through each value in T and searches for it in S
counter++;
}
}
return counter;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int sizeS = in.nextInt();
int[] S = new int[sizeS];
for (int i = 0; i < sizeS; i++) {
S[i] = in.nextInt();
}
int sizeT = in.nextInt();
int[] T = new int[sizeT];
for (int i = 0; i < sizeT; i++) {
T[i] = in.nextInt();
}
in.close();
int result = contains(S,T);
System.out.println(result);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.