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,
15,
13,
17,
6,
13,
41,
13,
20,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
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,
2,
4,
18,
13,
18,
13,
13,
17,
17,
41,
13,
17,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
2,
4,
18,
13,
18,
13,
13,
17,
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
],
[
113,
8
],
[
113,
9
],
[
9,
10
],
[
9,
11
],
[
113,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
21,
24
],
[
24,
25
],
[
25,
26
],
[
15,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
29,
34
],
[
15,
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
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
51,
58
],
[
48,
59
],
[
15,
60
],
[
60,
61
],
[
60,
62
],
[
15,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
15,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
73,
78
],
[
15,
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
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
96,
103
],
[
15,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
13,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"static int[] boo = new int[100000];",
"boo",
"new int[100000]",
"100000",
"public static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\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[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\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[] st = br.readLine().split(\" \");",
"st",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}",
"{\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}",
"boo[Integer.parseInt(st[i])%100000] = 1",
"boo[Integer.parseInt(st[i])%100000]",
"boo",
"Integer.parseInt(st[i])%100000",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"100000",
"1",
"int ans = 0;",
"ans",
"0",
"n = Integer.parseInt(br.readLine())",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"st = br.readLine().split(\" \")",
"st",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}",
"{\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}",
"ans += boo[Integer.parseInt(st[i])%100000]",
"ans",
"boo[Integer.parseInt(st[i])%100000]",
"boo",
"Integer.parseInt(st[i])%100000",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"100000",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tboo[Integer.parseInt(st[i])%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\tn = Integer.parseInt(br.readLine());\n\t\tst = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
static int[] boo = new int[100000];
public static void main(String[] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] st = br.readLine().split(" ");
//boolean[] boo = new boolean[100000];
for (int i = 0; i < n; i++) {
boo[Integer.parseInt(st[i])%100000] = 1;
}
int ans = 0;
n = Integer.parseInt(br.readLine());
st = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
ans += boo[Integer.parseInt(st[i])%100000] ;
}
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,
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,
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,
2,
18,
13,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
29,
17,
14,
2,
13,
13,
30,
0,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
29,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
181,
5
],
[
181,
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
],
[
181,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
106,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
106,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
139,
140
],
[
134,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
141,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
128,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
106,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
104,
176
],
[
176,
177
],
[
104,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"import java.util.Scanner;\n\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[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }\n \n public static boolean isContain(int num, int[] ary) {\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\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[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }\n \n public static boolean isContain(int num, int[] ary) {\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\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[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ary = new int[n];",
"ary",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ary[i] = sc.nextInt();\n }",
"{\n ary[i] = sc.nextInt();\n }",
"ary[i] = sc.nextInt()",
"ary[i]",
"ary",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] t = new int[n];",
"t",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"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 res = 0;",
"res",
"0",
"for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (isContain(t[i], ary)) {\n res++;\n }\n }",
"{\n if (isContain(t[i], ary)) {\n res++;\n }\n }",
"if (isContain(t[i], ary)) {\n res++;\n }",
"isContain(t[i], ary)",
"isContain",
"t[i]",
"t",
"i",
"ary",
"{\n res++;\n }",
"res++",
"res",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public static boolean isContain(int num, int[] ary) {\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\n }",
"isContain",
"{\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\n }",
"int head = 0;",
"head",
"0",
"int tail = ary.length-1;",
"tail",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"int middle = (head + tail) / 2;",
"middle",
"(head + tail) / 2",
"(head + tail)",
"head",
"tail",
"2",
"while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }",
"middle != head",
"middle",
"head",
"{\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }",
"int m = ary[middle];",
"m",
"ary[middle]",
"ary",
"middle",
"if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }",
"m == num",
"m",
"num",
"{\n return true;\n }",
"return true;",
"true",
"if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }",
"m < num",
"m",
"num",
"{\n head = middle;\n }",
"head = middle",
"head",
"middle",
"if (m > num) {\n tail = middle;\n }",
"m > num",
"m",
"num",
"{\n tail = middle;\n }",
"tail = middle",
"tail",
"middle",
"middle = (head + tail) / 2",
"middle",
"(head + tail) / 2",
"(head + tail)",
"head",
"tail",
"2",
"return ary[head] == num || ary[tail] == num;",
"ary[head] == num || ary[tail] == num",
"ary[head] == num",
"ary[head]",
"ary",
"head",
"num",
"ary[tail] == num",
"ary[tail]",
"ary",
"tail",
"num",
"int num",
"num",
"int[] ary",
"ary",
"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[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }\n \n public static boolean isContain(int num, int[] ary) {\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\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[] ary = new int[n];\n \n for (int i = 0; i < n; i++) {\n ary[i] = sc.nextInt();\n }\n \n n = sc.nextInt();\n int[] t = new int[n];\n \n for (int i = 0; i < n; i++) {\n t[i] = sc.nextInt();\n }\n \n int res = 0;\n for (int i = 0; i < n; i++) {\n if (isContain(t[i], ary)) {\n res++;\n }\n }\n \n System.out.println(res);\n }\n \n public static boolean isContain(int num, int[] ary) {\n int head = 0;\n int tail = ary.length-1;\n int middle = (head + tail) / 2;\n while (middle != head) {\n int m = ary[middle];\n if (m == num) {\n return true;\n } else if (m < num) {\n head = middle;\n } else if (m > num) {\n tail = middle;\n }\n middle = (head + tail) / 2;\n }\n return ary[head] == num || ary[tail] == num;\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[] ary = new int[n];
for (int i = 0; i < n; i++) {
ary[i] = sc.nextInt();
}
n = sc.nextInt();
int[] t = new int[n];
for (int i = 0; i < n; i++) {
t[i] = sc.nextInt();
}
int res = 0;
for (int i = 0; i < n; i++) {
if (isContain(t[i], ary)) {
res++;
}
}
System.out.println(res);
}
public static boolean isContain(int num, int[] ary) {
int head = 0;
int tail = ary.length-1;
int middle = (head + tail) / 2;
while (middle != head) {
int m = ary[middle];
if (m == num) {
return true;
} else if (m < num) {
head = middle;
} else if (m > num) {
tail = middle;
}
middle = (head + tail) / 2;
}
return ary[head] == num || ary[tail] == num;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
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,
41,
13,
41,
13,
41,
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,
0,
13,
2,
2,
13,
13,
17,
42,
17,
30,
14,
2,
13,
18,
13,
2,
13,
17,
30,
3,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
2,
13,
18,
13,
13,
2,
13,
13,
30,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
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
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
15,
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
],
[
55,
57
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
8,
79
],
[
79,
80
],
[
8,
81
],
[
81,
82
],
[
8,
83
],
[
83,
84
],
[
8,
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
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
106,
107
],
[
106,
108
],
[
97,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
97,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
118,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
146,
148
],
[
139,
149
],
[
149,
150
],
[
139,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
151,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
168,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
174,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
8,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
6,
193
],
[
193,
194
]
] | [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n\tint i;\n\tint j;\n\tint key;\n\tint count = 0;\n\tScanner scan = new Scanner(System.in);\n\n\tint n = scan.nextInt();\n\tint S[] = new int[n];\n\tfor(i=0 ; i<n ; i++){S[i] = scan.nextInt();}\n\n\tint q = scan.nextInt();\n\tint T[] = new int[q];\n\tfor(j=0 ; j<q ; j++){T[j] = scan.nextInt();}\n\n\tint l;\n\tint r;\n\tint m;\n\tfor(j=0 ; j<q ; j++){\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n\tint i;\n\tint j;\n\tint key;\n\tint count = 0;\n\tScanner scan = new Scanner(System.in);\n\n\tint n = scan.nextInt();\n\tint S[] = new int[n];\n\tfor(i=0 ; i<n ; i++){S[i] = scan.nextInt();}\n\n\tint q = scan.nextInt();\n\tint T[] = new int[q];\n\tfor(j=0 ; j<q ; j++){T[j] = scan.nextInt();}\n\n\tint l;\n\tint r;\n\tint m;\n\tfor(j=0 ; j<q ; j++){\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n\n }\n}",
"Main",
"public static void main(String[] args){\n\tint i;\n\tint j;\n\tint key;\n\tint count = 0;\n\tScanner scan = new Scanner(System.in);\n\n\tint n = scan.nextInt();\n\tint S[] = new int[n];\n\tfor(i=0 ; i<n ; i++){S[i] = scan.nextInt();}\n\n\tint q = scan.nextInt();\n\tint T[] = new int[q];\n\tfor(j=0 ; j<q ; j++){T[j] = scan.nextInt();}\n\n\tint l;\n\tint r;\n\tint m;\n\tfor(j=0 ; j<q ; j++){\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n\n }",
"main",
"{\n\tint i;\n\tint j;\n\tint key;\n\tint count = 0;\n\tScanner scan = new Scanner(System.in);\n\n\tint n = scan.nextInt();\n\tint S[] = new int[n];\n\tfor(i=0 ; i<n ; i++){S[i] = scan.nextInt();}\n\n\tint q = scan.nextInt();\n\tint T[] = new int[q];\n\tfor(j=0 ; j<q ; j++){T[j] = scan.nextInt();}\n\n\tint l;\n\tint r;\n\tint m;\n\tfor(j=0 ; j<q ; j++){\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n\n }",
"int i;",
"i",
"int j;",
"j",
"int key;",
"key",
"int count = 0;",
"count",
"0",
"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(i=0 ; i<n ; i++){S[i] = scan.nextInt();}",
"i=0 ;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{S[i] = scan.nextInt();}",
"{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 T[] = new int[q];",
"T",
"new int[q]",
"q",
"for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}",
"j=0 ;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{T[j] = scan.nextInt();}",
"{T[j] = scan.nextInt();}",
"T[j] = scan.nextInt()",
"T[j]",
"T",
"j",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int l;",
"l",
"int r;",
"r",
"int m;",
"m",
"for(j=0 ; j<q ; j++){\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}",
"j=0 ;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}",
"{\n\t key = T[j];\n\t l = 0;\n\t r = n;\n\t m = (l+r)/2;\n\t \n\t while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }\n\t}",
"key = T[j]",
"key",
"T[j]",
"T",
"j",
"l = 0",
"l",
"0",
"r = n",
"r",
"n",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"while(true){\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }",
"true",
"{\n\t\tif(key > S[n-1]){break;}\n\t\t\n\t\tif(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}\n\t }",
"if(key > S[n-1]){break;}",
"key > S[n-1]",
"key",
"S[n-1]",
"S",
"n-1",
"n",
"1",
"{break;}",
"break;",
"if(key == S[m]){\n\t\t count++;\n\t\t break;\n\t\t}\n\t\telse if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}",
"key == S[m]",
"key",
"S[m]",
"S",
"m",
"{\n\t\t count++;\n\t\t break;\n\t\t}",
"count++",
"count",
"break;",
"if(key!=S[m] && l==m){break;}\n\t\t\n\t\telse if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}",
"key!=S[m] && l==m",
"key!=S[m]",
"key",
"S[m]",
"S",
"m",
"l==m",
"l",
"m",
"{break;}",
"break;",
"if(key < S[m]){\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}\n\t\telse if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}",
"key < S[m]",
"key",
"S[m]",
"S",
"m",
"{\n\t\t r = m;\n\t\t m = (l+r)/2;\n\t\t}",
"r = m",
"r",
"m",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(key > S[m]){\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}",
"key > S[m]",
"key",
"S[m]",
"S",
"m",
"{\n\t\t l = m+1;\n\t\t m = (l+r)/2;\n\t\t}",
"l = m+1",
"l",
"m+1",
"m",
"1",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
int i;
int j;
int key;
int count = 0;
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int S[] = new int[n];
for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}
int q = scan.nextInt();
int T[] = new int[q];
for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}
int l;
int r;
int m;
for(j=0 ; j<q ; j++){
key = T[j];
l = 0;
r = n;
m = (l+r)/2;
while(true){
if(key > S[n-1]){break;}
if(key == S[m]){
count++;
break;
}
else if(key!=S[m] && l==m){break;}
else if(key < S[m]){
r = m;
m = (l+r)/2;
}
else if(key > S[m]){
l = m+1;
m = (l+r)/2;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
20,
17,
41,
13,
20,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
18,
13,
13,
13,
13,
14,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
41,
13,
41,
13,
17,
42,
2,
2,
13,
17,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
191,
5
],
[
191,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
8,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
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
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
8,
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
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
94,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
6,
114
],
[
114,
115
],
[
191,
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
],
[
118,
129
],
[
129,
130
],
[
129,
131
],
[
118,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
132,
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
],
[
155,
156
],
[
155,
157
],
[
148,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
158,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
170,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
118,
182
],
[
182,
183
],
[
116,
184
],
[
184,
185
],
[
116,
186
],
[
186,
187
],
[
116,
188
],
[
188,
189
],
[
0,
190
],
[
190,
191
],
[
190,
192
]
] | [
"import java.util.*;\n\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static int binarySearch(int t, int[] S, int len){\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static int binarySearch(int t, int[] S, int len){\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n",
"n",
"q",
"q",
"cnt = 0",
"cnt",
"0",
"isExist;",
"isExist",
"int[] S = new int[100000]",
"S",
"new int[100000]",
"100000",
"T = new int[50000];",
"T",
"new int[50000]",
"50000",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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",
"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",
"for(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\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\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}",
"isExist = binarySearch(T[i], S, n)",
"isExist",
"binarySearch(T[i], S, n)",
"binarySearch",
"T[i]",
"T",
"i",
"S",
"n",
"if(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}",
"isExist == 1",
"isExist",
"1",
"{\n\t\t\t\tcnt ++;\n\t\t\t}",
"cnt ++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String args[]",
"args",
"public static int binarySearch(int t, int[] S, int len){\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\n\t}",
"binarySearch",
"{\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\n\t}",
"int first = 0",
"first",
"0",
"last = len - 1",
"last",
"len - 1",
"len",
"1",
"middle;",
"middle",
"int isExist = 0;",
"isExist",
"0",
"while(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}",
"isExist == 0 && first <= last",
"isExist == 0",
"isExist",
"0",
"first <= last",
"first",
"last",
"{\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}",
"middle = (first + last) / 2",
"middle",
"(first + last) / 2",
"(first + last)",
"first",
"last",
"2",
"if(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}",
"S[middle] == t",
"S[middle]",
"S",
"middle",
"t",
"{\n\t\t\t\tisExist = 1;\n\t\t\t}",
"isExist = 1",
"isExist",
"1",
"if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}",
"t < S[middle]",
"t",
"S[middle]",
"S",
"middle",
"{\n\t\t\t\tlast = middle - 1;\n\t\t\t}",
"last = middle - 1",
"last",
"middle - 1",
"middle",
"1",
"if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}",
"S[middle] < t",
"S[middle]",
"S",
"middle",
"t",
"{\n\t\t\t\tfirst = middle + 1;\n\t\t\t}",
"first = middle + 1",
"first",
"middle + 1",
"middle",
"1",
"return isExist;",
"isExist",
"int t",
"t",
"int[] S",
"S",
"int len",
"len",
"public class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static int binarySearch(int t, int[] S, int len){\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\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, q, cnt = 0, isExist;\n\t\tint[] S = new int[100000], T = new int[50000];\n\t\t\n\t\tn = sc.nextInt();\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tq = sc.nextInt();\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tisExist = binarySearch(T[i], S, n);\n\t\t\tif(isExist == 1){\n\t\t\t\tcnt ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static int binarySearch(int t, int[] S, int len){\n\t\tint first = 0, last = len - 1, middle;\n\t\tint isExist = 0;\n\t\t\n\t\twhile(isExist == 0 && first <= last){\n\t\t\tmiddle = (first + last) / 2;\n\t\t\tif(S[middle] == t){\n\t\t\t\tisExist = 1;\n\t\t\t}\n\t\t\telse if(t < S[middle]){\n\t\t\t\tlast = middle - 1;\n\t\t\t}\n\t\t\telse if(S[middle] < t){\n\t\t\t\tfirst = middle + 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isExist;\n\t}\n}",
"Main"
] | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n, q, cnt = 0, isExist;
int[] S = new int[100000], T = new int[50000];
n = sc.nextInt();
for(int i = 0; i < n; i++){
S[i] = sc.nextInt();
}
q = sc.nextInt();
for(int i = 0; i < q; i++){
T[i] = sc.nextInt();
}
for(int i = 0; i < q; i++){
isExist = binarySearch(T[i], S, n);
if(isExist == 1){
cnt ++;
}
}
System.out.println(cnt);
}
public static int binarySearch(int t, int[] S, int len){
int first = 0, last = len - 1, middle;
int isExist = 0;
while(isExist == 0 && first <= last){
middle = (first + last) / 2;
if(S[middle] == t){
isExist = 1;
}
else if(t < S[middle]){
last = middle - 1;
}
else if(S[middle] < t){
first = middle + 1;
}
}
return isExist;
}
} |
[
7,
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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
13,
2,
13,
17,
42,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
17,
3,
14,
2,
2,
13,
13,
40,
17,
3,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
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
],
[
158,
5
],
[
158,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
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
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
8,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
83,
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
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
94,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
115,
122
],
[
115,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
123,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
8,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
6,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\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 Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count=0;",
"count",
"0",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array1[]=new int[n];",
"array1",
"new int[n]",
"n",
"for(int i=0;i<n;i++)array1[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"array1[i]=sc.nextInt();",
"array1[i]=sc.nextInt()",
"array1[i]",
"array1",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q=sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array2[]=new int[q];",
"array2",
"new int[q]",
"q",
"for(int i=0;i<q;i++) array2[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"array2[i]=sc.nextInt();",
"array2[i]=sc.nextInt()",
"array2[i]",
"array2",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }",
"{\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }",
"int start=0;",
"start",
"0",
"int goal=n-1;",
"goal",
"n-1",
"n",
"1",
"while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }",
"true",
"{\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }",
"int middle=(int)(start+goal)/2;",
"middle",
"(int)(start+goal)/2",
"(int)(start+goal)",
"start",
"goal",
"2",
"if(array2[i]==array1[middle]){\n count+=1;\n break;\n }",
"array2[i]==array1[middle]",
"array2[i]",
"array2",
"i",
"array1[middle]",
"array1",
"middle",
"{\n count+=1;\n break;\n }",
"count+=1",
"count",
"1",
"break;",
"if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;",
"start-goal>-1",
"start-goal",
"start",
"goal",
"-1",
"1",
"break;",
"if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;",
"array1[middle]<array2[i]",
"array1[middle]",
"array1",
"middle",
"array2[i]",
"array2",
"i",
"start=middle+1",
"start",
"middle+1",
"middle",
"1",
"if(array2[i]<array1[middle]) goal=middle-1;",
"array2[i]<array1[middle]",
"array2[i]",
"array2",
"i",
"array1[middle]",
"array1",
"middle",
"goal=middle-1",
"goal",
"middle-1",
"middle",
"1",
"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 Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\n }\n }\n System.out.println(count);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int count=0;\n \n int n=sc.nextInt(); \n int array1[]=new int[n];\n for(int i=0;i<n;i++)array1[i]=sc.nextInt();\n \n int q=sc.nextInt();\n int array2[]=new int[q];\n for(int i=0;i<q;i++) array2[i]=sc.nextInt();\n \n for(int i=0;i<q;i++){\n int start=0;\n int goal=n-1;\n while(true){\n int middle=(int)(start+goal)/2;\n if(array2[i]==array1[middle]){\n count+=1;\n break;\n }\n if(start-goal>-1) break;\n else if(array1[middle]<array2[i]) start=middle+1;\n else if(array2[i]<array1[middle]) goal=middle-1;\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 count=0;
int n=sc.nextInt();
int array1[]=new int[n];
for(int i=0;i<n;i++)array1[i]=sc.nextInt();
int q=sc.nextInt();
int array2[]=new int[q];
for(int i=0;i<q;i++) array2[i]=sc.nextInt();
for(int i=0;i<q;i++){
int start=0;
int goal=n-1;
while(true){
int middle=(int)(start+goal)/2;
if(array2[i]==array1[middle]){
count+=1;
break;
}
if(start-goal>-1) break;
else if(array1[middle]<array2[i]) start=middle+1;
else if(array2[i]<array1[middle]) goal=middle-1;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
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,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
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,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
28,
13,
13,
30,
30,
41,
13,
17,
41,
13,
2,
13,
17,
41,
13,
2,
2,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
13,
13,
3,
0,
13,
2,
13,
2,
2,
13,
13,
17,
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
],
[
7,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
29,
34
],
[
14,
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
],
[
51,
54
],
[
54,
55
],
[
54,
56
],
[
14,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
14,
65
],
[
65,
66
],
[
65,
67
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
71,
76
],
[
14,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
14,
99
],
[
99,
100
],
[
99,
101
],
[
14,
102
],
[
102,
103
],
[
102,
104
],
[
102,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
106,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
106,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
136,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
147,
153
],
[
153,
154
],
[
153,
155
],
[
147,
156
],
[
156,
157
],
[
156,
158
],
[
136,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
136,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
14,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
12,
179
],
[
179,
180
]
] | [
"import java.io.*;\nimport java.util.*;\n\nclass Main{\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static void main(String[] args) throws IOException{\n int n1 = Integer.parseInt(br.readLine());\n int[] a1 = new int[n1];\n String[] s1 = br.readLine().split(\" \");\n for(int i=0; i<n1; i++)\n a1[i] = Integer.parseInt(s1[i]);\n int n2 = Integer.parseInt(br.readLine());\n int[] a2 = new int[n2];\n String[] s2 = br.readLine().split(\" \");\n for(int i=0; i<n2; i++)\n a2[i] = Integer.parseInt(s2[i]);\n\n int ans = 0;\n for(int i: a2){\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static void main(String[] args) throws IOException{\n int n1 = Integer.parseInt(br.readLine());\n int[] a1 = new int[n1];\n String[] s1 = br.readLine().split(\" \");\n for(int i=0; i<n1; i++)\n a1[i] = Integer.parseInt(s1[i]);\n int n2 = Integer.parseInt(br.readLine());\n int[] a2 = new int[n2];\n String[] s2 = br.readLine().split(\" \");\n for(int i=0; i<n2; i++)\n a2[i] = Integer.parseInt(s2[i]);\n\n int ans = 0;\n for(int i: a2){\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"public static void main(String[] args) throws IOException{\n int n1 = Integer.parseInt(br.readLine());\n int[] a1 = new int[n1];\n String[] s1 = br.readLine().split(\" \");\n for(int i=0; i<n1; i++)\n a1[i] = Integer.parseInt(s1[i]);\n int n2 = Integer.parseInt(br.readLine());\n int[] a2 = new int[n2];\n String[] s2 = br.readLine().split(\" \");\n for(int i=0; i<n2; i++)\n a2[i] = Integer.parseInt(s2[i]);\n\n int ans = 0;\n for(int i: a2){\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n int n1 = Integer.parseInt(br.readLine());\n int[] a1 = new int[n1];\n String[] s1 = br.readLine().split(\" \");\n for(int i=0; i<n1; i++)\n a1[i] = Integer.parseInt(s1[i]);\n int n2 = Integer.parseInt(br.readLine());\n int[] a2 = new int[n2];\n String[] s2 = br.readLine().split(\" \");\n for(int i=0; i<n2; i++)\n a2[i] = Integer.parseInt(s2[i]);\n\n int ans = 0;\n for(int i: a2){\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }\n System.out.println(ans);\n }",
"int n1 = Integer.parseInt(br.readLine());",
"n1",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] a1 = new int[n1];",
"a1",
"new int[n1]",
"n1",
"String[] s1 = br.readLine().split(\" \");",
"s1",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0; i<n1; i++)\n a1[i] = Integer.parseInt(s1[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n1",
"i",
"n1",
"i++",
"i++",
"i",
"a1[i] = Integer.parseInt(s1[i]);",
"a1[i] = Integer.parseInt(s1[i])",
"a1[i]",
"a1",
"i",
"Integer.parseInt(s1[i])",
"Integer.parseInt",
"Integer",
"s1[i]",
"s1",
"i",
"int n2 = Integer.parseInt(br.readLine());",
"n2",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] a2 = new int[n2];",
"a2",
"new int[n2]",
"n2",
"String[] s2 = br.readLine().split(\" \");",
"s2",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0; i<n2; i++)\n a2[i] = Integer.parseInt(s2[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n2",
"i",
"n2",
"i++",
"i++",
"i",
"a2[i] = Integer.parseInt(s2[i]);",
"a2[i] = Integer.parseInt(s2[i])",
"a2[i]",
"a2",
"i",
"Integer.parseInt(s2[i])",
"Integer.parseInt",
"Integer",
"s2[i]",
"s2",
"i",
"int ans = 0;",
"ans",
"0",
"for(int i: a2){\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }",
"int i",
"a2",
"{\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }",
"{\n int l = 0;\n int r = n1-1;\n int m = (r-l)/2;\n for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }\n }",
"int l = 0;",
"l",
"0",
"int r = n1-1;",
"r",
"n1-1",
"n1",
"1",
"int m = (r-l)/2;",
"m",
"(r-l)/2",
"(r-l)",
"r",
"l",
"2",
"for(int j=0; j<a1.length; j++){\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<a1.length",
"j",
"a1.length",
"a1",
"a1.length",
"j++",
"j++",
"j",
"{\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }",
"{\n if(a1[m] == i){\n ans++;\n break;\n }\n if(a1[m]>i)\n r=m;\n else\n l=m;\n if(r==l)\n break;\n m=r-(r-l)/2;\n }",
"if(a1[m] == i){\n ans++;\n break;\n }",
"a1[m] == i",
"a1[m]",
"a1",
"m",
"i",
"{\n ans++;\n break;\n }",
"ans++",
"ans",
"break;",
"if(a1[m]>i)\n r=m;\n else\n l=m;",
"a1[m]>i",
"a1[m]",
"a1",
"m",
"i",
"r=m",
"r",
"m",
"l=m",
"l",
"m",
"if(r==l)\n break;",
"r==l",
"r",
"l",
"break;",
"m=r-(r-l)/2",
"m",
"r-(r-l)/2",
"r",
"(r-l)/2",
"(r-l)",
"r",
"l",
"2",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args"
] | import java.io.*;
import java.util.*;
class Main{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException{
int n1 = Integer.parseInt(br.readLine());
int[] a1 = new int[n1];
String[] s1 = br.readLine().split(" ");
for(int i=0; i<n1; i++)
a1[i] = Integer.parseInt(s1[i]);
int n2 = Integer.parseInt(br.readLine());
int[] a2 = new int[n2];
String[] s2 = br.readLine().split(" ");
for(int i=0; i<n2; i++)
a2[i] = Integer.parseInt(s2[i]);
int ans = 0;
for(int i: a2){
int l = 0;
int r = n1-1;
int m = (r-l)/2;
for(int j=0; j<a1.length; j++){
if(a1[m] == i){
ans++;
break;
}
if(a1[m]>i)
r=m;
else
l=m;
if(r==l)
break;
m=r-(r-l)/2;
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
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,
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,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
2,
13,
17,
41,
13,
42,
17,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
13,
13,
30,
3,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
158,
5
],
[
158,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
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
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
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
],
[
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
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
85,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
85,
99
],
[
99,
100
],
[
85,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
111,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
128,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
8,
152
],
[
152,
153
],
[
153,
154
],
[
6,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}\n}\n\t",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}",
"main",
"{\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}",
"int count = 0;",
"count",
"0",
"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\t\t\tS[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = scanner.nextInt();\n\t\t}",
"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\t\tT[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = scanner.nextInt();\n\t\t}",
"T[i] = scanner.nextInt()",
"T[i]",
"T",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"for (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\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 index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int index = T[i];",
"index",
"T[i]",
"T",
"i",
"int min = 0;",
"min",
"0",
"int max = n - 1;",
"max",
"n - 1",
"n",
"1",
"int weight;",
"weight",
"while (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"true",
"{\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"weight = (min + max) / 2",
"weight",
"(min + max) / 2",
"(min + max)",
"min",
"max",
"2",
"if (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}",
"S[weight] == index",
"S[weight]",
"S",
"weight",
"index",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}",
"min > max",
"min",
"max",
"{\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"{\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}",
"if (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}",
"S[weight] < index",
"S[weight]",
"S",
"weight",
"index",
"{\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t}",
"min = weight + 1",
"min",
"weight + 1",
"weight",
"1",
"{\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}",
"max = weight - 1",
"max",
"weight - 1",
"weight",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scanner.close()",
"scanner.close",
"scanner",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tScanner scanner = new Scanner(System.in);\n\n\t\tint n = scanner.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tS[i] = scanner.nextInt();\n\t\t}\n\n\t\tint q = scanner.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tT[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint index = T[i];\n\t\t\tint min = 0;\n\t\t\tint max = n - 1;\n\t\t\tint weight;\n\t\t\twhile (true) {\n\t\t\t\tweight = (min + max) / 2;\n\t\t\t\tif (S[weight] == index) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (min > max) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tif (S[weight] < index) {\n\t\t\t\t\t\tmin = weight + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax = weight - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n scanner.close();\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int count = 0;
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();
}
for (int i = 0; i < q; i++) {
int index = T[i];
int min = 0;
int max = n - 1;
int weight;
while (true) {
weight = (min + max) / 2;
if (S[weight] == index) {
count++;
break;
} else if (min > max) {
break;
} else {
if (S[weight] < index) {
min = weight + 1;
} else {
max = weight - 1;
}
}
}
}
System.out.println(count);
scanner.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,
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,
18,
13,
13,
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,
30,
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,
2,
13,
18,
13,
13,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
2,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
174,
5
],
[
174,
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
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
70,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
8,
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
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
94,
101
],
[
101,
102
],
[
102,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
6,
110
],
[
110,
111
],
[
174,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
114,
125
],
[
125,
126
],
[
114,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
137,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
145,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
114,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
112,
169
],
[
169,
170
],
[
112,
171
],
[
171,
172
],
[
0,
173
],
[
173,
174
],
[
173,
175
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }\n\n static boolean binarySearch(int[] a, int x){\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }\n\n static boolean binarySearch(int[] a, int x){\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }",
"main",
"{\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = stdIn.nextInt();\n }",
"{\n s[i] = stdIn.nextInt();\n }",
"s[i] = stdIn.nextInt()",
"s[i]",
"s",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int q = stdIn.nextInt();",
"q",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] t = new int[q];",
"t",
"new int[q]",
"q",
"for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t[i] = stdIn.nextInt();\n }",
"{\n t[i] = stdIn.nextInt();\n }",
"t[i] = stdIn.nextInt()",
"t[i]",
"t",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"java.util.Arrays.sort(s)",
"java.util.Arrays.sort",
"java.util.Arrays",
"java.util",
"java",
"java.util",
"java.util.Arrays",
"s",
"int counter = 0;",
"counter",
"0",
"for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(binarySearch(s, t[i])){\n counter++;\n }\n }",
"{\n if(binarySearch(s, t[i])){\n counter++;\n }\n }",
"if(binarySearch(s, t[i])){\n counter++;\n }",
"binarySearch(s, t[i])",
"binarySearch",
"s",
"t[i]",
"t",
"i",
"{\n counter++;\n }",
"counter++",
"counter",
"System.out.println(counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"counter",
"String[] args",
"args",
"static boolean binarySearch(int[] a, int x){\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }",
"binarySearch",
"{\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }",
"int from = 0;",
"from",
"0",
"int to = a.length-1;",
"to",
"a.length-1",
"a.length",
"a",
"a.length",
"1",
"int mid;",
"mid",
"do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);",
"x != a[mid] && from <= to",
"x != a[mid]",
"x",
"a[mid]",
"a",
"mid",
"from <= to",
"from",
"to",
"{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }",
"mid = (from + to) / 2",
"mid",
"(from + to) / 2",
"(from + to)",
"from",
"to",
"2",
"if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }",
"x < a[mid]",
"x",
"a[mid]",
"a",
"mid",
"{\n to = mid - 1;\n }",
"to = mid - 1",
"to",
"mid - 1",
"mid",
"1",
"{\n from = mid+1;\n }",
"from = mid+1",
"from",
"mid+1",
"mid",
"1",
"return (a[mid] == x);",
"(a[mid] == x)",
"a[mid]",
"a",
"mid",
"x",
"int[] a",
"a",
"int x",
"x",
"public class Main{\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }\n\n static boolean binarySearch(int[] a, int x){\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }\n}",
"public class Main{\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] s = new int[n];\n for(int i=0; i<n; i++){\n s[i] = stdIn.nextInt();\n }\n\n int q = stdIn.nextInt();\n int[] t = new int[q];\n for(int i=0; i<q; i++){\n t[i] = stdIn.nextInt();\n }\n\n java.util.Arrays.sort(s);\n\n int counter = 0;\n for(int i=0; i<q; i++){\n if(binarySearch(s, t[i])){\n counter++;\n }\n }\n\n System.out.println(counter);\n }\n\n static boolean binarySearch(int[] a, int x){\n int from = 0;\n int to = a.length-1;\n int mid;\n do{\n mid = (from + to) / 2;\n if(x < a[mid]){\n to = mid - 1;\n }else{\n from = mid+1;\n }\n }while(x != a[mid] && from <= to);\n\n return (a[mid] == x);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] s = new int[n];
for(int i=0; i<n; i++){
s[i] = stdIn.nextInt();
}
int q = stdIn.nextInt();
int[] t = new int[q];
for(int i=0; i<q; i++){
t[i] = stdIn.nextInt();
}
java.util.Arrays.sort(s);
int counter = 0;
for(int i=0; i<q; i++){
if(binarySearch(s, t[i])){
counter++;
}
}
System.out.println(counter);
}
static boolean binarySearch(int[] a, int x){
int from = 0;
int to = a.length-1;
int mid;
do{
mid = (from + to) / 2;
if(x < a[mid]){
to = mid - 1;
}else{
from = mid+1;
}
}while(x != a[mid] && from <= to);
return (a[mid] == x);
}
}
|
[
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,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
114,
11
],
[
114,
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
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
14,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
12,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
] | [
"import java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n\n Scanner sc = new Scanner(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.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) throws IOException {\n\n Scanner sc = new Scanner(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 Scanner sc = new Scanner(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 Scanner sc = new Scanner(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 }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(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",
"public class Main {\n public static void main(String[] args) throws IOException {\n\n Scanner sc = new Scanner(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 public static void main(String[] args) throws IOException {\n\n Scanner sc = new Scanner(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.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(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,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
17,
30,
40,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
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,
12,
13,
30,
38,
5,
13,
30,
30,
4,
18,
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
],
[
361,
11
],
[
361,
12
],
[
12,
13
],
[
12,
14
],
[
361,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
17,
23
],
[
23,
24
],
[
23,
25
],
[
17,
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
],
[
17,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
17,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
17,
56
],
[
56,
57
],
[
56,
58
],
[
17,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
73,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
17,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
15,
89
],
[
89,
90
],
[
0,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
91,
99
],
[
99,
100
],
[
99,
101
],
[
91,
102
],
[
102,
103
],
[
102,
104
],
[
91,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
105,
113
],
[
113,
114
],
[
91,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
118,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
129,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
125,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
117,
150
],
[
150,
151
],
[
91,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
155,
163
],
[
163,
164
],
[
164,
165
],
[
91,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
166,
177
],
[
177,
178
],
[
91,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
189,
191
],
[
182,
192
],
[
192,
193
],
[
181,
194
],
[
194,
195
],
[
195,
196
],
[
91,
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
],
[
91,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
233,
237
],
[
237,
238
],
[
232,
239
],
[
239,
240
],
[
239,
241
],
[
232,
242
],
[
242,
243
],
[
242,
244
],
[
232,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
232,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
253,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
232,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
262,
266
],
[
266,
267
],
[
266,
268
],
[
261,
269
],
[
269,
270
],
[
270,
271
],
[
232,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
276,
280
],
[
280,
281
],
[
280,
282
],
[
275,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
283,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
289,
291
],
[
275,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
293,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
292,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
304,
308
],
[
292,
309
],
[
309,
310
],
[
310,
311
],
[
274,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
91,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
318,
323
],
[
323,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
327,
329
],
[
324,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
332,
334
],
[
323,
335
],
[
335,
336
],
[
318,
337
],
[
337,
338
],
[
91,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
344,
345
],
[
343,
346
],
[
346,
347
],
[
91,
348
],
[
348,
349
],
[
348,
350
],
[
350,
351
],
[
351,
352
],
[
352,
353
],
[
352,
354
],
[
351,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
91,
359
],
[
0,
360
],
[
360,
361
],
[
360,
362
]
] | [
"import java.io.*;\nimport java.util.*;\nimport static java.lang.System.*;\n\npublic class Main {\n\tstatic FastScanner sc = new FastScanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}\n}\n\n\n\nclass FastScanner implements Closeable {\n\tprivate final InputStream in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tpublic FastScanner(InputStream in) {this.in = in;}\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {return true;}\n\t\telse{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\tprivate static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\tpublic boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {throw new NumberFormatException();}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() { return Double.parseDouble(next());}\n\tpublic void close() {\n\t\ttry {in.close();}\n\t\tcatch (IOException e) {}\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"public class Main {\n\tstatic FastScanner sc = new FastScanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}\n}",
"Main",
"static FastScanner sc = new FastScanner(System.in);",
"sc",
"new FastScanner(System.in)",
"public static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}",
"main",
"{\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {ar[i] = sc.nextInt();}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{ar[i] = sc.nextInt();}",
"{ar[i] = sc.nextInt();}",
"ar[i] = sc.nextInt()",
"ar[i]",
"ar",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Arrays.sort(ar)",
"Arrays.sort",
"Arrays",
"ar",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int total = 0;",
"total",
"0",
"for (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}",
"{\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}",
"if (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}",
"Arrays.binarySearch(ar,sc.nextInt()) >= 0",
"Arrays.binarySearch(ar,sc.nextInt())",
"Arrays.binarySearch",
"Arrays",
"ar",
"sc.nextInt()",
"sc.nextInt",
"sc",
"0",
"{total++;}",
"total++",
"total",
"out.println(total)",
"out.println",
"out",
"total",
"String[] args",
"args",
"class FastScanner implements Closeable {\n\tprivate final InputStream in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tpublic FastScanner(InputStream in) {this.in = in;}\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {return true;}\n\t\telse{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\tprivate static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\tpublic boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {throw new NumberFormatException();}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() { return Double.parseDouble(next());}\n\tpublic void close() {\n\t\ttry {in.close();}\n\t\tcatch (IOException e) {}\n\t}\n}",
"FastScanner",
"private final InputStream in;",
"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",
"public FastScanner(InputStream in) {this.in = in;}",
"FastScanner",
"{this.in = in;}",
"this.in = in",
"this.in",
"this",
"this.in",
"in",
"InputStream in",
"in",
"private boolean hasNextByte() {\n\t\tif (ptr < buflen) {return true;}\n\t\telse{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (ptr < buflen) {return true;}\n\t\telse{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}\n\t\treturn true;\n\t}",
"if (ptr < buflen) {return true;}\n\t\telse{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{return true;}",
"return true;",
"true",
"{\n\t\t\tptr = 0;\n\t\t\ttry {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}\n\t\t\tif (buflen <= 0) {return false;}\n\t\t}",
"ptr = 0",
"ptr",
"0",
"try {buflen = in.read(buffer);}\n\t\t\tcatch (IOException e) {e.printStackTrace();}",
"catch (IOException e) {e.printStackTrace();}",
"IOException e",
"{e.printStackTrace();}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{buflen = in.read(buffer);}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {return false;}",
"buflen <= 0",
"buflen",
"0",
"{return false;}",
"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\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = 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 b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = 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 b = readByte();",
"b",
"readByte()",
"readByte",
"while(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {throw new NumberFormatException();}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {throw new NumberFormatException();}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}\n\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\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {throw new NumberFormatException();}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{throw new NumberFormatException();}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}",
"true",
"{\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}\n\t\t\tb = readByte();\n\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}\n\t\t\telse{throw new NumberFormatException();}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{return minus ? -n : n;}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{throw new NumberFormatException();}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"nextInt",
"{\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"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 void close() {\n\t\ttry {in.close();}\n\t\tcatch (IOException e) {}\n\t}",
"close",
"{\n\t\ttry {in.close();}\n\t\tcatch (IOException e) {}\n\t}",
"try {in.close();}\n\t\tcatch (IOException e) {}",
"catch (IOException e) {}",
"IOException e",
"{}",
"{in.close();}",
"in.close()",
"in.close",
"in",
"Closeable",
"public class Main {\n\tstatic FastScanner sc = new FastScanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}\n}",
"public class Main {\n\tstatic FastScanner sc = new FastScanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {ar[i] = sc.nextInt();}\n\t\tArrays.sort(ar);\n\t\tint m = sc.nextInt();\n\t\tint total = 0;\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}\n\t\t}\n\t\tout.println(total);\n\t}\n}",
"Main"
] | import java.io.*;
import java.util.*;
import static java.lang.System.*;
public class Main {
static FastScanner sc = new FastScanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
int[] ar = new int[n];
for (int i=0; i<n; i++) {ar[i] = sc.nextInt();}
Arrays.sort(ar);
int m = sc.nextInt();
int total = 0;
for (int i=0; i<m; i++) {
if (Arrays.binarySearch(ar,sc.nextInt()) >= 0) {total++;}
}
out.println(total);
}
}
class FastScanner implements Closeable {
private final InputStream in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public FastScanner(InputStream in) {this.in = in;}
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());}
public void close() {
try {in.close();}
catch (IOException e) {}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
2,
0,
13,
4,
18,
13,
17,
40,
4,
18,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
13,
41,
13,
20,
13,
41,
13,
20,
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,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
17,
40,
13,
4,
18,
13,
13,
4,
18,
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
],
[
10,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
26,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
24,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
37,
47
],
[
47,
48
],
[
47,
49
],
[
37,
51
],
[
51,
52
],
[
51,
53
],
[
37,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
74,
75
],
[
37,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
37,
84
],
[
84,
85
],
[
84,
86
],
[
37,
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
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
106,
107
],
[
99,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
110,
114
],
[
109,
115
],
[
108,
116
],
[
116,
117
],
[
37,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
37,
122
],
[
122,
123
],
[
123,
124
],
[
15,
125
],
[
125,
126
]
] | [
"import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n \nclass Main{\n \nstatic final PrintWriter out=new PrintWriter(System.out);\n \npublic static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}\n}\n \n/**\nprivate static int binarySearch(int[] a,int b){\nint lb=0;\nint ub=a.length;\nwhile(ub>lb){\nint mid=(lb+ub)/2;\nif(a[mid]==b) return mid;\nelse if(a[mid]>b) ub=mid;\nelse lb=mid+1;\n}\nreturn -1;\n}\n*/\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"class Main{\n \nstatic final PrintWriter out=new PrintWriter(System.out);\n \npublic static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}\n}\n \n/**\nprivate static int binarySearch(int[] a,int b){\nint lb=0;\nint ub=a.length;\nwhile(ub>lb){\nint mid=(lb+ub)/2;\nif(a[mid]==b) return mid;\nelse if(a[mid]>b) ub=mid;\nelse lb=mid+1;\n}\nreturn -1;\n}\n*/\n}",
"Main",
"static final PrintWriter out=new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"public static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}\n}",
"main",
"{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}\n}",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String line=\"\";",
"line",
"\"\"",
"while((line=br.readLine())!=null&&!line.isEmpty()){\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}",
"(line=br.readLine())!=null&&!line.isEmpty()",
"(line=br.readLine())!=null",
"(line=br.readLine())",
"line",
"br.readLine()",
"br.readLine",
"br",
"null",
"!line.isEmpty()",
"line.isEmpty()",
"line.isEmpty",
"line",
"{\nint ans=0;\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st1=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());\nint m=Integer.parseInt(br.readLine());\nStringTokenizer st2=new StringTokenizer(br.readLine());\n/**\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(binarySearch(a,b)>=0) ans++;\n}\n*/\nfor(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}\nout.println(ans);\nout.flush();\n}",
"int ans=0;",
"ans",
"0",
"int n=Integer.parseInt(line);",
"n",
"Integer.parseInt(line)",
"Integer.parseInt",
"Integer",
"line",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"StringTokenizer st1=new StringTokenizer(br.readLine());",
"st1",
"new StringTokenizer(br.readLine())",
"for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=Integer.parseInt(st1.nextToken());",
"a[i]=Integer.parseInt(st1.nextToken())",
"a[i]",
"a",
"i",
"Integer.parseInt(st1.nextToken())",
"Integer.parseInt",
"Integer",
"st1.nextToken()",
"st1.nextToken",
"st1",
"int m=Integer.parseInt(br.readLine());",
"m",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"StringTokenizer st2=new StringTokenizer(br.readLine());",
"st2",
"new StringTokenizer(br.readLine())",
"for(int i=0;i<m;i++){\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<m",
"i",
"m",
"i++",
"i++",
"i",
"{\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}",
"{\nint b=Integer.parseInt(st2.nextToken());\nif(Arrays.binarySearch(a,b)>=0) ans++;\n}",
"int b=Integer.parseInt(st2.nextToken());",
"b",
"Integer.parseInt(st2.nextToken())",
"Integer.parseInt",
"Integer",
"st2.nextToken()",
"st2.nextToken",
"st2",
"if(Arrays.binarySearch(a,b)>=0) ans++;",
"Arrays.binarySearch(a,b)>=0",
"Arrays.binarySearch(a,b)",
"Arrays.binarySearch",
"Arrays",
"a",
"b",
"0",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args"
] | import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int ans=0;
int n=Integer.parseInt(line);
int[] a=new int[n];
StringTokenizer st1=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());
int m=Integer.parseInt(br.readLine());
StringTokenizer st2=new StringTokenizer(br.readLine());
/**
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(binarySearch(a,b)>=0) ans++;
}
*/
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
}
out.println(ans);
out.flush();
}
}
/**
private static int binarySearch(int[] a,int b){
int lb=0;
int ub=a.length;
while(ub>lb){
int mid=(lb+ub)/2;
if(a[mid]==b) return mid;
else if(a[mid]>b) ub=mid;
else lb=mid+1;
}
return -1;
}
*/
} |
[
7,
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,
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,
30,
14,
4,
18,
13,
4,
18,
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,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
36,
37
],
[
37,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
60,
67
],
[
67,
68
],
[
8,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
6,
75
],
[
75,
76
]
] | [
"import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n HashSet<Integer> S = new HashSet<>();\n for(int i = 0;i < n;i++){\n S.add(sc.nextInt());\n }\n \n int q = sc.nextInt();\n int count = 0;\n for(int i = 0;i < q;i++){\n if(S.contains(sc.nextInt())) count++;\n }\n\n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n HashSet<Integer> S = new HashSet<>();\n for(int i = 0;i < n;i++){\n S.add(sc.nextInt());\n }\n \n int q = sc.nextInt();\n int count = 0;\n for(int i = 0;i < q;i++){\n if(S.contains(sc.nextInt())) count++;\n }\n\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n HashSet<Integer> S = new HashSet<>();\n for(int i = 0;i < n;i++){\n S.add(sc.nextInt());\n }\n \n int q = sc.nextInt();\n int count = 0;\n for(int i = 0;i < q;i++){\n if(S.contains(sc.nextInt())) count++;\n }\n\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n HashSet<Integer> S = new HashSet<>();\n for(int i = 0;i < n;i++){\n S.add(sc.nextInt());\n }\n \n int q = sc.nextInt();\n int count = 0;\n for(int i = 0;i < q;i++){\n if(S.contains(sc.nextInt())) count++;\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",
"HashSet<Integer> S = new HashSet<>();",
"S",
"new HashSet<>()",
"for(int i = 0;i < n;i++){\n S.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S.add(sc.nextInt());\n }",
"{\n S.add(sc.nextInt());\n }",
"S.add(sc.nextInt())",
"S.add",
"S",
"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 if(S.contains(sc.nextInt())) count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n if(S.contains(sc.nextInt())) count++;\n }",
"{\n if(S.contains(sc.nextInt())) count++;\n }",
"if(S.contains(sc.nextInt())) count++;",
"S.contains(sc.nextInt())",
"S.contains",
"S",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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 void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
HashSet<Integer> S = new HashSet<>();
for(int i = 0;i < n;i++){
S.add(sc.nextInt());
}
int q = sc.nextInt();
int count = 0;
for(int i = 0;i < q;i++){
if(S.contains(sc.nextInt())) count++;
}
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,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
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,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
126,
8
],
[
126,
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,
52
],
[
52,
53
],
[
52,
54
],
[
11,
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
],
[
73,
75
],
[
67,
76
],
[
76,
77
],
[
76,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
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
],
[
97,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
101,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
11,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
9,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
] | [
"import java.util.*;\nimport java.util.Arrays;\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 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\n \n \n System.out.println(ans);\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.util.Arrays;",
"Arrays",
"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 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\n \n \n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\n \n \n System.out.println(ans);\n }",
"main",
"{\n 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\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",
"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 = 0;",
"t",
"0",
"int ans = 0;",
"ans",
"0",
"for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }",
"{\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }",
"t = sc.nextLong()",
"t",
"sc.nextLong()",
"sc.nextLong",
"sc",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[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(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }",
"s[mid] == t",
"s[mid]",
"s",
"mid",
"t",
"{\n ans ++;\n break;\n }",
"ans ++",
"ans",
"break;",
"if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }",
"t < s[mid]",
"t",
"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",
"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) throws Exception {\n 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\n \n \n System.out.println(ans);\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 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 = 0;\n \n int ans = 0;\n for(int i = 0; i < q; i++){\n t = sc.nextLong();\n int left = 0;\n int right = n;\n while(left < right){\n int mid = (left + right)/2;\n if(s[mid] == t){\n ans ++;\n break;\n }else if(t < s[mid]){\n right = mid;\n }else{\n left = mid + 1;\n }\n }\n }\n \n \n System.out.println(ans);\n }\n}",
"Main"
] | import java.util.*;
import java.util.Arrays;
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();
long t = 0;
int ans = 0;
for(int i = 0; i < q; i++){
t = sc.nextLong();
int left = 0;
int right = n;
while(left < right){
int mid = (left + right)/2;
if(s[mid] == t){
ans ++;
break;
}else if(t < s[mid]){
right = mid;
}else{
left = mid + 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,
41,
13,
41,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
18,
13,
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,
14,
2,
18,
13,
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
],
[
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
],
[
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
],
[
8,
72
],
[
72,
73
],
[
8,
74
],
[
74,
75
],
[
8,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
8,
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
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
93,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
93,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
129,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
141,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
6,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\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",
"int low",
"low",
"mid",
"mid",
"high",
"high",
"key",
"key",
"cnt = 0;",
"cnt",
"0",
"for(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 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\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"low = 0",
"low",
"0",
"high = n - 1",
"high",
"n - 1",
"n",
"1",
"key = T[i]",
"key",
"T[i]",
"T",
"i",
"while(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}",
"low <= high",
"low",
"high",
"{\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}",
"mid = (low + high) / 2",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"if(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}",
"S[mid] == key",
"S[mid]",
"S",
"mid",
"key",
"{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"cnt++",
"cnt",
"break;",
"if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}",
"S[mid] < key",
"S[mid]",
"S",
"mid",
"key",
"{\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t}",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}",
"S[mid] > key",
"S[mid]",
"S",
"mid",
"key",
"{\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}",
"high = mid - 1",
"high",
"mid - 1",
"mid",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\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\tint low,mid,high,key,cnt = 0;\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tlow = 0;\n\t\t\thigh = n - 1;\n\t\t\tkey = T[i];\n\t\t\twhile(low <= high){\n\t\t\t\tmid = (low + high) / 2;\n\t\t\t\tif(S[mid] == key){\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if(S[mid] < key){\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\t} else if(S[mid] > key) {\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\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[] T = new int[q];
for(int i = 0; i < q; i++){
T[i] = sc.nextInt();
}
int low,mid,high,key,cnt = 0;
for(int i = 0;i < q;i++){
low = 0;
high = n - 1;
key = T[i];
while(low <= high){
mid = (low + high) / 2;
if(S[mid] == key){
cnt++;
break;
} else if(S[mid] < key){
low = mid + 1;
} else if(S[mid] > key) {
high = mid - 1;
}
}
}
System.out.println(cnt);
}
} |
[
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,
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,
2,
4,
13,
13,
18,
13,
13,
40,
17,
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,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
30,
29,
13,
14,
2,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
2,
13,
17,
29,
40,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
152,
5
],
[
152,
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
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
33,
34
],
[
34,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
38,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
62,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
60,
70
],
[
70,
71
],
[
8,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
6,
78
],
[
78,
79
],
[
152,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
82,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
105,
117
],
[
117,
118
],
[
118,
119
],
[
105,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
125,
127
],
[
121,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
120,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
82,
144
],
[
144,
145
],
[
145,
146
],
[
80,
147
],
[
147,
148
],
[
80,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\tpublic static int binarysarch(String[] S, String x) {\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\tpublic static int binarysarch(String[] S, String x) {\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));",
"br",
"new BufferedReader(\n\t\t\tnew InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String S[] = br.readLine().split(\" \");",
"S",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String T[] = br.readLine().split(\" \");",
"T",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}",
"{\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}",
"if (binarysarch(S, T[i]) != -1) count++;",
"binarysarch(S, T[i]) != -1",
"binarysarch(S, T[i])",
"binarysarch",
"S",
"T[i]",
"T",
"i",
"-1",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int binarysarch(String[] S, String x) {\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"binarysarch",
"{\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"int lx = 0",
"lx",
"0",
"rx = S.length - 1;",
"rx",
"S.length - 1",
"S.length",
"S",
"S.length",
"1",
"while (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}",
"lx <= rx",
"lx",
"rx",
"{\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}",
"int c = (lx + rx) / 2;",
"c",
"(lx + rx) / 2",
"(lx + rx)",
"lx",
"rx",
"2",
"if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}",
"Integer.parseInt(S[c]) == Integer.parseInt(x)",
"Integer.parseInt(S[c])",
"Integer.parseInt",
"Integer",
"S[c]",
"S",
"c",
"Integer.parseInt(x)",
"Integer.parseInt",
"Integer",
"x",
"{\n\t\t\t\treturn c;\n\t\t\t}",
"return c;",
"c",
"if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}",
"Integer.parseInt(S[c]) < Integer.parseInt(x)",
"Integer.parseInt(S[c])",
"Integer.parseInt",
"Integer",
"S[c]",
"S",
"c",
"Integer.parseInt(x)",
"Integer.parseInt",
"Integer",
"x",
"{\n\t\t\t\tlx = c + 1;\n\t\t\t}",
"lx = c + 1",
"lx",
"c + 1",
"c",
"1",
"{\n\t\t\t\trx = c - 1;\n\t\t\t}",
"rx = c - 1",
"rx",
"c - 1",
"c",
"1",
"return -1;",
"-1",
"1",
"String[] S",
"S",
"String x",
"x",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\tpublic static int binarysarch(String[] S, String x) {\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString S[] = br.readLine().split(\" \");\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString T[] = br.readLine().split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tif (binarysarch(S, T[i]) != -1) count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\tpublic static int binarysarch(String[] S, String x) {\n\t\tint lx = 0, rx = S.length - 1;\n\t\twhile (lx <= rx) {\n\t\t\tint c = (lx + rx) / 2;\n\t\t\tif (Integer.parseInt(S[c]) == Integer.parseInt(x)) {\n\t\t\t\treturn c;\n\t\t\t} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {\n\t\t\t\tlx = c + 1;\n\t\t\t} else {\n\t\t\t\trx = c - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main"
] |
import java.io.*;
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 S[] = br.readLine().split(" ");
int q = Integer.parseInt(br.readLine());
String T[] = br.readLine().split(" ");
int count = 0;
for (int i = 0; i < q; i++) {
if (binarysarch(S, T[i]) != -1) count++;
}
System.out.println(count);
}
public static int binarysarch(String[] S, String x) {
int lx = 0, rx = S.length - 1;
while (lx <= rx) {
int c = (lx + rx) / 2;
if (Integer.parseInt(S[c]) == Integer.parseInt(x)) {
return c;
} else if (Integer.parseInt(S[c]) < Integer.parseInt(x)) {
lx = c + 1;
} else {
rx = c - 1;
}
}
return -1;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
14,
2,
4,
13,
13,
13,
40,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
29,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
191,
11
],
[
191,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
15,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
32,
33
],
[
22,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
36,
41
],
[
22,
42
],
[
42,
43
],
[
42,
44
],
[
22,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
66,
68
],
[
22,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
75,
76
],
[
22,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
79,
84
],
[
22,
85
],
[
85,
86
],
[
85,
87
],
[
22,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
88,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
100,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
111,
114
],
[
110,
115
],
[
115,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
22,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
12,
126
],
[
126,
127
],
[
191,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
130,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
130,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
150,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
158,
164
],
[
164,
165
],
[
165,
166
],
[
158,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
170,
172
],
[
167,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
167,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
130,
183
],
[
183,
184
],
[
184,
185
],
[
128,
186
],
[
186,
187
],
[
128,
188
],
[
188,
189
],
[
0,
190
],
[
190,
191
],
[
190,
192
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\tstatic int binarySearch(int[] s, int key) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}\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\tpublic static void main(String[] args) {\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\tstatic int binarySearch(int[] s, int key) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"main",
"{\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"IOException e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"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[] tmp = br.readLine().split(\" \");",
"tmp",
"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\t\ts[i] = Integer.parseInt(tmp[i]);\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] = Integer.parseInt(tmp[i]);\n\t\t\t}",
"{\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}",
"s[i] = Integer.parseInt(tmp[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(tmp[i])",
"Integer.parseInt",
"Integer",
"tmp[i]",
"tmp",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"tmp = br.readLine().split(\" \")",
"tmp",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int key = Integer.parseInt(tmp[i]);",
"key",
"Integer.parseInt(tmp[i])",
"Integer.parseInt",
"Integer",
"tmp[i]",
"tmp",
"i",
"if (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"binarySearch(s, key) != -1",
"binarySearch(s, key)",
"binarySearch",
"s",
"key",
"-1",
"1",
"{\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"static int binarySearch(int[] s, int key) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}",
"int left = 0;",
"left",
"0",
"int right = s.length;",
"right",
"s.length",
"s",
"s.length",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"while (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (s[mid] == key) {\n\t\t\t\treturn mid;\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 mid;\n\t\t\t}",
"return mid;",
"mid",
"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 -1;",
"-1",
"1",
"int[] s",
"s",
"int key",
"key",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\tstatic int binarySearch(int[] s, int key) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\ttry (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] tmp = br.readLine().split(\" \");\n\t\t\tint[] s = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ts[i] = Integer.parseInt(tmp[i]);\n\t\t\t}\n\t\t\tint q = Integer.parseInt(br.readLine());\n\t\t\ttmp = br.readLine().split(\" \");\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint key = Integer.parseInt(tmp[i]);\n\t\t\t\tif (binarySearch(s, key) != -1) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(cnt);\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\tstatic int binarySearch(int[] s, int key) {\n\t\tint left = 0;\n\t\tint right = s.length;\n\t\tint mid = (left + right) / 2;\n\n\t\twhile (left < right) {\n\t\t\tmid = (left + right) / 2;\n\t\t\tif (s[mid] == key) {\n\t\t\t\treturn mid;\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 -1;\n\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
int n = Integer.parseInt(br.readLine());
String[] tmp = br.readLine().split(" ");
int[] s = new int[n];
for (int i = 0; i < n; i++) {
s[i] = Integer.parseInt(tmp[i]);
}
int q = Integer.parseInt(br.readLine());
tmp = br.readLine().split(" ");
int cnt = 0;
for (int i = 0; i < q; i++) {
int key = Integer.parseInt(tmp[i]);
if (binarySearch(s, key) != -1) {
cnt++;
}
}
System.out.println(cnt);
} catch (IOException e) {
e.printStackTrace();
}
}
static int binarySearch(int[] s, int key) {
int left = 0;
int right = s.length;
int mid = (left + right) / 2;
while (left < right) {
mid = (left + right) / 2;
if (s[mid] == key) {
return mid;
} else if (key < s[mid]) {
right = mid;
} else {
left = mid + 1;
}
}
return -1;
}
}
|
[
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,
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,
41,
13,
17,
28,
13,
13,
30,
14,
2,
4,
18,
13,
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
],
[
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
],
[
112,
23
],
[
112,
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
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
26,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
26,
63
],
[
63,
64
],
[
63,
65
],
[
26,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
26,
86
],
[
86,
87
],
[
86,
88
],
[
26,
89
],
[
89,
90
],
[
89,
91
],
[
89,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
95,
99
],
[
94,
100
],
[
93,
101
],
[
101,
102
],
[
26,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
24,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.util.Scanner;\nimport java.util.List;\nimport java.util.ArrayList;\n \npublic class Main {\n public static void main(String[] args) throws IOException {\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\n \n System.out.println(cnt);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n public static void main(String[] args) throws IOException {\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\n \n System.out.println(cnt);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\n \n System.out.println(cnt);\n }",
"main",
"{\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\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[] 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 cnt = 0;",
"cnt",
"0",
"for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;",
"int p",
"t",
"if(Arrays.binarySearch(s, p) >= 0) ++cnt;",
"if(Arrays.binarySearch(s, p) >= 0) ++cnt;",
"Arrays.binarySearch(s, p) >= 0",
"Arrays.binarySearch(s, p)",
"Arrays.binarySearch",
"Arrays",
"s",
"p",
"0",
"++cnt",
"cnt",
"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) throws IOException {\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\n \n System.out.println(cnt);\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n \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) s[i] = sc.nextInt();\n \n int q = sc.nextInt();\n int[] t = new int[q];\n for(int i = 0; i < q; ++i) t[i] = sc.nextInt();\n \n int cnt = 0;\n for(int p : t)\n if(Arrays.binarySearch(s, p) >= 0) ++cnt;\n \n System.out.println(cnt);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.IOException;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) throws IOException {
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 cnt = 0;
for(int p : t)
if(Arrays.binarySearch(s, p) >= 0) ++cnt;
System.out.println(cnt);
}
}
|
[
7,
15,
13,
17,
6,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
13,
4,
13,
13,
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,
0,
18,
13,
13,
13,
42,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
126,
5
],
[
126,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
23,
24
],
[
23,
25
],
[
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
],
[
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
],
[
71,
72
],
[
71,
73
],
[
71,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
6,
84
],
[
84,
85
],
[
126,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
88,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
88,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
104,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
88,
119
],
[
119,
120
],
[
86,
121
],
[
121,
122
],
[
86,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static int LinearSearch ( int[] data, int s) {\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\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 scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static int LinearSearch ( int[] data, int s) {\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\n\t\t\n\t\treturn 1;\n\t}\n}",
"Main",
"public static void main (String[] args) {\n\t\tScanner scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}",
"Scanner scan = new Scanner (System.in);",
"scan",
"new Scanner (System.in)",
"int count = 0;",
"count",
"0",
"final int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] dataS = new int[n + 1];",
"dataS",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}",
"dataS[i] = scan.nextInt()",
"dataS[i]",
"dataS",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"final int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}",
"{\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}",
"final int search = scan.nextInt();",
"search",
"scan.nextInt()",
"scan.nextInt",
"scan",
"count += LinearSearch (dataS, search)",
"count",
"LinearSearch (dataS, search)",
"LinearSearch",
"dataS",
"search",
"scan.close()",
"scan.close",
"scan",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int LinearSearch ( int[] data, int s) {\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\n\t\t\n\t\treturn 1;\n\t}",
"LinearSearch",
"{\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\n\t\t\n\t\treturn 1;\n\t}",
"int i = 0;",
"i",
"0",
"int n = data.length - 1;",
"n",
"data.length - 1",
"data.length",
"data",
"data.length",
"1",
"data[n] = s",
"data[n]",
"data",
"n",
"s",
"while (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}",
"data[i] != s",
"data[i]",
"data",
"i",
"s",
"{\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}",
"i++",
"i",
"if (i == n) return 0;",
"i == n",
"i",
"n",
"return 0;",
"0",
"return 1;",
"1",
"int[] data",
"data",
"int s",
"s",
"public class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static int LinearSearch ( int[] data, int s) {\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\n\t\t\n\t\treturn 1;\n\t}\n}",
"public class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner scan = new Scanner (System.in);\n\t\tint count = 0;\n\t\tfinal int n = scan.nextInt();\n\t\tint[] dataS = new int[n + 1];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdataS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tfinal int q = scan.nextInt();\n\t\t\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tfinal int search = scan.nextInt();\n\t\t\tcount += LinearSearch (dataS, search);\n\t\t}\n\t\tscan.close();\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static int LinearSearch ( int[] data, int s) {\n\t\t\n\t\tint i = 0;\n\t\tint n = data.length - 1;\n\t\tdata[n] = s;\n\t\t\n\t\twhile (data[i] != s) {\n\t\t\t\n\t\t\ti++;\n\t\t\tif (i == n) return 0;\n\t\t}\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 scan = new Scanner (System.in);
int count = 0;
final int n = scan.nextInt();
int[] dataS = new int[n + 1];
for (int i = 0; i < n; i++) {
dataS[i] = scan.nextInt();
}
final int q = scan.nextInt();
for (int i = 0; i < q; i++) {
final int search = scan.nextInt();
count += LinearSearch (dataS, search);
}
scan.close();
System.out.println(count);
}
public static int LinearSearch ( int[] data, int s) {
int i = 0;
int n = data.length - 1;
data[n] = s;
while (data[i] != s) {
i++;
if (i == n) return 0;
}
return 1;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
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,
28,
13,
13,
30,
30,
4,
18,
13,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
18,
13,
13,
30,
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
],
[
113,
5
],
[
113,
6
],
[
6,
7
],
[
6,
8
],
[
113,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
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
],
[
11,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
11,
46
],
[
46,
47
],
[
46,
48
],
[
11,
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
],
[
11,
70
],
[
70,
71
],
[
70,
72
],
[
11,
73
],
[
73,
74
],
[
73,
75
],
[
73,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
11,
82
],
[
82,
83
],
[
82,
84
],
[
11,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
90,
95
],
[
95,
96
],
[
96,
97
],
[
11,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
113,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
104,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
] | [
"import java.util.*;\n\npublic class Main {\n\n Scanner sc = new Scanner(System.in);\n\n void solve() {\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n Scanner sc = new Scanner(System.in);\n\n void solve() {\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"void solve() {\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }",
"solve",
"{\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }",
"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",
"Set<Integer> set = new HashSet<>();",
"set",
"new HashSet<>()",
"for (int s : S) {\n set.add(s);\n }",
"int s",
"S",
"{\n set.add(s);\n }",
"{\n set.add(s);\n }",
"set.add(s)",
"set.add",
"set",
"s",
"int cnt = 0;",
"cnt",
"0",
"for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }",
"int t",
"T",
"{\n if (set.contains(t)) {\n cnt++;\n }\n }",
"{\n if (set.contains(t)) {\n cnt++;\n }\n }",
"if (set.contains(t)) {\n cnt++;\n }",
"set.contains(t)",
"set.contains",
"set",
"t",
"{\n cnt++;\n }",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"public static void main(String[] args) {\n new Main().solve();\n }",
"main",
"{\n new Main().solve();\n }",
"new Main().solve()",
"new Main().solve",
"new Main()",
"String[] args",
"args",
"public class Main {\n\n Scanner sc = new Scanner(System.in);\n\n void solve() {\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}",
"public class Main {\n\n Scanner sc = new Scanner(System.in);\n\n void solve() {\n // Input\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 // Solve\n Set<Integer> set = new HashSet<>();\n for (int s : S) {\n set.add(s);\n }\n int cnt = 0;\n for (int t : T) {\n if (set.contains(t)) {\n cnt++;\n }\n }\n // Output\n System.out.println(cnt);\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}",
"Main"
] | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
void solve() {
// Input
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();
}
// Solve
Set<Integer> set = new HashSet<>();
for (int s : S) {
set.add(s);
}
int cnt = 0;
for (int t : T) {
if (set.contains(t)) {
cnt++;
}
}
// Output
System.out.println(cnt);
}
public static void main(String[] args) {
new Main().solve();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
4,
18,
13,
17,
17,
41,
13,
17,
0,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
2,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
85,
5
],
[
85,
6
],
[
6,
7
],
[
6,
8
],
[
85,
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
],
[
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
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
37,
41
],
[
34,
42
],
[
12,
43
],
[
43,
44
],
[
43,
45
],
[
12,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
52,
53
],
[
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
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
71,
75
],
[
12,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
10,
82
],
[
82,
83
],
[
0,
84
],
[
84,
85
],
[
84,
86
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"static int[] boo = new int[100000];",
"boo",
"new int[100000]",
"100000",
"public static void main(String[] args)throws Exception{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = (sc.nextInt());",
"n",
"(sc.nextInt())",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"{\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"boo[sc.nextInt()%100000] = 1",
"boo[sc.nextInt()%100000]",
"boo",
"sc.nextInt()%100000",
"sc.nextInt()",
"sc.nextInt",
"sc",
"100000",
"1",
"int ans = 0;",
"ans",
"0",
"n = Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"for (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"{\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"ans += boo[sc.nextInt()%100000]",
"ans",
"boo[sc.nextInt()%100000]",
"boo",
"sc.nextInt()%100000",
"sc.nextInt()",
"sc.nextInt",
"sc",
"100000",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = Integer.parseInt(sc.next());\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int[] boo = new int[100000];
public static void main(String[] args)throws Exception{
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner sc = new Scanner(System.in);
int n = (sc.nextInt());
//String[] st = br.readLine().split(" ");
//boolean[] boo = new boolean[100000];
for (int i = 0; i < n; i++) {
//boo[Integer.parseInt(st[i])%100000] = 1;
boo[sc.nextInt()%100000] = 1;
}
int ans = 0;
//n = Integer.parseInt(br.readLine());
n = Integer.parseInt(sc.next());
//st = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
// ans += boo[Integer.parseInt(st[i])%100000] ;
ans += boo[sc.nextInt()%100000] ;
}
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,
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,
13,
18,
13,
13,
17,
2,
13,
17,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
18,
13,
2,
2,
13,
13,
17,
30,
29,
17,
14,
2,
13,
13,
30,
29,
17,
30,
14,
2,
13,
18,
13,
2,
2,
13,
13,
17,
30,
29,
4,
13,
13,
13,
13,
2,
2,
13,
13,
17,
30,
29,
4,
13,
13,
13,
2,
2,
2,
13,
13,
17,
17,
13,
23,
13,
23,
13,
23,
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
],
[
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
],
[
50,
52
],
[
8,
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
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
74,
81
],
[
81,
82
],
[
81,
83
],
[
73,
84
],
[
84,
85
],
[
85,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
6,
93
],
[
93,
94
],
[
164,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
98,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
111,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
131,
134
],
[
131,
135
],
[
131,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
119,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
143,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
147,
153
],
[
143,
154
],
[
95,
155
],
[
155,
156
],
[
95,
157
],
[
157,
158
],
[
95,
159
],
[
159,
160
],
[
95,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static boolean binarySearch(int[] sArray, int tElement, int start,\n\t\t\tint end) {\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static boolean binarySearch(int[] sArray, int tElement, int start,\n\t\t\tint end) {\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] sArray = new int[n];",
"sArray",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}",
"sArray[i] = scanner.nextInt()",
"sArray[i]",
"sArray",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int p = scanner.nextInt();",
"p",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] tArray = new int[p];",
"tArray",
"new int[p]",
"p",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < p",
"i",
"p",
"i++",
"i++",
"i",
"{\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"tArray[i] = scanner.nextInt()",
"tArray[i]",
"tArray",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}",
"binarySearch(sArray, tArray[i], 0, n-1)",
"binarySearch",
"sArray",
"tArray[i]",
"tArray",
"i",
"0",
"n-1",
"n",
"1",
"{\n\t\t\t\tcnt++;\n\t\t\t}",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public static boolean binarySearch(int[] sArray, int tElement, int start,\n\t\t\tint end) {\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}",
"binarySearch",
"{\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}",
"if (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}",
"tElement == sArray[(start + end) / 2]",
"tElement",
"sArray[(start + end) / 2]",
"sArray",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}",
"start == end",
"start",
"end",
"{\n\t\t\treturn false;\n\t\t}",
"return false;",
"false",
"{\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}",
"if (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}",
"tElement < sArray[(start + end) / 2]",
"tElement",
"sArray[(start + end) / 2]",
"sArray",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"{\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t}",
"return binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);",
"binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2)",
"binarySearch",
"sArray",
"tElement",
"start",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"{\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}",
"return binarySearch(sArray, tElement, (start + end) / 2+1, end);",
"binarySearch(sArray, tElement, (start + end) / 2+1, end)",
"binarySearch",
"sArray",
"tElement",
"(start + end) / 2+1",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"1",
"end",
"int[] sArray",
"sArray",
"int tElement",
"tElement",
"int start",
"start",
"int end",
"end",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static boolean binarySearch(int[] sArray, int tElement, int start,\n\t\t\tint end) {\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] sArray = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsArray[i] = scanner.nextInt();\n\t\t}\n\t\tint p = scanner.nextInt();\n\t\tint[] tArray = new int[p];\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < p; i++) {\n\t\t\ttArray[i] = scanner.nextInt();\n\t\t\tif(binarySearch(sArray, tArray[i], 0, n-1)){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tpublic static boolean binarySearch(int[] sArray, int tElement, int start,\n\t\t\tint end) {\n\n\t\tif (tElement == sArray[(start + end) / 2]) {\n\t\t\treturn true;\n\t\t} else if (start == end) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tif (tElement < sArray[(start + end) / 2]) {\n\t\t\t\treturn binarySearch(sArray, tElement, start,\n\t\t\t\t\t\t(start + end) / 2);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(sArray, tElement, (start + end) / 2+1, end);\n\t\t\t}\n\t\t}\n\t}\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[] sArray = new int[n];
for (int i = 0; i < n; i++) {
sArray[i] = scanner.nextInt();
}
int p = scanner.nextInt();
int[] tArray = new int[p];
int cnt = 0;
for (int i = 0; i < p; i++) {
tArray[i] = scanner.nextInt();
if(binarySearch(sArray, tArray[i], 0, n-1)){
cnt++;
}
}
System.out.println(cnt);
}
public static boolean binarySearch(int[] sArray, int tElement, int start,
int end) {
if (tElement == sArray[(start + end) / 2]) {
return true;
} else if (start == end) {
return false;
} else {
if (tElement < sArray[(start + end) / 2]) {
return binarySearch(sArray, tElement, start,
(start + end) / 2);
} else {
return binarySearch(sArray, tElement, (start + end) / 2+1, end);
}
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
13,
0,
13,
4,
18,
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,
0,
13,
2,
13,
17,
0,
13,
13,
4,
18,
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
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
13,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
8,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
8,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
73,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
107,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
107,
118
],
[
118,
119
],
[
118,
120
],
[
8,
121
],
[
121,
122
],
[
122,
123
],
[
8,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
6,
130
],
[
130,
131
]
] | [
"import java.util.*;\n\nclass Main\n{\n public static void main(String args[])\n {\n\tint n, q, C=0;\n\tlong S[] = new long[100000];\n\tlong k;\n\tint left, right, mid=0;\n\tScanner read = new Scanner(System.in);\n\n\t//read\n\tn=read.nextInt();\n\tfor(int i=0; i<n; i++)S[i]=read.nextInt();\n\n\t//search\n\tq=read.nextInt();\n\tfor(int i=0; i<q; i++)\n\t {\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }\n\n\t//print\n\tread.close();\n\tSystem.out.println(C);\n\n\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main\n{\n public static void main(String args[])\n {\n\tint n, q, C=0;\n\tlong S[] = new long[100000];\n\tlong k;\n\tint left, right, mid=0;\n\tScanner read = new Scanner(System.in);\n\n\t//read\n\tn=read.nextInt();\n\tfor(int i=0; i<n; i++)S[i]=read.nextInt();\n\n\t//search\n\tq=read.nextInt();\n\tfor(int i=0; i<q; i++)\n\t {\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }\n\n\t//print\n\tread.close();\n\tSystem.out.println(C);\n\n\n }\n}",
"Main",
"public static void main(String args[])\n {\n\tint n, q, C=0;\n\tlong S[] = new long[100000];\n\tlong k;\n\tint left, right, mid=0;\n\tScanner read = new Scanner(System.in);\n\n\t//read\n\tn=read.nextInt();\n\tfor(int i=0; i<n; i++)S[i]=read.nextInt();\n\n\t//search\n\tq=read.nextInt();\n\tfor(int i=0; i<q; i++)\n\t {\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }\n\n\t//print\n\tread.close();\n\tSystem.out.println(C);\n\n\n }",
"main",
"{\n\tint n, q, C=0;\n\tlong S[] = new long[100000];\n\tlong k;\n\tint left, right, mid=0;\n\tScanner read = new Scanner(System.in);\n\n\t//read\n\tn=read.nextInt();\n\tfor(int i=0; i<n; i++)S[i]=read.nextInt();\n\n\t//search\n\tq=read.nextInt();\n\tfor(int i=0; i<q; i++)\n\t {\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }\n\n\t//print\n\tread.close();\n\tSystem.out.println(C);\n\n\n }",
"int n",
"n",
"q",
"q",
"C=0;",
"C",
"0",
"long S[] = new long[100000];",
"S",
"new long[100000]",
"100000",
"long k;",
"k",
"int left",
"left",
"right",
"right",
"mid=0;",
"mid",
"0",
"Scanner read = new Scanner(System.in);",
"read",
"new Scanner(System.in)",
"n=read.nextInt()",
"n",
"read.nextInt()",
"read.nextInt",
"read",
"for(int i=0; i<n; i++)S[i]=read.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"S[i]=read.nextInt();",
"S[i]=read.nextInt()",
"S[i]",
"S",
"i",
"read.nextInt()",
"read.nextInt",
"read",
"q=read.nextInt()",
"q",
"read.nextInt()",
"read.nextInt",
"read",
"for(int i=0; i<q; i++)\n\t {\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }",
"{\n\t\tleft=0;\n\t\tright=n;\n\t\tk=read.nextInt();\n\t\twhile(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }\n\t }",
"left=0",
"left",
"0",
"right=n",
"right",
"n",
"k=read.nextInt()",
"k",
"read.nextInt()",
"read.nextInt",
"read",
"while(left<right)\n\t\t {\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }",
"left<right",
"left",
"right",
"{\n\t\t\tmid=(left+right)/2;\n\t\t\tif(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;\n\t\t }",
"mid=(left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(S[mid]==k)\n\t\t\t {\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\telse if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;",
"S[mid]==k",
"S[mid]",
"S",
"mid",
"k",
"{\n\t\t\t\tC++;\n\t\t\t\tbreak;\n\t\t\t }",
"C++",
"C",
"break;",
"if(S[mid]<k)left=mid+1;\n\t\t\telse right=mid;",
"S[mid]<k",
"S[mid]",
"S",
"mid",
"k",
"left=mid+1",
"left",
"mid+1",
"mid",
"1",
"right=mid",
"right",
"mid",
"read.close()",
"read.close",
"read",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String args[]",
"args"
] | import java.util.*;
class Main
{
public static void main(String args[])
{
int n, q, C=0;
long S[] = new long[100000];
long k;
int left, right, mid=0;
Scanner read = new Scanner(System.in);
//read
n=read.nextInt();
for(int i=0; i<n; i++)S[i]=read.nextInt();
//search
q=read.nextInt();
for(int i=0; i<q; i++)
{
left=0;
right=n;
k=read.nextInt();
while(left<right)
{
mid=(left+right)/2;
if(S[mid]==k)
{
C++;
break;
}
else if(S[mid]<k)left=mid+1;
else right=mid;
}
}
//print
read.close();
System.out.println(C);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
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,
41,
13,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
42,
2,
13,
13,
30,
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,
0,
13,
2,
2,
13,
13,
17,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
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
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
13,
18
],
[
9,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
29,
30
],
[
19,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
33,
38
],
[
19,
39
],
[
39,
40
],
[
39,
41
],
[
19,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
63,
65
],
[
19,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
73
],
[
19,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
76,
81
],
[
19,
82
],
[
82,
83
],
[
82,
84
],
[
19,
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
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
19,
109
],
[
109,
110
],
[
109,
111
],
[
19,
112
],
[
112,
113
],
[
19,
114
],
[
114,
115
],
[
19,
116
],
[
116,
117
],
[
19,
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
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
130,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
130,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
149,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
166,
168
],
[
161,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
169,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
161,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
185,
187
],
[
182,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
19,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
195,
200
],
[
6,
201
],
[
201,
202
]
] | [
"import java.io.*;\n\nclass Main {\n public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main {\n public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }",
"main",
"{\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }",
"try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }",
"catch( IOException e ) {\n System.err.println( e );\n }",
"IOException e",
"{\n System.err.println( e );\n }",
"System.err.println( e )",
"System.err.println",
"System.err",
"System",
"System.err",
"e",
"{\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tint low, high, middle;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n }",
"BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );",
"kb",
"new BufferedReader( new InputStreamReader( System.in ) )",
"int n = Integer.parseInt( kb.readLine( ) );",
"n",
"Integer.parseInt( kb.readLine( ) )",
"Integer.parseInt",
"Integer",
"kb.readLine( )",
"kb.readLine",
"kb",
"String[] str = kb.readLine( ).split( \" \" );",
"str",
"kb.readLine( ).split( \" \" )",
"kb.readLine( ).split",
"kb.readLine( )",
"kb.readLine",
"kb",
"\" \"",
"int[] S = new int[ n ];",
"S",
"new int[ n ]",
"n",
"for( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\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] = Integer.parseInt( str[i] );\n\t\t\t}",
"{\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}",
"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( kb.readLine( ) );",
"q",
"Integer.parseInt( kb.readLine( ) )",
"Integer.parseInt",
"Integer",
"kb.readLine( )",
"kb.readLine",
"kb",
"str = kb.readLine( ).split( \" \" )",
"str",
"kb.readLine( ).split( \" \" )",
"kb.readLine( ).split",
"kb.readLine( )",
"kb.readLine",
"kb",
"\" \"",
"int[] T = new int[ q ];",
"T",
"new int[ q ]",
"q",
"for( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\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] = Integer.parseInt( str[i] );\n\t\t\t}",
"{\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}",
"T[i] = Integer.parseInt( str[i] )",
"T[i]",
"T",
"i",
"Integer.parseInt( str[i] )",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int cnt = 0;",
"cnt",
"0",
"int low",
"low",
"high",
"high",
"middle;",
"middle",
"for( int i=0; i<q; i++ ) {\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tlow = 0;\n\t\t\t\thigh = n-1;\n\t\t\t\tmiddle = n/2;\n\t\t\t\twhile( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}",
"low = 0",
"low",
"0",
"high = n-1",
"high",
"n-1",
"n",
"1",
"middle = n/2",
"middle",
"n/2",
"n",
"2",
"while( low <= high ) {\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}",
"low <= high",
"low",
"high",
"{\n\t\t\t\t\tif( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}\n\t\t\t\t}",
"if( T[i] == S[middle] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}",
"T[i] == S[middle]",
"T[i]",
"T",
"i",
"S[middle]",
"S",
"middle",
"{\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"cnt++",
"cnt",
"break;",
"if( T[i] < S[middle] ) {\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}",
"T[i] < S[middle]",
"T[i]",
"T",
"i",
"S[middle]",
"S",
"middle",
"{\n\t\t\t\t\t\thigh = middle - 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}",
"high = middle - 1",
"high",
"middle - 1",
"middle",
"1",
"middle = ( low+high )/2",
"middle",
"( low+high )/2",
"( low+high )",
"low",
"high",
"2",
"{\n\t\t\t\t\t\tlow = middle + 1;\n\t\t\t\t\t\tmiddle = ( low+high )/2;\n\t\t\t\t\t}",
"low = middle + 1",
"low",
"middle + 1",
"middle",
"1",
"middle = ( low+high )/2",
"middle",
"( low+high )/2",
"( low+high )",
"low",
"high",
"2",
"System.out.println( cnt )",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args"
] | import java.io.*;
class Main {
public static void main(String[] args) {
try {
BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
int n = Integer.parseInt( kb.readLine( ) );
String[] str = kb.readLine( ).split( " " );
int[] S = new int[ n ];
for( int i=0; i<n; i++ ) {
S[i] = Integer.parseInt( str[i] );
}
int q = Integer.parseInt( kb.readLine( ) );
str = kb.readLine( ).split( " " );
int[] T = new int[ q ];
for( int i=0; i<q; i++ ) {
T[i] = Integer.parseInt( str[i] );
}
int cnt = 0;
int low, high, middle;
for( int i=0; i<q; i++ ) {
low = 0;
high = n-1;
middle = n/2;
while( low <= high ) {
if( T[i] == S[middle] ) {
cnt++;
break;
} else if( T[i] < S[middle] ) {
high = middle - 1;
middle = ( low+high )/2;
} else {
low = middle + 1;
middle = ( low+high )/2;
}
}
}
System.out.println( cnt );
} catch( IOException e ) {
System.err.println( e );
}
}
} |
[
7,
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,
30,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
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,
2,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
4,
18,
4,
18,
13,
13,
4,
18,
4,
18,
13,
13,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
4,
18,
13,
13,
4,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
13,
13,
30,
3,
0,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
4,
18,
13,
13,
4,
18,
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
],
[
183,
5
],
[
183,
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,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
36,
37
],
[
37,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
8,
66
],
[
66,
67
],
[
66,
68
],
[
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
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
81,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
81,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
98,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
97,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
113,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
112,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
112,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
129,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
128,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
111,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
111,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
81,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
158,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
157,
171
],
[
171,
172
],
[
172,
173
],
[
8,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
174,
179
],
[
6,
180
],
[
180,
181
],
[
0,
182
],
[
182,
183
],
[
182,
184
]
] | [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\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 Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\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",
"List<Integer> s = new ArrayList<>();",
"s",
"new ArrayList<>()",
"for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s.add(sc.nextInt());\n }",
"{\n s.add(sc.nextInt());\n }",
"s.add(sc.nextInt())",
"s.add",
"s",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> t = new ArrayList<>();",
"t",
"new ArrayList<>()",
"for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n t.add(sc.nextInt());\n }",
"{\n t.add(sc.nextInt());\n }",
"t.add(sc.nextInt())",
"t.add",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }",
"{\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }",
"int left = 0;",
"left",
"0",
"int right = n - 1;",
"right",
"n - 1",
"n",
"1",
"int middle = (left + right) / 2;",
"middle",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }",
"t.get(i).intValue() != s.get(middle).intValue()",
"t.get(i).intValue()",
"t.get(i).intValue",
"t.get(i)",
"t.get",
"t",
"i",
"s.get(middle).intValue()",
"s.get(middle).intValue",
"s.get(middle)",
"s.get",
"s",
"middle",
"{\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }",
"if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }",
"t.get(i) < s.get(middle)",
"t.get(i)",
"t.get",
"t",
"i",
"s.get(middle)",
"s.get",
"s",
"middle",
"{\n right = middle - 1;\n }",
"right = middle - 1",
"right",
"middle - 1",
"middle",
"1",
"if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }",
"t.get(i) > s.get(middle)",
"t.get(i)",
"t.get",
"t",
"i",
"s.get(middle)",
"s.get",
"s",
"middle",
"{\n left = middle + 1;\n }",
"left = middle + 1",
"left",
"middle + 1",
"middle",
"1",
"if(right < left) {\n break;\n }",
"right < left",
"right",
"left",
"{\n break;\n }",
"break;",
"middle = (left + right) / 2",
"middle",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }",
"t.get(i).intValue() == s.get(middle).intValue()",
"t.get(i).intValue()",
"t.get(i).intValue",
"t.get(i)",
"t.get",
"t",
"i",
"s.get(middle).intValue()",
"s.get(middle).intValue",
"s.get(middle)",
"s.get",
"s",
"middle",
"{\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 Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }\n System.out.println(count);\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 List<Integer> s = new ArrayList<>();\n for(int i = 0; i < n; i++) {\n s.add(sc.nextInt());\n }\n int q = sc.nextInt();\n List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n t.add(sc.nextInt());\n }\n int count = 0;\n for(int i = 0; i < q; i++) {\n int left = 0;\n int right = n - 1;\n int middle = (left + right) / 2;\n while(t.get(i).intValue() != s.get(middle).intValue()) {\n if(t.get(i) < s.get(middle)) {\n right = middle - 1;\n } else if(t.get(i) > s.get(middle)) {\n left = middle + 1;\n }\n if(right < left) {\n break;\n }\n middle = (left + right) / 2;\n }\n if(t.get(i).intValue() == s.get(middle).intValue()) {\n count++;\n }\n }\n System.out.println(count);\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();
List<Integer> s = new ArrayList<>();
for(int i = 0; i < n; i++) {
s.add(sc.nextInt());
}
int q = sc.nextInt();
List<Integer> t = new ArrayList<>();
for(int i = 0; i < q; i++) {
t.add(sc.nextInt());
}
int count = 0;
for(int i = 0; i < q; i++) {
int left = 0;
int right = n - 1;
int middle = (left + right) / 2;
while(t.get(i).intValue() != s.get(middle).intValue()) {
if(t.get(i) < s.get(middle)) {
right = middle - 1;
} else if(t.get(i) > s.get(middle)) {
left = middle + 1;
}
if(right < left) {
break;
}
middle = (left + right) / 2;
}
if(t.get(i).intValue() == s.get(middle).intValue()) {
count++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
11,
1,
0,
13,
2,
2,
13,
17,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
40,
13,
3,
30,
11,
1,
0,
13,
17,
2,
13,
2,
2,
13,
17,
17,
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
],
[
187,
5
],
[
187,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
29,
30
],
[
29,
31
],
[
8,
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
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
60,
61
],
[
61,
62
],
[
8,
63
],
[
63,
64
],
[
63,
65
],
[
66,
67
],
[
66,
68
],
[
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
],
[
86,
89
],
[
89,
90
],
[
90,
91
],
[
8,
92
],
[
92,
93
],
[
92,
94
],
[
8,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
115,
117
],
[
108,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
119,
128
],
[
128,
129
],
[
128,
130
],
[
119,
131
],
[
131,
132
],
[
132,
133
],
[
119,
134
],
[
135,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
108,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
149,
161
],
[
161,
162
],
[
162,
163
],
[
149,
164
],
[
165,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
166,
174
],
[
174,
175
],
[
175,
176
],
[
174,
177
],
[
8,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
6,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.util.Scanner;\n\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}",
"main",
"{\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}",
"int i",
"i",
"j",
"j",
"n;",
"n",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n=Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int s[]=new int[n+1];",
"s",
"new int[n+1]",
"n+1",
"n",
"1",
"for(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"{\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"s[i]=Integer.parseInt(sc.next())",
"s[i]",
"s",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int q=Integer.parseInt(sc.next());",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int t[]=new int[q+1];",
"t",
"new int[q+1]",
"q+1",
"q",
"1",
"for(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"{\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"t[i]=Integer.parseInt(sc.next())",
"t[i]",
"t",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int count=0;",
"count",
"0",
"for(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"if(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"s[n/2]<t[i]",
"s[n/2]",
"s",
"n/2",
"n",
"2",
"t[i]",
"t",
"i",
"{\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"j=(n/2)+1;",
"j=(n/2)+1",
"j",
"(n/2)+1",
"(n/2)",
"n",
"2",
"1",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"s[j]==t[i]",
"s[j]",
"s",
"j",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"count++",
"count",
"break;",
"{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"j=0;",
"j=0",
"j",
"0",
"j<(n/2)+1",
"j",
"(n/2)+1",
"(n/2)",
"n",
"2",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"s[j]==t[i]",
"s[j]",
"s",
"j",
"t[i]",
"t",
"i",
"{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\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[]){\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}\n}",
"public class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n;;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\t\tfor(i=0;i<q;i++){\n\t\t\tif(s[n/2]<t[i]){\n\t\t\t\tfor(j=(n/2)+1;j<n;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(j=0;j<(n/2)+1;j++){\n\t\t\t\t\t\n\t\t\t\t\tif(s[j]==t[i]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\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\t\n\t\t\n\t\t\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String args[]){
int i,j,n;;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt(sc.next());
int s[]=new int[n+1];
for(i=0;i<n;i++){
s[i]=Integer.parseInt(sc.next());
}
int q=Integer.parseInt(sc.next());
int t[]=new int[q+1];
for(i=0;i<q;i++){
t[i]=Integer.parseInt(sc.next());
}
int count=0;
for(i=0;i<q;i++){
if(s[n/2]<t[i]){
for(j=(n/2)+1;j<n;j++){
if(s[j]==t[i]){
count++;
break;
}
}
}
else{
for(j=0;j<(n/2)+1;j++){
if(s[j]==t[i]){
count++;
break;
}
}
}
}
System.out.println(count);
}
} |
[
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,
18,
13,
13,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
23,
13,
6,
13,
12,
13,
30,
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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
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,
0,
13,
13,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
42,
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,
0,
13,
20,
0,
13,
20,
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
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
29,
31
],
[
26,
32
],
[
32,
33
],
[
32,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
26,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
24,
42
],
[
42,
43
],
[
22,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
48,
57
],
[
57,
58
],
[
57,
59
],
[
48,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
48,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
48,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
48,
90
],
[
90,
91
],
[
90,
92
],
[
48,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
94,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
48,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
114,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
126,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
137,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
145,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
145,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
162,
164
],
[
157,
165
],
[
165,
166
],
[
165,
167
],
[
157,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
170,
172
],
[
48,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
46,
179
],
[
179,
180
],
[
22,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
181,
185
],
[
185,
186
],
[
181,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
190,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
196,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
189,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
181,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
214,
217
],
[
217,
218
],
[
181,
219
],
[
219,
220
],
[
219,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
221,
225
],
[
225,
226
],
[
225,
227
],
[
219,
228
],
[
228,
229
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.StringTokenizer;\n\nclass Main {\n\t\n\tstatic class BinarySearch {\n\t\tpublic void binarysearch (InputReader ir) {\n\t\t\t\n\t\t\tint count = 0;\n\t\t\tint n = ir.nextInt();\n\t\t\tint[] array = new int[n];\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(array);\n\t\t\t\n\t\t\tint q = ir.nextInt();\n\t\t\tint[] array2 = new int[q];\n\t\t\t\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}\n\t\t\t \n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n\t\n\tstatic class InputReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\t\n\t\tpublic String nextString() {\n\t\t\t\n\t\t\t while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\t\t\t\t\t\n\t\tpublic InputReader (InputStream inputStream) {\n\t\t\tbr = new BufferedReader (new InputStreamReader (inputStream));\n\t\t\tst = new StringTokenizer (\"\");\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void main (String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tInputReader in = new InputReader (inputStream);\n\t\tBinarySearch obj = new BinarySearch ();\n\t\tobj.binarysearch (in);\n\t}\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.util.Arrays;",
"Arrays",
"java.util",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"class Main {\n\t\n\tstatic class BinarySearch {\n\t\tpublic void binarysearch (InputReader ir) {\n\t\t\t\n\t\t\tint count = 0;\n\t\t\tint n = ir.nextInt();\n\t\t\tint[] array = new int[n];\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(array);\n\t\t\t\n\t\t\tint q = ir.nextInt();\n\t\t\tint[] array2 = new int[q];\n\t\t\t\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}\n\t\t\t \n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n\t\n\tstatic class InputReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\t\n\t\tpublic String nextString() {\n\t\t\t\n\t\t\t while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\t\t\t\t\t\n\t\tpublic InputReader (InputStream inputStream) {\n\t\t\tbr = new BufferedReader (new InputStreamReader (inputStream));\n\t\t\tst = new StringTokenizer (\"\");\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void main (String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tInputReader in = new InputReader (inputStream);\n\t\tBinarySearch obj = new BinarySearch ();\n\t\tobj.binarysearch (in);\n\t}\n}",
"Main",
"public static void main (String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tInputReader in = new InputReader (inputStream);\n\t\tBinarySearch obj = new BinarySearch ();\n\t\tobj.binarysearch (in);\n\t}",
"main",
"{\n\t\tInputStream inputStream = System.in;\n\t\tInputReader in = new InputReader (inputStream);\n\t\tBinarySearch obj = new BinarySearch ();\n\t\tobj.binarysearch (in);\n\t}",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"InputReader in = new InputReader (inputStream);",
"in",
"new InputReader (inputStream)",
"BinarySearch obj = new BinarySearch ();",
"obj",
"new BinarySearch ()",
"obj.binarysearch (in)",
"obj.binarysearch",
"obj",
"in",
"String[] args",
"args",
"static class BinarySearch {\n\t\tpublic void binarysearch (InputReader ir) {\n\t\t\t\n\t\t\tint count = 0;\n\t\t\tint n = ir.nextInt();\n\t\t\tint[] array = new int[n];\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(array);\n\t\t\t\n\t\t\tint q = ir.nextInt();\n\t\t\tint[] array2 = new int[q];\n\t\t\t\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}\n\t\t\t \n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}",
"BinarySearch",
"public void binarysearch (InputReader ir) {\n\t\t\t\n\t\t\tint count = 0;\n\t\t\tint n = ir.nextInt();\n\t\t\tint[] array = new int[n];\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(array);\n\t\t\t\n\t\t\tint q = ir.nextInt();\n\t\t\tint[] array2 = new int[q];\n\t\t\t\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}\n\t\t\t \n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}",
"binarysearch",
"{\n\t\t\t\n\t\t\tint count = 0;\n\t\t\tint n = ir.nextInt();\n\t\t\tint[] array = new int[n];\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(array);\n\t\t\t\n\t\t\tint q = ir.nextInt();\n\t\t\tint[] array2 = new int[q];\n\t\t\t\n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}\n\t\t\t \n\t\t\tfor (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}",
"int count = 0;",
"count",
"0",
"int n = ir.nextInt();",
"n",
"ir.nextInt()",
"ir.nextInt",
"ir",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}",
"{\n\t\t\t\tarray[i] = ir.nextInt();\n\t\t\t}",
"array[i] = ir.nextInt()",
"array[i]",
"array",
"i",
"ir.nextInt()",
"ir.nextInt",
"ir",
"Arrays.sort(array)",
"Arrays.sort",
"Arrays",
"array",
"int q = ir.nextInt();",
"q",
"ir.nextInt()",
"ir.nextInt",
"ir",
"int[] array2 = new int[q];",
"array2",
"new int[q]",
"q",
"for (int i = 0; i < q; i++) {\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}",
"{\n\t\t\t\tarray2[i] = ir.nextInt();\n\t\t\t}",
"array2[i] = ir.nextInt()",
"array2[i]",
"array2",
"i",
"ir.nextInt()",
"ir.nextInt",
"ir",
"for (int i = 0; i < q; i++) {\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}",
"{\n\t\t\t\tint left = 0;\n\t\t\t\tint right = n;\n\t\t \t\t \n\t\t\t\twhile (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t} \n\t\t\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while (left < right) {\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t\t\tint mid = (left + right)/2; \n\t\t\t\t\tif (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;\n\t\t \n\t\t\t\t}",
"int mid = (left + right)/2;",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if (array2[i] == array[mid]) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} \n\t\t\t\t\telse if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;",
"array2[i] == array[mid]",
"array2[i]",
"array2",
"i",
"array[mid]",
"array",
"mid",
"{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}",
"count++",
"count",
"break;",
"if (array2[i] < array[mid]) right = mid; \n\t\t\t\t\telse left = mid + 1;",
"array2[i] < array[mid]",
"array2[i]",
"array2",
"i",
"array[mid]",
"array",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"InputReader ir",
"ir",
"static class InputReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\t\n\t\tpublic String nextString() {\n\t\t\t\n\t\t\t while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\t\t\t\t\t\n\t\tpublic InputReader (InputStream inputStream) {\n\t\t\tbr = new BufferedReader (new InputStreamReader (inputStream));\n\t\t\tst = new StringTokenizer (\"\");\n\t\t}\n\t\t\n\t}",
"InputReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public String nextString() {\n\t\t\t\n\t\t\t while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t\t\treturn st.nextToken();\n\t\t}",
"nextString",
"{\n\t\t\t\n\t\t\t while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }\n\t\t\treturn st.nextToken();\n\t\t}",
"while (!st.hasMoreTokens()) {\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n\t try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t }",
"try {\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }",
"catch (IOException e) {\n\t throw new InputMismatchException();\n\t }",
"IOException e",
"{\n\t throw new InputMismatchException();\n\t }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n\t st = new StringTokenizer(br.readLine(), \" \");\n\t }",
"st = new StringTokenizer(br.readLine(), \" \")",
"st",
"new StringTokenizer(br.readLine(), \" \")",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}",
"return Integer.parseInt(nextString());",
"Integer.parseInt(nextString())",
"Integer.parseInt",
"Integer",
"nextString()",
"nextString",
"public InputReader (InputStream inputStream) {\n\t\t\tbr = new BufferedReader (new InputStreamReader (inputStream));\n\t\t\tst = new StringTokenizer (\"\");\n\t\t}",
"InputReader",
"{\n\t\t\tbr = new BufferedReader (new InputStreamReader (inputStream));\n\t\t\tst = new StringTokenizer (\"\");\n\t\t}",
"br = new BufferedReader (new InputStreamReader (inputStream))",
"br",
"new BufferedReader (new InputStreamReader (inputStream))",
"st = new StringTokenizer (\"\")",
"st",
"new StringTokenizer (\"\")",
"InputStream inputStream",
"inputStream"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
class Main {
static class BinarySearch {
public void binarysearch (InputReader ir) {
int count = 0;
int n = ir.nextInt();
int[] array = new int[n];
for (int i = 0; i < n; i++) {
array[i] = ir.nextInt();
}
Arrays.sort(array);
int q = ir.nextInt();
int[] array2 = new int[q];
for (int i = 0; i < q; i++) {
array2[i] = ir.nextInt();
}
for (int i = 0; i < q; i++) {
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right)/2;
if (array2[i] == array[mid]) {
count++;
break;
}
else if (array2[i] < array[mid]) right = mid;
else left = mid + 1;
}
}
System.out.println(count);
}
}
static class InputReader {
BufferedReader br;
StringTokenizer st;
public String nextString() {
while (!st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine(), " ");
} catch (IOException e) {
throw new InputMismatchException();
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(nextString());
}
public InputReader (InputStream inputStream) {
br = new BufferedReader (new InputStreamReader (inputStream));
st = new StringTokenizer ("");
}
}
public static void main (String[] args) {
InputStream inputStream = System.in;
InputReader in = new InputReader (inputStream);
BinarySearch obj = new BinarySearch ();
obj.binarysearch (in);
}
}
|
[
7,
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,
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,
30,
41,
13,
4,
18,
13,
14,
40,
4,
18,
13,
13,
30,
40,
13,
41,
13,
20,
4,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
102,
20
],
[
102,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
32,
34
],
[
23,
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
],
[
48,
51
],
[
51,
52
],
[
52,
53
],
[
23,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
23,
59
],
[
59,
60
],
[
59,
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
],
[
74,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
23,
89
],
[
89,
90
],
[
89,
91
],
[
23,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
23,
96
],
[
96,
97
],
[
97,
98
],
[
21,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport 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(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"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(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}",
"main",
"{\n\t\tScanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}",
"Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));",
"scan",
"new Scanner(new BufferedReader(new InputStreamReader(System.in)))",
"int s=scan.nextInt();",
"s",
"scan.nextInt()",
"scan.nextInt",
"scan",
"Set<Integer> set=new HashSet<Integer>();",
"set",
"new HashSet<Integer>()",
"for (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s",
"i",
"s",
"i++",
"i++",
"i",
"{\n\t\t\tset.add(scan.nextInt());\n\t\t}",
"{\n\t\t\tset.add(scan.nextInt());\n\t\t}",
"set.add(scan.nextInt())",
"set.add",
"set",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q=scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int v=0;",
"v",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\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 a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}",
"int a=scan.nextInt();",
"a",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}",
"!set.add(a)",
"set.add(a)",
"set.add",
"set",
"a",
"{\n\t\t\t\tv++;\n\t\t\t}",
"v++",
"v",
"PrintWriter pw=new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"pw.println(v)",
"pw.println",
"pw",
"v",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint s=scan.nextInt();\n\t\tSet<Integer> set=new HashSet<Integer>();\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tset.add(scan.nextInt());\n\t\t}\n\t\tint q=scan.nextInt();\n\t\tint v=0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint a=scan.nextInt();\n\t\t\tif(!set.add(a))\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t}\n\t\t}\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tpw.println(v);\n\t\tpw.close();\n\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
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(new BufferedReader(new InputStreamReader(System.in)));
int s=scan.nextInt();
Set<Integer> set=new HashSet<Integer>();
for (int i = 0; i < s; i++) {
set.add(scan.nextInt());
}
int q=scan.nextInt();
int v=0;
for (int i = 0; i < q; i++) {
int a=scan.nextInt();
if(!set.add(a))
{
v++;
}
}
PrintWriter pw=new PrintWriter(System.out);
pw.println(v);
pw.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
42,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
29,
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,
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,
41,
13,
4,
18,
13,
14,
4,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
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
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
19,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
31,
32
],
[
19,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
33,
39
],
[
39,
40
],
[
40,
41
],
[
33,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
42,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
6,
60
],
[
60,
61
],
[
6,
62
],
[
62,
63
],
[
141,
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,
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
],
[
123,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
126,
129
],
[
125,
130
],
[
130,
131
],
[
66,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
64,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n static boolean binary_search (int x, int[] data) {\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }\n\n System.out.println(cnt);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static boolean binary_search (int x, int[] data) {\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }\n\n System.out.println(cnt);\n }\n}",
"Main",
"static boolean binary_search (int x, int[] data) {\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }",
"binary_search",
"{\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }",
"int left = 0",
"left",
"0",
"right = data.length;",
"right",
"data.length",
"data",
"data.length",
"while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }",
"true",
"{\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (left > right) return false;",
"left > right",
"left",
"right",
"return false;",
"false",
"if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }",
"data[mid] == x",
"data[mid]",
"data",
"mid",
"x",
"{\n return true;\n }",
"return true;",
"true",
"if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }",
"data[mid] < x",
"data[mid]",
"data",
"mid",
"x",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"{\n right = mid - 1;\n }",
"right = mid - 1",
"right",
"mid - 1",
"mid",
"1",
"int x",
"x",
"int[] data",
"data",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }\n\n System.out.println(cnt);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++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 int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }",
"{\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }",
"int t = scanner.nextInt();",
"t",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if (binary_search(t, s)) ++cnt;",
"binary_search(t, s)",
"binary_search",
"t",
"s",
"++cnt",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n static boolean binary_search (int x, int[] data) {\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }\n\n System.out.println(cnt);\n }\n}",
"public class Main {\n static boolean binary_search (int x, int[] data) {\n int left = 0, right = data.length;\n while (true) {\n int mid = (left + right) / 2;\n\n if (left > right) return false;\n\n if (data[mid] == x) {\n return true;\n } else if (data[mid] < x) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n\n int[] s = new int[n];\n for (int i = 0; i < n; ++i) {\n s[i] = scanner.nextInt();\n }\n\n int q = scanner.nextInt();\n\n int cnt = 0;\n for (int i = 0; i < q; ++i) {\n int t = scanner.nextInt();\n if (binary_search(t, s)) ++cnt;\n }\n\n System.out.println(cnt);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static boolean binary_search (int x, int[] data) {
int left = 0, right = data.length;
while (true) {
int mid = (left + right) / 2;
if (left > right) return false;
if (data[mid] == x) {
return true;
} else if (data[mid] < x) {
left = mid + 1;
} else {
right = mid - 1;
}
}
}
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) {
int t = scanner.nextInt();
if (binary_search(t, s)) ++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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
41,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
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
],
[
70,
71
],
[
69,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
6,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
] | [
"import java.util.*;\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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\n count++;\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 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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\n count++;\n }\n System.out.println(count);\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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\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",
"List<Integer> t = new ArrayList<>();",
"t",
"new ArrayList<>()",
"for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }",
"{\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(!t.contains(a)) {\n t.add(a);\n }",
"!t.contains(a)",
"t.contains(a)",
"t.contains",
"t",
"a",
"{\n t.add(a);\n }",
"t.add(a)",
"t.add",
"t",
"a",
"int count = 0;",
"count",
"0",
"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 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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\n count++;\n }\n System.out.println(count);\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 List<Integer> t = new ArrayList<>();\n for(int i = 0; i < q; i++) {\n int a = sc.nextInt();\n if(!t.contains(a)) {\n t.add(a);\n }\n }\n int count = 0;\n loop: for(int i = 0; i < t.size(); i++) {\n int key = t.get(i);\n int left = 0;\n int right = n - 1;\n int middle = n / 2;\n while(key != s[middle]) {\n if(key < s[middle]) {\n right = middle - 1;\n middle = (left + right) / 2;\n } else {\n left = middle + 1;\n middle = (left + right) / 2;\n }\n if(left > right) {\n continue loop;\n }\n }\n count++;\n }\n System.out.println(count);\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();
List<Integer> t = new ArrayList<>();
for(int i = 0; i < q; i++) {
int a = sc.nextInt();
if(!t.contains(a)) {
t.add(a);
}
}
int count = 0;
loop: for(int i = 0; i < t.size(); i++) {
int key = t.get(i);
int left = 0;
int right = n - 1;
int middle = n / 2;
while(key != s[middle]) {
if(key < s[middle]) {
right = middle - 1;
middle = (left + right) / 2;
} else {
left = middle + 1;
middle = (left + right) / 2;
}
if(left > right) {
continue loop;
}
}
count++;
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
40,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
17,
42,
2,
2,
13,
40,
17,
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,
0,
13,
13,
14,
2,
13,
17,
30,
29,
17,
30,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
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,
4,
18,
13,
14,
2,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
13,
13,
17,
30,
40,
13,
14,
2,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
13,
13,
18,
13,
13,
17,
30,
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
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
23,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
32,
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
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
52,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
52,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
8,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
68,
75
],
[
75,
76
],
[
76,
77
],
[
6,
78
],
[
78,
79
],
[
6,
80
],
[
80,
81
],
[
4,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
84,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
84,
96
],
[
96,
97
],
[
96,
98
],
[
99,
100
],
[
99,
101
],
[
84,
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
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
120,
121
],
[
84,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
84,
127
],
[
127,
128
],
[
127,
129
],
[
84,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
131,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
149,
150
],
[
84,
151
],
[
151,
152
],
[
152,
153
],
[
84,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
164,
166
],
[
159,
167
],
[
167,
168
],
[
168,
169
],
[
159,
170
],
[
171,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
174,
177
],
[
177,
178
],
[
177,
179
],
[
173,
180
],
[
172,
181
],
[
181,
182
],
[
182,
183
],
[
154,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
189,
194
],
[
194,
195
],
[
194,
196
],
[
189,
197
],
[
197,
198
],
[
198,
199
],
[
189,
200
],
[
201,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
204,
207
],
[
207,
208
],
[
207,
209
],
[
203,
210
],
[
202,
211
],
[
211,
212
],
[
212,
213
],
[
84,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
214,
219
],
[
82,
220
],
[
220,
221
]
] | [
"import java.util.*;\nclass Main{\n\tstatic int BinarySearch(int[] data, int key){\n\t\tint result = -1;\n\t\tint r = data.length-1;\n\t\tint l = 0;\n\t\twhile(result == -1 && l <= r){\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}\n\t\tif (result>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n \n\t}\n\tpublic static void main(String[] args){\n\t\tint count = 0;\n\t\tScanner x=new Scanner(System.in);\n\t int s1 = x.nextInt();\n\t\tint[] r1=new int[s1+1];\n\t\tfor(int i=0;i<s1;i++){\n\t\t r1[i]=x.nextInt();\n\t\t}\n\t int s2 = x.nextInt();\n\t\tint[] r2=new int[s2];\n\t\tfor(int j=0;j<s2;j++){\n\t\t r2[j]=x.nextInt();\n\t\t}\n\t\tx.close();\n\t\tif(s1<s2){\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}else if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tstatic int BinarySearch(int[] data, int key){\n\t\tint result = -1;\n\t\tint r = data.length-1;\n\t\tint l = 0;\n\t\twhile(result == -1 && l <= r){\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}\n\t\tif (result>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n \n\t}\n\tpublic static void main(String[] args){\n\t\tint count = 0;\n\t\tScanner x=new Scanner(System.in);\n\t int s1 = x.nextInt();\n\t\tint[] r1=new int[s1+1];\n\t\tfor(int i=0;i<s1;i++){\n\t\t r1[i]=x.nextInt();\n\t\t}\n\t int s2 = x.nextInt();\n\t\tint[] r2=new int[s2];\n\t\tfor(int j=0;j<s2;j++){\n\t\t r2[j]=x.nextInt();\n\t\t}\n\t\tx.close();\n\t\tif(s1<s2){\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}else if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"static int BinarySearch(int[] data, int key){\n\t\tint result = -1;\n\t\tint r = data.length-1;\n\t\tint l = 0;\n\t\twhile(result == -1 && l <= r){\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}\n\t\tif (result>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n \n\t}",
"BinarySearch",
"{\n\t\tint result = -1;\n\t\tint r = data.length-1;\n\t\tint l = 0;\n\t\twhile(result == -1 && l <= r){\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}\n\t\tif (result>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n \n\t}",
"int result = -1;",
"result",
"-1",
"1",
"int r = data.length-1;",
"r",
"data.length-1",
"data.length",
"data",
"data.length",
"1",
"int l = 0;",
"l",
"0",
"while(result == -1 && l <= r){\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}",
"result == -1 && l <= r",
"result == -1",
"result",
"-1",
"1",
"l <= r",
"l",
"r",
"{\n\t\t\tint middle = (l+r)/2;\n\t\t\tif(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}\n\t\t}",
"int middle = (l+r)/2;",
"middle",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(data[middle]<key){\n\t\t\t l = middle + 1;\n\t\t\t}else if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}",
"data[middle]<key",
"data[middle]",
"data",
"middle",
"key",
"{\n\t\t\t l = middle + 1;\n\t\t\t}",
"l = middle + 1",
"l",
"middle + 1",
"middle",
"1",
"if(data[middle] > key){\n\t\t\t\tr = middle - 1;\n\t\t\t}else{\n\t\t\t\tresult = middle ;\n\t\t\t}",
"data[middle] > key",
"data[middle]",
"data",
"middle",
"key",
"{\n\t\t\t\tr = middle - 1;\n\t\t\t}",
"r = middle - 1",
"r",
"middle - 1",
"middle",
"1",
"{\n\t\t\t\tresult = middle ;\n\t\t\t}",
"result = middle",
"result",
"middle",
"if (result>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}",
"result>=0",
"result",
"0",
"{\n\t\t\treturn 1;\n\t\t}",
"return 1;",
"1",
"{\n\t\t\treturn 0;\n\t\t}",
"return 0;",
"0",
"int[] data",
"data",
"int key",
"key",
"public static void main(String[] args){\n\t\tint count = 0;\n\t\tScanner x=new Scanner(System.in);\n\t int s1 = x.nextInt();\n\t\tint[] r1=new int[s1+1];\n\t\tfor(int i=0;i<s1;i++){\n\t\t r1[i]=x.nextInt();\n\t\t}\n\t int s2 = x.nextInt();\n\t\tint[] r2=new int[s2];\n\t\tfor(int j=0;j<s2;j++){\n\t\t r2[j]=x.nextInt();\n\t\t}\n\t\tx.close();\n\t\tif(s1<s2){\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}else if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tint count = 0;\n\t\tScanner x=new Scanner(System.in);\n\t int s1 = x.nextInt();\n\t\tint[] r1=new int[s1+1];\n\t\tfor(int i=0;i<s1;i++){\n\t\t r1[i]=x.nextInt();\n\t\t}\n\t int s2 = x.nextInt();\n\t\tint[] r2=new int[s2];\n\t\tfor(int j=0;j<s2;j++){\n\t\t r2[j]=x.nextInt();\n\t\t}\n\t\tx.close();\n\t\tif(s1<s2){\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}else if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"Scanner x=new Scanner(System.in);",
"x",
"new Scanner(System.in)",
"int s1 = x.nextInt();",
"s1",
"x.nextInt()",
"x.nextInt",
"x",
"int[] r1=new int[s1+1];",
"r1",
"new int[s1+1]",
"s1+1",
"s1",
"1",
"for(int i=0;i<s1;i++){\n\t\t r1[i]=x.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<s1",
"i",
"s1",
"i++",
"i++",
"i",
"{\n\t\t r1[i]=x.nextInt();\n\t\t}",
"{\n\t\t r1[i]=x.nextInt();\n\t\t}",
"r1[i]=x.nextInt()",
"r1[i]",
"r1",
"i",
"x.nextInt()",
"x.nextInt",
"x",
"int s2 = x.nextInt();",
"s2",
"x.nextInt()",
"x.nextInt",
"x",
"int[] r2=new int[s2];",
"r2",
"new int[s2]",
"s2",
"for(int j=0;j<s2;j++){\n\t\t r2[j]=x.nextInt();\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<s2",
"j",
"s2",
"j++",
"j++",
"j",
"{\n\t\t r2[j]=x.nextInt();\n\t\t}",
"{\n\t\t r2[j]=x.nextInt();\n\t\t}",
"r2[j]=x.nextInt()",
"r2[j]",
"r2",
"j",
"x.nextInt()",
"x.nextInt",
"x",
"x.close()",
"x.close",
"x",
"if(s1<s2){\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}else if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}",
"s1<s2",
"s1",
"s2",
"{\n\t\tfor(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t}",
"for(int i=0;i<s1;i++){\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<s1",
"i",
"s1",
"i++",
"i++",
"i",
"{\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"if(BinarySearch(r1,r2[i])==1){\n\t\t\t\tcount++;\n\t\t\t}",
"BinarySearch(r1,r2[i])==1",
"BinarySearch(r1,r2[i])",
"BinarySearch",
"r1",
"r2[i]",
"r2",
"i",
"1",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"if(s1>s2){\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}",
"s1>s2",
"s1",
"s2",
"{\n\t\t\tfor(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}\n\t\t}",
"for(int j=0;j<s2;j++){\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<s2",
"j",
"s2",
"j++",
"j++",
"j",
"{\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}",
"{\n\t\t\t if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }\n\t\t\t}",
"if(BinarySearch(r1,r2[j])==1){\n\t\t\t\t count++;\t\n\t\t }",
"BinarySearch(r1,r2[j])==1",
"BinarySearch(r1,r2[j])",
"BinarySearch",
"r1",
"r2[j]",
"r2",
"j",
"1",
"{\n\t\t\t\t count++;\t\n\t\t }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.*;
class Main{
static int BinarySearch(int[] data, int key){
int result = -1;
int r = data.length-1;
int l = 0;
while(result == -1 && l <= r){
int middle = (l+r)/2;
if(data[middle]<key){
l = middle + 1;
}else if(data[middle] > key){
r = middle - 1;
}else{
result = middle ;
}
}
if (result>=0){
return 1;
}else{
return 0;
}
}
public static void main(String[] args){
int count = 0;
Scanner x=new Scanner(System.in);
int s1 = x.nextInt();
int[] r1=new int[s1+1];
for(int i=0;i<s1;i++){
r1[i]=x.nextInt();
}
int s2 = x.nextInt();
int[] r2=new int[s2];
for(int j=0;j<s2;j++){
r2[j]=x.nextInt();
}
x.close();
if(s1<s2){
for(int i=0;i<s1;i++){
if(BinarySearch(r1,r2[i])==1){
count++;
}
}
}else if(s1>s2){
for(int j=0;j<s2;j++){
if(BinarySearch(r1,r2[j])==1){
count++;
}
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
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,
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,
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,
18,
13,
13,
13,
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,
13,
18,
13,
13,
29,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
0,
13,
13,
29,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
162,
8
],
[
162,
9
],
[
9,
10
],
[
162,
11
],
[
11,
12
],
[
162,
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
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
15,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
15,
52
],
[
52,
53
],
[
52,
54
],
[
15,
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
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
15,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
15,
79
],
[
79,
80
],
[
79,
81
],
[
15,
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
],
[
96,
101
],
[
95,
102
],
[
102,
103
],
[
15,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
13,
110
],
[
110,
111
],
[
162,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
114,
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
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
133,
139
],
[
139,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
141,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
141,
152
],
[
152,
153
],
[
152,
154
],
[
114,
155
],
[
155,
156
],
[
112,
157
],
[
157,
158
],
[
112,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic int n, q;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static boolean binary_search(int x, int[] S) {\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic int n, q;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static boolean binary_search(int x, int[] S) {\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main",
"static int n",
"n",
"q;",
"q",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"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(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",
"int[] 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",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"long ans = 0;",
"ans",
"0",
"for(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}",
"{\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}",
"if(binary_search(T[i], S)) ans++;",
"binary_search(T[i], S)",
"binary_search",
"T[i]",
"T",
"i",
"S",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static boolean binary_search(int x, int[] S) {\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}",
"binary_search",
"{\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}",
"int l = 0;",
"l",
"0",
"int r = n;",
"r",
"n",
"while(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}",
"r > l",
"r",
"l",
"{\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}",
"int center = (l + r) / 2;",
"center",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;",
"x == S[center]",
"x",
"S[center]",
"S",
"center",
"return true;",
"true",
"if(x > S[center]) l = center + 1;\n\t\t\telse r = center;",
"x > S[center]",
"x",
"S[center]",
"S",
"center",
"l = center + 1",
"l",
"center + 1",
"center",
"1",
"r = center",
"r",
"center",
"return false;",
"false",
"int x",
"x",
"int[] S",
"S",
"public class Main {\n\n\tstatic int n, q;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static boolean binary_search(int x, int[] S) {\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"public class Main {\n\n\tstatic int n, q;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();\n\t\tArrays.sort(S);\n\n\t\tlong ans = 0;\n\t\tfor(int i = 0 ; i < q ; i++) {\n\t\t\tif(binary_search(T[i], S)) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tpublic static boolean binary_search(int x, int[] S) {\n\t\tint l = 0;\n\t\tint r = n;\n\t\twhile(r > l) {\n\t\t\tint center = (l + r) / 2;\n\t\t\tif(x == S[center]) return true;\n\t\t\telse if(x > S[center]) l = center + 1;\n\t\t\telse r = center;\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int n, q;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
int[] S = new int[n];
for(int i = 0 ; i < n ; i++) S[i] = sc.nextInt();
q = sc.nextInt();
int[] T = new int[q];
for(int i = 0 ; i < q ; i++) T[i] = sc.nextInt();
Arrays.sort(S);
long ans = 0;
for(int i = 0 ; i < q ; i++) {
if(binary_search(T[i], S)) ans++;
}
System.out.println(ans);
}
public static boolean binary_search(int x, int[] S) {
int l = 0;
int r = n;
while(r > l) {
int center = (l + r) / 2;
if(x == S[center]) return true;
else if(x > S[center]) l = center + 1;
else r = center;
}
return false;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
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,
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,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
4,
13,
4,
18,
13,
13,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
0,
13,
17,
0,
13,
4,
18,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
4,
18,
13,
13,
13,
30,
29,
17,
14,
2,
13,
4,
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
],
[
176,
11
],
[
176,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
21,
23
],
[
14,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
14,
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
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
14,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
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
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
14,
78
],
[
78,
79
],
[
78,
80
],
[
14,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
81,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
97,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
12,
113
],
[
113,
114
],
[
176,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
120,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
117,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
134,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
143,
148
],
[
142,
149
],
[
149,
150
],
[
150,
151
],
[
134,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
152,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
152,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
117,
169
],
[
169,
170
],
[
115,
171
],
[
171,
172
],
[
115,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean binarySearch(int val, List<Integer> S) {\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}\n}\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\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean binarySearch(int val, List<Integer> S) {\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"List<Integer> T = new ArrayList<Integer>();",
"T",
"new ArrayList<Integer>()",
"List<Integer> S = new ArrayList<Integer>();",
"S",
"new ArrayList<Integer>()",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"for (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}",
"{\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}",
"int val = in.nextInt();",
"val",
"in.nextInt()",
"in.nextInt",
"in",
"S.add(val)",
"S.add",
"S",
"val",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"for (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}",
"{\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}",
"int val = in.nextInt();",
"val",
"in.nextInt()",
"in.nextInt",
"in",
"T.add(val)",
"T.add",
"T",
"val",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.size()",
"i",
"T.size()",
"T.size",
"T",
"i++",
"i++",
"i",
"{\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}",
"if (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}",
"binarySearch(T.get(i), S)",
"binarySearch",
"T.get(i)",
"T.get",
"T",
"i",
"S",
"{\n\t\t\t\tcnt++;\n\t\t\t}",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"static boolean binarySearch(int val, List<Integer> S) {\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}",
"binarySearch",
"{\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}",
"int left",
"left",
"right;",
"right",
"left = 0",
"left",
"0",
"right = S.size()",
"right",
"S.size()",
"S.size",
"S",
"while (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}",
"left < right",
"left",
"right",
"{\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}",
"int mid = (right + left)/2;",
"mid",
"(right + left)/2",
"(right + left)",
"right",
"left",
"2",
"if (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}",
"S.get(mid) == val",
"S.get(mid)",
"S.get",
"S",
"mid",
"val",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if (val < 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}",
"val < S.get(mid)",
"val",
"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",
"return false;",
"false",
"int val",
"val",
"List<Integer> S",
"S",
"public class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean binarySearch(int val, List<Integer> S) {\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}\n}",
"public class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tList<Integer> T = new ArrayList<Integer>();\n\t\tList<Integer> S = new ArrayList<Integer>();\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tS.add(val);\n\t\t}\n\t\tint q = in.nextInt();\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint val = in.nextInt();\n\t\t\tT.add(val);\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < T.size(); i++) {\n\t\t\tif (binarySearch(T.get(i), S)) {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\t\n\tstatic boolean binarySearch(int val, List<Integer> S) {\n\t\tint left, right;\n\t\t\n\t\tleft = 0;\n\t\tright = S.size();\n\t\twhile (left < right) {\n\t\t\tint mid = (right + left)/2;\n\t\t\tif (S.get(mid) == val) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (val < 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}\n\t\treturn false;\n\t}\n}",
"Main"
] | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<Integer> T = new ArrayList<Integer>();
List<Integer> S = new ArrayList<Integer>();
int n = in.nextInt();
for (int i = 0; i < n; i++) {
int val = in.nextInt();
S.add(val);
}
int q = in.nextInt();
for (int i = 0; i < q; i++) {
int val = in.nextInt();
T.add(val);
}
int cnt = 0;
for (int i = 0; i < T.size(); i++) {
if (binarySearch(T.get(i), S)) {
cnt++;
}
}
System.out.println(cnt);
}
static boolean binarySearch(int val, List<Integer> S) {
int left, right;
left = 0;
right = S.size();
while (left < right) {
int mid = (right + left)/2;
if (S.get(mid) == val) {
return true;
}
if (val < S.get(mid)) {
right = mid;
} else {
left = mid+1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
20,
2,
13,
17,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
20,
13,
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,
17,
13,
4,
18,
13,
13,
4,
18,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
29,
4,
13,
13,
13,
13,
13,
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,
6,
13,
41,
13,
20,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
13,
30,
28,
13,
4,
18,
4,
18,
13,
17,
30,
30,
14,
2,
13,
13,
30,
0,
18,
13,
40,
13,
4,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
204,
14
],
[
204,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
19,
20
],
[
15,
21
],
[
21,
22
],
[
204,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
29,
31
],
[
25,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
25,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
43,
44
],
[
43,
45
],
[
39,
46
],
[
25,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
25,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
54,
59
],
[
25,
60
],
[
60,
61
],
[
60,
62
],
[
25,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
78,
85
],
[
25,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
25,
90
],
[
90,
91
],
[
91,
92
],
[
204,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
95,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
95,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
116,
119
],
[
116,
120
],
[
116,
121
],
[
95,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
122,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
129,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
129,
136
],
[
95,
137
],
[
137,
138
],
[
93,
139
],
[
139,
140
],
[
93,
141
],
[
141,
142
],
[
93,
143
],
[
143,
144
],
[
93,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
160,
161
],
[
147,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
175,
180
],
[
173,
181
],
[
182,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
188,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
164,
197
],
[
197,
198
],
[
162,
199
],
[
199,
200
],
[
162,
201
],
[
201,
202
],
[
0,
203
],
[
203,
204
],
[
203,
205
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n \npublic class Main {\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n \n public void exec() throws IOException {\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }\n \n private int binarySearch(int[] S, int key, int from, int to) {\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }\n}\n\nclass SimpleInputUtil {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n public int readInt() throws NumberFormatException, IOException{\n return Integer.parseInt(br.readLine());\n }\n \n public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{\n int i=0;\n while(i<num) {\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }\n return a;\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.io.PrintWriter;",
"PrintWriter",
"java.io",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n \n public void exec() throws IOException {\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }\n \n private int binarySearch(int[] S, int key, int from, int to) {\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n new Main().exec();\n }",
"main",
"{\n new Main().exec();\n }",
"new Main().exec()",
"new Main().exec",
"new Main()",
"String[] args",
"args",
"public void exec() throws IOException {\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }",
"exec",
"{\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }",
"SimpleInputUtil in = new SimpleInputUtil();",
"in",
"new SimpleInputUtil()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n = in.readInt();",
"n",
"in.readInt()",
"in.readInt",
"in",
"int[] S = in.readIntArray(new int[n+1],n);",
"S",
"in.readIntArray(new int[n+1],n)",
"in.readIntArray",
"in",
"new int[n+1]",
"n+1",
"n",
"1",
"n",
"int q = in.readInt();",
"q",
"in.readInt()",
"in.readInt",
"in",
"int[] T = in.readIntArray(new int[q],q);",
"T",
"in.readIntArray(new int[q],q)",
"in.readIntArray",
"in",
"new int[q]",
"q",
"q",
"int C = 0;",
"C",
"0",
"for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \tC += binarySearch(S, T[i], 0, n);\n }",
"{\n \tC += binarySearch(S, T[i], 0, n);\n }",
"C += binarySearch(S, T[i], 0, n)",
"C",
"binarySearch(S, T[i], 0, n)",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"0",
"n",
"out.println(C)",
"out.println",
"out",
"C",
"out.flush()",
"out.flush",
"out",
"private int binarySearch(int[] S, int key, int from, int to) {\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }",
"binarySearch",
"{\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }",
"if(from == to) return 0;",
"from == to",
"from",
"to",
"return 0;",
"0",
"int mid = (from + to) /2;",
"mid",
"(from + to) /2",
"(from + to)",
"from",
"to",
"2",
"if (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);",
"key < S[mid]",
"key",
"S[mid]",
"S",
"mid",
"return binarySearch(S,key,from,mid);",
"binarySearch(S,key,from,mid)",
"binarySearch",
"S",
"key",
"from",
"mid",
"if (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);",
"S[mid] < key",
"S[mid]",
"S",
"mid",
"key",
"return binarySearch(S,key,mid+1,to);",
"binarySearch(S,key,mid+1,to)",
"binarySearch",
"S",
"key",
"mid+1",
"mid",
"1",
"to",
"return 1;",
"1",
"int[] S",
"S",
"int key",
"key",
"int from",
"from",
"int to",
"to",
"class SimpleInputUtil {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n public int readInt() throws NumberFormatException, IOException{\n return Integer.parseInt(br.readLine());\n }\n \n public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{\n int i=0;\n while(i<num) {\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }\n return a;\n }\n \n \n}",
"SimpleInputUtil",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"public int readInt() throws NumberFormatException, IOException{\n return Integer.parseInt(br.readLine());\n }",
"readInt",
"{\n return Integer.parseInt(br.readLine());\n }",
"return Integer.parseInt(br.readLine());",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{\n int i=0;\n while(i<num) {\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }\n return a;\n }",
"readIntArray",
"{\n int i=0;\n while(i<num) {\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }\n return a;\n }",
"int i=0;",
"i",
"0",
"while(i<num) {\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }",
"i<num",
"i",
"num",
"{\n for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }\n }",
"for(String s: br.readLine().split(\" \")){\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }",
"String s",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"{\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }",
"{\n if(i<num) {\n a[i++] = Integer.parseInt(s);\n }\n }",
"if(i<num) {\n a[i++] = Integer.parseInt(s);\n }",
"i<num",
"i",
"num",
"{\n a[i++] = Integer.parseInt(s);\n }",
"a[i++] = Integer.parseInt(s)",
"a[i++]",
"a",
"i++",
"i",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"return a;",
"a",
"int[] a",
"a",
"int num",
"num",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n \n public void exec() throws IOException {\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }\n \n private int binarySearch(int[] S, int key, int from, int to) {\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }\n}",
"public class Main {\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n \n public void exec() throws IOException {\n SimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.readInt();\n int[] S = in.readIntArray(new int[n+1],n);\n int q = in.readInt();\n int[] T = in.readIntArray(new int[q],q);\n int C = 0;\n for(int i=0; i<q; i++) {\n \tC += binarySearch(S, T[i], 0, n);\n }\n out.println(C);\n out.flush();\n }\n \n private int binarySearch(int[] S, int key, int from, int to) {\n \tif(from == to) return 0;\n\t\tint mid = (from + to) /2;\n\t\tif (key < S[mid]) \n \t\treturn binarySearch(S,key,from,mid);\n\t\tif (S[mid] < key)\n\t\t\treturn binarySearch(S,key,mid+1,to);\n\t\treturn 1;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
new Main().exec();
}
public void exec() throws IOException {
SimpleInputUtil in = new SimpleInputUtil();
PrintWriter out = new PrintWriter(System.out);
int n = in.readInt();
int[] S = in.readIntArray(new int[n+1],n);
int q = in.readInt();
int[] T = in.readIntArray(new int[q],q);
int C = 0;
for(int i=0; i<q; i++) {
C += binarySearch(S, T[i], 0, n);
}
out.println(C);
out.flush();
}
private int binarySearch(int[] S, int key, int from, int to) {
if(from == to) return 0;
int mid = (from + to) /2;
if (key < S[mid])
return binarySearch(S,key,from,mid);
if (S[mid] < key)
return binarySearch(S,key,mid+1,to);
return 1;
}
}
class SimpleInputUtil {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public int readInt() throws NumberFormatException, IOException{
return Integer.parseInt(br.readLine());
}
public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{
int i=0;
while(i<num) {
for(String s: br.readLine().split(" ")){
if(i<num) {
a[i++] = Integer.parseInt(s);
}
}
}
return a;
}
} |
[
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,
14,
2,
13,
17,
30,
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,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
18,
13,
2,
13,
17,
30,
11,
1,
41,
13,
2,
2,
13,
17,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
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
],
[
184,
5
],
[
184,
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
],
[
49,
51
],
[
48,
52
],
[
52,
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
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
48,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
122,
131
],
[
131,
132
],
[
131,
133
],
[
122,
134
],
[
134,
135
],
[
135,
136
],
[
122,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
113,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
150,
160
],
[
160,
161
],
[
161,
162
],
[
150,
163
],
[
164,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
8,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
6,
181
],
[
181,
182
],
[
0,
183
],
[
183,
184
],
[
183,
185
]
] | [
"import java.util.Scanner;\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 if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }\n }\n System.out.println(cnt);\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]=sc.nextInt();\n int q=sc.nextInt();\n int cnt=0;\n if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\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 if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\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 if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\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",
"if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }\n }",
"n<10",
"n",
"10",
"{\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }",
"for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }",
"{\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }",
"int t=sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(t==s[j]){\n cnt++;\n break;\n }\n }",
"{\n if(t==s[j]){\n cnt++;\n break;\n }\n }",
"if(t==s[j]){\n cnt++;\n break;\n }",
"t==s[j]",
"t",
"s[j]",
"s",
"j",
"{\n cnt++;\n break;\n }",
"cnt++",
"cnt",
"break;",
"{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }\n }",
"for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }",
"{\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }",
"int t=sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }",
"t>s[n/2]",
"t",
"s[n/2]",
"s",
"n/2",
"n",
"2",
"{\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }",
"for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"int k=n/2+1;",
"int k=n/2+1;",
"k",
"n/2+1",
"n/2",
"n",
"2",
"1",
"k<n",
"k",
"n",
"k++",
"k++",
"k",
"{\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"{\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"if(t==s[k]){\n cnt++;\n break;\n }",
"t==s[k]",
"t",
"s[k]",
"s",
"k",
"{\n cnt++;\n break;\n }",
"cnt++",
"cnt",
"break;",
"{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }",
"for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<=n/2",
"k",
"n/2",
"n",
"2",
"k++",
"k++",
"k",
"{\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"{\n if(t==s[k]){\n cnt++;\n break;\n }\n }",
"if(t==s[k]){\n cnt++;\n break;\n }",
"t==s[k]",
"t",
"s[k]",
"s",
"k",
"{\n cnt++;\n break;\n }",
"cnt++",
"cnt",
"break;",
"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 if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\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 if(n<10){\n for(int i=0;i<q;i++){\n int t=sc.nextInt();\n for(int j=0;j<n;j++){\n if(t==s[j]){\n cnt++;\n break;\n }\n }\n }\n }else{\n for(int j=0;j<q;j++){\n int t=sc.nextInt();\n if(t>s[n/2]){\n for(int k=n/2+1;k<n;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }else{\n for(int k=0;k<=n/2;k++){\n if(t==s[k]){\n cnt++;\n break;\n }\n }\n }\n }\n }\n System.out.println(cnt);\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 cnt=0;
if(n<10){
for(int i=0;i<q;i++){
int t=sc.nextInt();
for(int j=0;j<n;j++){
if(t==s[j]){
cnt++;
break;
}
}
}
}else{
for(int j=0;j<q;j++){
int t=sc.nextInt();
if(t>s[n/2]){
for(int k=n/2+1;k<n;k++){
if(t==s[k]){
cnt++;
break;
}
}
}else{
for(int k=0;k<=n/2;k++){
if(t==s[k]){
cnt++;
break;
}
}
}
}
}
System.out.println(cnt);
}
}
|
[
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,
2,
13,
17,
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,
41,
13,
17,
41,
13,
13,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
17,
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,
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
],
[
55,
56
],
[
55,
57
],
[
11,
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
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
11,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
90,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
106,
113
],
[
113,
114
],
[
113,
115
],
[
106,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
106,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
123,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
135,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
147,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
11,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
9,
167
],
[
167,
168
]
] | [
"import java.io.IOException;\nimport java.util.Scanner;\nclass Main{\n\tpublic static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint finded = 0;\n\t\tint lineSamount = scan.nextInt();\n\t\tint[] lineSnum = new int[lineSamount];\n\t\tfor(int i=0; i<lineSamount; i++){\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}\n\t\tint lineTamount = scan.nextInt();\n\t\tint[] lineTnum = new int[lineTamount+1];\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}\n\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}\n\t\tSystem.out.println(finded);\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\tpublic static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint finded = 0;\n\t\tint lineSamount = scan.nextInt();\n\t\tint[] lineSnum = new int[lineSamount];\n\t\tfor(int i=0; i<lineSamount; i++){\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}\n\t\tint lineTamount = scan.nextInt();\n\t\tint[] lineTnum = new int[lineTamount+1];\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}\n\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}\n\t\tSystem.out.println(finded);\n\t}\n}",
"Main",
"public static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint finded = 0;\n\t\tint lineSamount = scan.nextInt();\n\t\tint[] lineSnum = new int[lineSamount];\n\t\tfor(int i=0; i<lineSamount; i++){\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}\n\t\tint lineTamount = scan.nextInt();\n\t\tint[] lineTnum = new int[lineTamount+1];\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}\n\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}\n\t\tSystem.out.println(finded);\n\t}",
"main",
"{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint finded = 0;\n\t\tint lineSamount = scan.nextInt();\n\t\tint[] lineSnum = new int[lineSamount];\n\t\tfor(int i=0; i<lineSamount; i++){\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}\n\t\tint lineTamount = scan.nextInt();\n\t\tint[] lineTnum = new int[lineTamount+1];\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}\n\n\t\tfor(int i=0; i<lineTamount; i++){\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}\n\t\tSystem.out.println(finded);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int finded = 0;",
"finded",
"0",
"int lineSamount = scan.nextInt();",
"lineSamount",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] lineSnum = new int[lineSamount];",
"lineSnum",
"new int[lineSamount]",
"lineSamount",
"for(int i=0; i<lineSamount; i++){\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<lineSamount",
"i",
"lineSamount",
"i++",
"i++",
"i",
"{\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tlineSnum[i] = scan.nextInt();\n\t\t}",
"lineSnum[i] = scan.nextInt()",
"lineSnum[i]",
"lineSnum",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int lineTamount = scan.nextInt();",
"lineTamount",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] lineTnum = new int[lineTamount+1];",
"lineTnum",
"new int[lineTamount+1]",
"lineTamount+1",
"lineTamount",
"1",
"for(int i=0; i<lineTamount; i++){\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<lineTamount",
"i",
"lineTamount",
"i++",
"i++",
"i",
"{\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tlineTnum[i] = scan.nextInt();\n\t\t}",
"lineTnum[i] = scan.nextInt()",
"lineTnum[i]",
"lineTnum",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i=0; i<lineTamount; i++){\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<lineTamount",
"i",
"lineTamount",
"i++",
"i++",
"i",
"{\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}",
"{\n\t\t\tint left = 0 ;\n\t\t\tint right = lineSamount;\n\t\t\tint mid = lineSamount / 2 ;\n\t\t\t\n\t\t\twhile(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}\n//\t\t\tSystem.out.println(\"ende\");\n\t\t}",
"int left = 0 ;",
"left",
"0",
"int right = lineSamount;",
"right",
"lineSamount",
"int mid = lineSamount / 2 ;",
"mid",
"lineSamount / 2",
"lineSamount",
"2",
"while(left<right){\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}",
"left<right",
"left",
"right",
"{\n\t\t\t\tint move = 0;\n\t\t\t\tint plusmove = 0;\n\t\t\t\tint minusmove = 1;\n//\t\t\t\tSystem.out.println(left+\" L R \"+right);/\n\t\t\t\tmid = (left+right)/2;\n\t\t\t\tif(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(\"mid = \"+mid);\n\t\t\t}",
"int move = 0;",
"move",
"0",
"int plusmove = 0;",
"plusmove",
"0",
"int minusmove = 1;",
"minusmove",
"1",
"mid = (left+right)/2",
"mid",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if(lineTnum[i] == lineSnum[mid]){\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}",
"lineTnum[i] == lineSnum[mid]",
"lineTnum[i]",
"lineTnum",
"i",
"lineSnum[mid]",
"lineSnum",
"mid",
"{\n//\t\t\t\t\tSystem.out.println(\"found!\");\n\t\t\t\t\tfinded++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"finded++",
"finded",
"break;",
"if(lineTnum[i] < lineSnum[mid]){\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t\telse if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}",
"lineTnum[i] < lineSnum[mid]",
"lineTnum[i]",
"lineTnum",
"i",
"lineSnum[mid]",
"lineSnum",
"mid",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"if(lineTnum[i] > lineSnum[mid]){\n\t\t\t\t\tleft = mid+1;\n\t\t\t\t}",
"lineTnum[i] > lineSnum[mid]",
"lineTnum[i]",
"lineTnum",
"i",
"lineSnum[mid]",
"lineSnum",
"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(finded)",
"System.out.println",
"System.out",
"System",
"System.out",
"finded",
"String[] args",
"args"
] | import java.io.IOException;
import java.util.Scanner;
class Main{
public static void main(String[] args)throws NumberFormatException, IOException{
// System.out.println(" ");
Scanner scan = new Scanner(System.in);
int finded = 0;
int lineSamount = scan.nextInt();
int[] lineSnum = new int[lineSamount];
for(int i=0; i<lineSamount; i++){
lineSnum[i] = scan.nextInt();
}
int lineTamount = scan.nextInt();
int[] lineTnum = new int[lineTamount+1];
for(int i=0; i<lineTamount; i++){
lineTnum[i] = scan.nextInt();
}
for(int i=0; i<lineTamount; i++){
int left = 0 ;
int right = lineSamount;
int mid = lineSamount / 2 ;
while(left<right){
int move = 0;
int plusmove = 0;
int minusmove = 1;
// System.out.println(left+" L R "+right);/
mid = (left+right)/2;
if(lineTnum[i] == lineSnum[mid]){
// System.out.println("found!");
finded++;
break;
}
else if(lineTnum[i] < lineSnum[mid]){
right = mid;
}
else if(lineTnum[i] > lineSnum[mid]){
left = mid+1;
}
// System.out.println("mid = "+mid);
}
// System.out.println("ende");
}
System.out.println(finded);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
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,
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
],
[
165,
5
],
[
165,
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
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
31,
32
],
[
31,
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
],
[
55,
56
],
[
8,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
62,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
65,
67
],
[
68,
69
],
[
68,
70
],
[
8,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
71,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
92,
93
],
[
8,
94
],
[
94,
95
],
[
94,
96
],
[
8,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
97,
108
],
[
109,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
109,
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
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
120,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
148,
150
],
[
140,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
8,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
6,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.util.Scanner;\n\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}\n}\n\n\n/*int n,k;\nScanner sc=new Scanner(System.in);\nn=Integer.parseInt();\nint tr[]=new int[n+1];*/",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}",
"main",
"{\n\t\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}",
"int i",
"i",
"j",
"j",
"n",
"n",
"h;",
"h",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n=Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int s[]=new int[n+1];",
"s",
"new int[n+1]",
"n+1",
"n",
"1",
"for(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"{\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}",
"s[i]=Integer.parseInt(sc.next())",
"s[i]",
"s",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int q=Integer.parseInt(sc.next());",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int t[]=new int[q+1];",
"t",
"new int[q+1]",
"q+1",
"q",
"1",
"for(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"{\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}",
"t[i]=Integer.parseInt(sc.next())",
"t[i]",
"t",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int count=0;",
"count",
"0",
"for(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}",
"{\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}",
"int a=0",
"a",
"0",
"b=n;",
"b",
"n",
"while(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}",
"a<b",
"a",
"b",
"{\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}",
"h=(a+b)/2",
"h",
"(a+b)/2",
"(a+b)",
"a",
"b",
"2",
"if (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"t[i] == s[h]",
"t[i]",
"t",
"i",
"s[h]",
"s",
"h",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;",
"t[i]<s[h]",
"t[i]",
"t",
"i",
"s[h]",
"s",
"h",
"b = h",
"b",
"h",
"a = h+1",
"a",
"h+1",
"h",
"1",
"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\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}\n}",
"public class Main{\n\n\tpublic static void main(String args[]){\n\t\tint i,j,n,h;\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=Integer.parseInt(sc.next());\n\t\tint s[]=new int[n+1];\n\t\tfor(i=0;i<n;i++){\n\t\t\ts[i]=Integer.parseInt(sc.next());\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint q=Integer.parseInt(sc.next());\n\t\tint t[]=new int[q+1];\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tt[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\t\n\t\tint count=0;\n\n\t\t\n\t\tfor(i=0;i<q;i++){\n\t\t\tint a=0,b=n;\n\t\t\t\n\t\n\t\t\twhile(a<b){\n\t\t\t\th=(a+b)/2;\n\t\t\t\tif (t[i] == s[h]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t\tif (t[i]<s[h])\n\t\t\t\t\t\n\t\t\t\t\tb = h;\n\t\t\t\telse \n\t\t\t\t\ta = h+1;\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(count);\t\t\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String args[]){
int i,j,n,h;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt(sc.next());
int s[]=new int[n+1];
for(i=0;i<n;i++){
s[i]=Integer.parseInt(sc.next());
}
int q=Integer.parseInt(sc.next());
int t[]=new int[q+1];
for(i=0;i<q;i++){
t[i]=Integer.parseInt(sc.next());
}
int count=0;
for(i=0;i<q;i++){
int a=0,b=n;
while(a<b){
h=(a+b)/2;
if (t[i] == s[h]){
count++;
break;
}
if (t[i]<s[h])
b = h;
else
a = h+1;
}
}
System.out.println(count);
}
}
/*int n,k;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt();
int tr[]=new int[n+1];*/ |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
14,
2,
13,
17,
30,
0,
13,
20,
29,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
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,
29,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
13,
41,
13,
4,
18,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
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,
13,
13,
30,
3,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
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
],
[
12,
13
],
[
10,
14
],
[
14,
15
],
[
10,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
18,
27
],
[
27,
28
],
[
10,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
10,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
42,
43
],
[
43,
44
],
[
10,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
50,
55
],
[
47,
56
],
[
56,
57
],
[
56,
58
],
[
47,
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
],
[
77,
80
],
[
80,
81
],
[
80,
82
],
[
47,
83
],
[
83,
84
],
[
45,
85
],
[
85,
86
],
[
10,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
87,
96
],
[
96,
97
],
[
0,
98
],
[
223,
99
],
[
223,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
102,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
112,
117
],
[
102,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
102,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
127,
132
],
[
102,
133
],
[
133,
134
],
[
133,
135
],
[
102,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
136,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
148,
154
],
[
154,
155
],
[
154,
156
],
[
148,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
148,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
166,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
174,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
174,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
188,
189
],
[
184,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
191,
195
],
[
190,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
190,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
203,
207
],
[
202,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
102,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
214,
219
],
[
100,
220
],
[
220,
221
],
[
0,
222
],
[
222,
223
],
[
222,
224
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\nclass Console {\n static Console instance;\n final BufferedReader reader;\n\n public static Console getInstance() {\n if (instance == null) {\n instance = new Console();\n }\n return instance;\n }\n \n public Console() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public int readInt() throws IOException {\n return Integer.parseInt(reader.readLine());\n }\n\n public int[] readLineNumbers(int n) throws IOException {\n String[] numStrings = reader.readLine().split(\" \");\n int[] result = new int[n];\n for (int i = 0;i < n;i++) {\n result[i] = Integer.parseInt(numStrings[i]);\n }\n return result;\n }\n \n public void output(int n) {\n System.out.println(n);\n }\n}\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Console {\n static Console instance;\n final BufferedReader reader;\n\n public static Console getInstance() {\n if (instance == null) {\n instance = new Console();\n }\n return instance;\n }\n \n public Console() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public int readInt() throws IOException {\n return Integer.parseInt(reader.readLine());\n }\n\n public int[] readLineNumbers(int n) throws IOException {\n String[] numStrings = reader.readLine().split(\" \");\n int[] result = new int[n];\n for (int i = 0;i < n;i++) {\n result[i] = Integer.parseInt(numStrings[i]);\n }\n return result;\n }\n \n public void output(int n) {\n System.out.println(n);\n }\n}",
"Console",
"static Console instance;",
"instance",
"final BufferedReader reader;",
"reader",
"public static Console getInstance() {\n if (instance == null) {\n instance = new Console();\n }\n return instance;\n }",
"getInstance",
"{\n if (instance == null) {\n instance = new Console();\n }\n return instance;\n }",
"if (instance == null) {\n instance = new Console();\n }",
"instance == null",
"instance",
"null",
"{\n instance = new Console();\n }",
"instance = new Console()",
"instance",
"new Console()",
"return instance;",
"instance",
"public Console() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n }",
"Console",
"{\n reader = new BufferedReader(new InputStreamReader(System.in));\n }",
"reader = new BufferedReader(new InputStreamReader(System.in))",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"public int readInt() throws IOException {\n return Integer.parseInt(reader.readLine());\n }",
"readInt",
"{\n return Integer.parseInt(reader.readLine());\n }",
"return Integer.parseInt(reader.readLine());",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"public int[] readLineNumbers(int n) throws IOException {\n String[] numStrings = reader.readLine().split(\" \");\n int[] result = new int[n];\n for (int i = 0;i < n;i++) {\n result[i] = Integer.parseInt(numStrings[i]);\n }\n return result;\n }",
"readLineNumbers",
"{\n String[] numStrings = reader.readLine().split(\" \");\n int[] result = new int[n];\n for (int i = 0;i < n;i++) {\n result[i] = Integer.parseInt(numStrings[i]);\n }\n return result;\n }",
"String[] numStrings = reader.readLine().split(\" \");",
"numStrings",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"int[] result = new int[n];",
"result",
"new int[n]",
"n",
"for (int i = 0;i < n;i++) {\n result[i] = Integer.parseInt(numStrings[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n result[i] = Integer.parseInt(numStrings[i]);\n }",
"{\n result[i] = Integer.parseInt(numStrings[i]);\n }",
"result[i] = Integer.parseInt(numStrings[i])",
"result[i]",
"result",
"i",
"Integer.parseInt(numStrings[i])",
"Integer.parseInt",
"Integer",
"numStrings[i]",
"numStrings",
"i",
"return result;",
"result",
"int n",
"n",
"public void output(int n) {\n System.out.println(n);\n }",
"output",
"{\n System.out.println(n);\n }",
"System.out.println(n)",
"System.out.println",
"System.out",
"System",
"System.out",
"n",
"int n",
"n",
"public class Main {\n public static void main(String[] args) throws Exception {\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }",
"main",
"{\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }",
"int n = Console.getInstance().readInt();",
"n",
"Console.getInstance().readInt()",
"Console.getInstance().readInt",
"Console.getInstance()",
"Console.getInstance",
"Console",
"int[] S = Console.getInstance().readLineNumbers(n);",
"S",
"Console.getInstance().readLineNumbers(n)",
"Console.getInstance().readLineNumbers",
"Console.getInstance()",
"Console.getInstance",
"Console",
"n",
"int q = Console.getInstance().readInt();",
"q",
"Console.getInstance().readInt()",
"Console.getInstance().readInt",
"Console.getInstance()",
"Console.getInstance",
"Console",
"int[] T = Console.getInstance().readLineNumbers(q);",
"T",
"Console.getInstance().readLineNumbers(q)",
"Console.getInstance().readLineNumbers",
"Console.getInstance()",
"Console.getInstance",
"Console",
"q",
"int count = 0;",
"count",
"0",
"for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }",
"{\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }",
"int t = T[i];",
"t",
"T[i]",
"T",
"i",
"int min = 0;",
"min",
"0",
"int max = n - 1;",
"max",
"n - 1",
"n",
"1",
"while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }",
"min <= max",
"min",
"max",
"{\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }",
"int index = (min + max) / 2;",
"index",
"(min + max) / 2",
"(min + max)",
"min",
"max",
"2",
"if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }",
"S[index] == t",
"S[index]",
"S",
"index",
"t",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }",
"min == max",
"min",
"max",
"{\n // not found\n break;\n }",
"break;",
"if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }",
"S[index] > t",
"S[index]",
"S",
"index",
"t",
"{\n max = index - 1;\n }",
"max = index - 1",
"max",
"index - 1",
"index",
"1",
"if (S[index] < t) {\n min = index + 1;\n }",
"S[index] < t",
"S[index]",
"S",
"index",
"t",
"{\n min = index + 1;\n }",
"min = index + 1",
"min",
"index + 1",
"index",
"1",
"Console.getInstance().output(count)",
"Console.getInstance().output",
"Console.getInstance()",
"Console.getInstance",
"Console",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n int n = Console.getInstance().readInt();\n int[] S = Console.getInstance().readLineNumbers(n);\n int q = Console.getInstance().readInt();\n int[] T = Console.getInstance().readLineNumbers(q);\n \n int count = 0;\n for (int i = 0;i < q;i++) {\n int t = T[i];\n int min = 0;\n int max = n - 1;\n\n while (min <= max) {\n int index = (min + max) / 2;\n if (S[index] == t) {\n count++;\n break;\n } else if (min == max) {\n // not found\n break;\n } else if (S[index] > t) {\n max = index - 1;\n } else if (S[index] < t) {\n min = index + 1;\n }\n }\n }\n\n Console.getInstance().output(count);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Console {
static Console instance;
final BufferedReader reader;
public static Console getInstance() {
if (instance == null) {
instance = new Console();
}
return instance;
}
public Console() {
reader = new BufferedReader(new InputStreamReader(System.in));
}
public int readInt() throws IOException {
return Integer.parseInt(reader.readLine());
}
public int[] readLineNumbers(int n) throws IOException {
String[] numStrings = reader.readLine().split(" ");
int[] result = new int[n];
for (int i = 0;i < n;i++) {
result[i] = Integer.parseInt(numStrings[i]);
}
return result;
}
public void output(int n) {
System.out.println(n);
}
}
public class Main {
public static void main(String[] args) throws Exception {
int n = Console.getInstance().readInt();
int[] S = Console.getInstance().readLineNumbers(n);
int q = Console.getInstance().readInt();
int[] T = Console.getInstance().readLineNumbers(q);
int count = 0;
for (int i = 0;i < q;i++) {
int t = T[i];
int min = 0;
int max = n - 1;
while (min <= max) {
int index = (min + max) / 2;
if (S[index] == t) {
count++;
break;
} else if (min == max) {
// not found
break;
} else if (S[index] > t) {
max = index - 1;
} else if (S[index] < t) {
min = index + 1;
}
}
}
Console.getInstance().output(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
17,
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,
18,
13,
13,
13,
30,
0,
13,
13,
30,
0,
13,
40,
13,
29,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
14,
4,
13,
13,
13,
30,
40,
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
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
30,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
11,
62
],
[
62,
63
],
[
9,
64
],
[
64,
65
],
[
9,
66
],
[
66,
67
],
[
7,
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
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
70,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
87,
92
],
[
70,
93
],
[
93,
94
],
[
93,
95
],
[
70,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
102,
104
],
[
97,
105
],
[
105,
106
],
[
106,
107
],
[
97,
108
],
[
109,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
70,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
126,
127
],
[
70,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
130,
135
],
[
70,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
136,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
154,
155
],
[
154,
156
],
[
148,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
158,
161
],
[
157,
162
],
[
162,
163
],
[
163,
164
],
[
70,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
68,
171
],
[
171,
172
]
] | [
"import java.util.*;\nimport java.io.*;\n\nclass Main {\n static boolean binary(int key, int[] s) {\n int left = 0;\n int right = s.length;\n int mid = 0;\n int count = 0;\n while( left < right) {\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }\n return false;\n }\n public static void main(String...args)throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int count = 0;\n int sSize = Integer.parseInt(br.readLine());\n String[] sStr = br.readLine().split(\" \");\n int[] s = new int[sSize];\n for(int i = 0; i < sSize; i++) {\n s[i] = Integer.parseInt(sStr[i]);\n }\n\n int tSize = Integer.parseInt(br.readLine());\n String[] tStr = br.readLine().split(\" \");\n\n for(int n = 0; n < tSize; n++) {\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }\n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main {\n static boolean binary(int key, int[] s) {\n int left = 0;\n int right = s.length;\n int mid = 0;\n int count = 0;\n while( left < right) {\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }\n return false;\n }\n public static void main(String...args)throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int count = 0;\n int sSize = Integer.parseInt(br.readLine());\n String[] sStr = br.readLine().split(\" \");\n int[] s = new int[sSize];\n for(int i = 0; i < sSize; i++) {\n s[i] = Integer.parseInt(sStr[i]);\n }\n\n int tSize = Integer.parseInt(br.readLine());\n String[] tStr = br.readLine().split(\" \");\n\n for(int n = 0; n < tSize; n++) {\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }\n System.out.println(count);\n }\n}",
"Main",
"static boolean binary(int key, int[] s) {\n int left = 0;\n int right = s.length;\n int mid = 0;\n int count = 0;\n while( left < right) {\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }\n return false;\n }",
"binary",
"{\n int left = 0;\n int right = s.length;\n int mid = 0;\n int count = 0;\n while( left < right) {\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right = s.length;",
"right",
"s.length",
"s",
"s.length",
"int mid = 0;",
"mid",
"0",
"int count = 0;",
"count",
"0",
"while( left < right) {\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right)/2;\n if(s[mid] == key) {\n return true;\n }\n if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }\n }",
"mid = (left + right)/2",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(s[mid] == key) {\n return true;\n }",
"s[mid] == key",
"s[mid]",
"s",
"mid",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (s[mid] > key) {\n right = mid;\n } else {\n left = ++mid;\n }",
"s[mid] > key",
"s[mid]",
"s",
"mid",
"key",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"{\n left = ++mid;\n }",
"left = ++mid",
"left",
"++mid",
"mid",
"return false;",
"false",
"int key",
"key",
"int[] s",
"s",
"public static void main(String...args)throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int count = 0;\n int sSize = Integer.parseInt(br.readLine());\n String[] sStr = br.readLine().split(\" \");\n int[] s = new int[sSize];\n for(int i = 0; i < sSize; i++) {\n s[i] = Integer.parseInt(sStr[i]);\n }\n\n int tSize = Integer.parseInt(br.readLine());\n String[] tStr = br.readLine().split(\" \");\n\n for(int n = 0; n < tSize; n++) {\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }\n System.out.println(count);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int count = 0;\n int sSize = Integer.parseInt(br.readLine());\n String[] sStr = br.readLine().split(\" \");\n int[] s = new int[sSize];\n for(int i = 0; i < sSize; i++) {\n s[i] = Integer.parseInt(sStr[i]);\n }\n\n int tSize = Integer.parseInt(br.readLine());\n String[] tStr = br.readLine().split(\" \");\n\n for(int n = 0; n < tSize; n++) {\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\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 count = 0;",
"count",
"0",
"int sSize = Integer.parseInt(br.readLine());",
"sSize",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] sStr = br.readLine().split(\" \");",
"sStr",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] s = new int[sSize];",
"s",
"new int[sSize]",
"sSize",
"for(int i = 0; i < sSize; i++) {\n s[i] = Integer.parseInt(sStr[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < sSize",
"i",
"sSize",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(sStr[i]);\n }",
"{\n s[i] = Integer.parseInt(sStr[i]);\n }",
"s[i] = Integer.parseInt(sStr[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(sStr[i])",
"Integer.parseInt",
"Integer",
"sStr[i]",
"sStr",
"i",
"int tSize = Integer.parseInt(br.readLine());",
"tSize",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] tStr = br.readLine().split(\" \");",
"tStr",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int n = 0; n < tSize; n++) {\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }",
"int n = 0;",
"int n = 0;",
"n",
"0",
"n < tSize",
"n",
"tSize",
"n++",
"n++",
"n",
"{\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }",
"{\n int key = Integer.parseInt(tStr[n]);\n if(binary(key, s)) {\n count++;\n } \n }",
"int key = Integer.parseInt(tStr[n]);",
"key",
"Integer.parseInt(tStr[n])",
"Integer.parseInt",
"Integer",
"tStr[n]",
"tStr",
"n",
"if(binary(key, s)) {\n count++;\n }",
"binary(key, s)",
"binary",
"key",
"s",
"{\n count++;\n }",
"count++",
"count",
"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 boolean binary(int key, int[] s) {
int left = 0;
int right = s.length;
int mid = 0;
int count = 0;
while( left < right) {
mid = (left + right)/2;
if(s[mid] == key) {
return true;
}
if (s[mid] > key) {
right = mid;
} else {
left = ++mid;
}
}
return false;
}
public static void main(String...args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int count = 0;
int sSize = Integer.parseInt(br.readLine());
String[] sStr = br.readLine().split(" ");
int[] s = new int[sSize];
for(int i = 0; i < sSize; i++) {
s[i] = Integer.parseInt(sStr[i]);
}
int tSize = Integer.parseInt(br.readLine());
String[] tStr = br.readLine().split(" ");
for(int n = 0; n < tSize; n++) {
int key = Integer.parseInt(tStr[n]);
if(binary(key, s)) {
count++;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
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,
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,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
13,
18,
13,
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,
30,
40,
13,
29,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
168,
5
],
[
168,
6
],
[
6,
7
],
[
168,
8
],
[
8,
9
],
[
168,
10
],
[
10,
11
],
[
168,
12
],
[
12,
13
],
[
168,
14
],
[
14,
15
],
[
168,
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
],
[
27,
29
],
[
18,
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
],
[
18,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
18,
56
],
[
56,
57
],
[
56,
58
],
[
18,
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
],
[
18,
80
],
[
80,
81
],
[
81,
82
],
[
18,
83
],
[
83,
84
],
[
83,
85
],
[
18,
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
],
[
101,
102
],
[
101,
103
],
[
18,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
16,
110
],
[
110,
111
],
[
168,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
114,
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
],
[
139,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
143,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
112,
165
],
[
165,
166
],
[
0,
167
],
[
167,
168
],
[
167,
169
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tstatic int n;\n\tstatic int[] S;\n\tstatic int q;\n\tstatic int[] T;\n\tstatic int ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static void binarySearch(int num) {\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic int n;\n\tstatic int[] S;\n\tstatic int q;\n\tstatic int[] T;\n\tstatic int ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static void binarySearch(int num) {\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"static int n;",
"n",
"static int[] S;",
"S",
"static int q;",
"q",
"static int[] T;",
"T",
"static int ans;",
"ans",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"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\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 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",
"sc.close()",
"sc.close",
"sc",
"ans = 0",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tbinarySearch(T[i]);\n\t\t}",
"{\n\t\t\tbinarySearch(T[i]);\n\t\t}",
"binarySearch(T[i])",
"binarySearch",
"T[i]",
"T",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"private static void binarySearch(int num) {\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}",
"binarySearch",
"{\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\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 (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\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] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\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] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] == num",
"S[mid]",
"S",
"mid",
"num",
"{\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t}",
"ans++",
"ans",
"return;",
"if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] > num",
"S[mid]",
"S",
"mid",
"num",
"{\n\t\t\t\tright = mid;\n\t\t\t}",
"right = mid",
"right",
"mid",
"if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"S[mid] < num",
"S[mid]",
"S",
"mid",
"num",
"{\n\t\t\t\tleft = mid + 1;\n\t\t\t}",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"int num",
"num",
"public class Main {\n\n\tstatic int n;\n\tstatic int[] S;\n\tstatic int q;\n\tstatic int[] T;\n\tstatic int ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static void binarySearch(int num) {\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\n\tstatic int n;\n\tstatic int[] S;\n\tstatic int q;\n\tstatic int[] T;\n\tstatic int ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\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 i = 0; i < q; i++) {\n\t\t\tT[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tbinarySearch(T[i]);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static void binarySearch(int num) {\n\t\tint left = 0;\n\t\tint right = n;\n\n\t\twhile (left < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (S[mid] == num) {\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t} else if (S[mid] > num) {\n\t\t\t\tright = mid;\n\t\t\t} else if (S[mid] < num) {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int n;
static int[] S;
static int q;
static int[] T;
static int ans;
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();
}
sc.close();
ans = 0;
for (int i = 0; i < q; i++) {
binarySearch(T[i]);
}
System.out.println(ans);
}
private static void binarySearch(int num) {
int left = 0;
int right = n;
while (left < right) {
int mid = (left + right) / 2;
if (S[mid] == num) {
ans++;
return;
} else if (S[mid] > num) {
right = mid;
} else if (S[mid] < num) {
left = mid + 1;
}
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
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,
4,
18,
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,
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,
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
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
29,
30
],
[
30,
31
],
[
17,
32
],
[
32,
33
],
[
32,
34
],
[
17,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
41,
42
],
[
41,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
36,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
17,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
17,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
17,
69
],
[
69,
70
],
[
69,
71
],
[
17,
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
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
17,
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
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
105,
112
],
[
112,
113
],
[
112,
114
],
[
105,
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
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
127,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
144,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
139,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
17,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
15,
163
],
[
163,
164
]
] | [
"import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.Deque;\nimport java.util.ArrayDeque;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint answer = 0;\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint[] data1 = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}\n\t\tString nothing = scanner.nextLine();\n\n\t\tint q = Integer.parseInt(scanner.nextLine());\n\t\tint[] data2 = new int[q];\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < q; i++){\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Deque;",
"Deque",
"java.util",
"import java.util.ArrayDeque;",
"ArrayDeque",
"java.util",
"class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint answer = 0;\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint[] data1 = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}\n\t\tString nothing = scanner.nextLine();\n\n\t\tint q = Integer.parseInt(scanner.nextLine());\n\t\tint[] data2 = new int[q];\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < q; i++){\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint answer = 0;\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint[] data1 = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}\n\t\tString nothing = scanner.nextLine();\n\n\t\tint q = Integer.parseInt(scanner.nextLine());\n\t\tint[] data2 = new int[q];\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < q; i++){\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint answer = 0;\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint[] data1 = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}\n\t\tString nothing = scanner.nextLine();\n\n\t\tint q = Integer.parseInt(scanner.nextLine());\n\t\tint[] data2 = new int[q];\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < q; i++){\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int answer = 0;",
"answer",
"0",
"int n = Integer.parseInt(scanner.nextLine());",
"n",
"Integer.parseInt(scanner.nextLine())",
"Integer.parseInt",
"Integer",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"int[] data1 = new int[n];",
"data1",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tdata1[i] = scanner.nextInt();\n\t\t}",
"data1[i] = scanner.nextInt()",
"data1[i]",
"data1",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"String nothing = scanner.nextLine();",
"nothing",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"int q = Integer.parseInt(scanner.nextLine());",
"q",
"Integer.parseInt(scanner.nextLine())",
"Integer.parseInt",
"Integer",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"int[] data2 = new int[q];",
"data2",
"new int[q]",
"q",
"for(int i = 0; i < q; i++){\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tdata2[i] = scanner.nextInt();\n\t\t}",
"data2[i] = scanner.nextInt()",
"data2[i]",
"data2",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"for(int i = 0; i < q; i++){\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+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 int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t int left = 0;\n \t\tint right = n;\n \t\tint middle = 0;\n\t\t\twhile(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int middle = 0;",
"middle",
"0",
"while(left < right){\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t\tmiddle = (left + right) / 2;\n\n\t\t\t\tif(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}\n\t\t\t}",
"middle = (left + right) / 2",
"middle",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(data1[middle] == data2[i]){\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}",
"data1[middle] == data2[i]",
"data1[middle]",
"data1",
"middle",
"data2[i]",
"data2",
"i",
"{\n\t\t\t\t\tanswer ++;\n\t\t\t\t// \tSystem.out.println(data2[i]);\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"answer ++",
"answer",
"break;",
"if(data1[middle] > data2[i]){\n\t\t\t\t\tright = middle;\n\t\t\t\t}else{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}",
"data1[middle] > data2[i]",
"data1[middle]",
"data1",
"middle",
"data2[i]",
"data2",
"i",
"{\n\t\t\t\t\tright = middle;\n\t\t\t\t}",
"right = middle",
"right",
"middle",
"{\n\t\t\t\t\tleft = middle+1;\n\t\t\t\t}",
"left = middle+1",
"left",
"middle+1",
"middle",
"1",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args"
] | import java.util.Scanner;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int answer = 0;
int n = Integer.parseInt(scanner.nextLine());
int[] data1 = new int[n];
for(int i = 0; i < n; i++){
data1[i] = scanner.nextInt();
}
String nothing = scanner.nextLine();
int q = Integer.parseInt(scanner.nextLine());
int[] data2 = new int[q];
for(int i = 0; i < q; i++){
data2[i] = scanner.nextInt();
}
for(int i = 0; i < q; i++){
int left = 0;
int right = n;
int middle = 0;
while(left < right){
middle = (left + right) / 2;
if(data1[middle] == data2[i]){
answer ++;
// System.out.println(data2[i]);
break;
}else if(data1[middle] > data2[i]){
right = middle;
}else{
left = middle+1;
}
}
}
System.out.println(answer);
}
} |
[
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,
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
] | [
[
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
],
[
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
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
14,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
12,
151
],
[
151,
152
]
] | [
"\nimport 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 for(int i = 0; i < q ; i++ ){\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\n\n }\n\n System.out.println(answer);\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",
"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 for(int i = 0; i < q ; i++ ){\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\n\n }\n\n System.out.println(answer);\n\n\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 for(int i = 0; i < q ; i++ ){\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\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 for(int i = 0; i < q ; i++ ){\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\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 \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\n\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\n\n }",
"{\n \t for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }\n\n }",
"for(int j = 0; j < n ; j++ ){\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }",
"{\n \t\t if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }\n \t }",
"if( S[j] == T[i] ){\n \t\t\t answer++;\n \t\t\t break;\n \t\t }",
"S[j] == T[i]",
"S[j]",
"S",
"j",
"T[i]",
"T",
"i",
"{\n \t\t\t answer++;\n \t\t\t break;\n \t\t }",
"answer++",
"answer",
"break;",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String args[]",
"args"
] |
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++ ){
for(int j = 0; j < n ; j++ ){
if( S[j] == T[i] ){
answer++;
break;
}
}
}
System.out.println(answer);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
20,
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,
20,
41,
13,
4,
18,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
13,
4,
18,
20,
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,
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
],
[
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
],
[
19,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
19,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
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
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
8,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
56,
61
],
[
8,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
81,
84
],
[
84,
85
],
[
85,
86
],
[
80,
87
],
[
87,
88
],
[
88,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
162,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
100,
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
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
131,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
100,
155
],
[
155,
156
],
[
98,
157
],
[
157,
158
],
[
98,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}\n\n\tpublic static boolean search(int[] targetArray, int aaa) {\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}\n\n\tpublic static boolean search(int[] targetArray, int aaa) {\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}",
"main",
"{\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int arrayCnt = new Integer(s.nextLine()).intValue();",
"arrayCnt",
"new Integer(s.nextLine()).intValue()",
"new Integer(s.nextLine()).intValue",
"new Integer(s.nextLine())",
"String[] tmp = s.nextLine().split(\" \");",
"tmp",
"s.nextLine().split(\" \")",
"s.nextLine().split",
"s.nextLine()",
"s.nextLine",
"s",
"\" \"",
"int[] targetArray = new int[arrayCnt];",
"targetArray",
"new int[arrayCnt]",
"arrayCnt",
"for(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i < arrayCnt",
"i",
"arrayCnt",
"i++",
"i++",
"i",
"{\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}",
"{\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}",
"targetArray[i] = new Integer(tmp[i]).intValue()",
"targetArray[i]",
"targetArray",
"i",
"new Integer(tmp[i]).intValue()",
"new Integer(tmp[i]).intValue",
"new Integer(tmp[i])",
"int cnt = new Integer(s.nextLine()).intValue();",
"cnt",
"new Integer(s.nextLine()).intValue()",
"new Integer(s.nextLine()).intValue",
"new Integer(s.nextLine())",
"String[] aaa = s.nextLine().split(\" \");",
"aaa",
"s.nextLine().split(\" \")",
"s.nextLine().split",
"s.nextLine()",
"s.nextLine",
"s",
"\" \"",
"int existCnt = 0;",
"existCnt",
"0",
"for(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i<aaa.length",
"i",
"aaa.length",
"aaa",
"aaa.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}",
"if(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}",
"search(targetArray, new Integer(aaa[i]).intValue())",
"search",
"targetArray",
"new Integer(aaa[i]).intValue()",
"new Integer(aaa[i]).intValue",
"new Integer(aaa[i])",
"{\n\t\t\t\texistCnt++;\n\t\t\t}",
"existCnt++",
"existCnt",
"System.out.println(existCnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"existCnt",
"String[] args",
"args",
"public static boolean search(int[] targetArray, int aaa) {\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"search",
"{\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"int start = 0;",
"start",
"0",
"int end = targetArray.length-1;",
"end",
"targetArray.length-1",
"targetArray.length",
"targetArray",
"targetArray.length",
"1",
"while(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}",
"start <= end",
"start",
"end",
"{\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}",
"int mid = (start + end) / 2;",
"mid",
"(start + end) / 2",
"(start + end)",
"start",
"end",
"2",
"if(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}",
"targetArray[mid] == aaa",
"targetArray[mid]",
"targetArray",
"mid",
"aaa",
"return true;",
"true",
"if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}",
"targetArray[mid] < aaa",
"targetArray[mid]",
"targetArray",
"mid",
"aaa",
"{\n\t\t\t\tstart = mid + 1;\n\t\t\t}",
"start = mid + 1",
"start",
"mid + 1",
"mid",
"1",
"if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}",
"targetArray[mid] > aaa",
"targetArray[mid]",
"targetArray",
"mid",
"aaa",
"{\n\t\t\t\tend = mid - 1;\n\t\t\t}",
"end = mid - 1",
"end",
"mid - 1",
"mid",
"1",
"return false;",
"false",
"int[] targetArray",
"targetArray",
"int aaa",
"aaa",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}\n\n\tpublic static boolean search(int[] targetArray, int aaa) {\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = 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) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint arrayCnt = new Integer(s.nextLine()).intValue();\n\t\tString[] tmp = s.nextLine().split(\" \");\n\t\tint[] targetArray = new int[arrayCnt];\n\t\tfor(int i=0 ; i < arrayCnt ; i++) {\n\t\t\ttargetArray[i] = new Integer(tmp[i]).intValue();\n\t\t}\n\n\t\tint cnt = new Integer(s.nextLine()).intValue();\n\t\tString[] aaa = s.nextLine().split(\" \");\n\t\tint existCnt = 0;\n\t\tfor(int i=0 ; i<aaa.length ; i++) {\n\t\t\tif(search(targetArray, new Integer(aaa[i]).intValue())) {\n\t\t\t\texistCnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(existCnt);\n\t}\n\n\tpublic static boolean search(int[] targetArray, int aaa) {\n\t\tint start = 0;\n\t\tint end = targetArray.length-1;\n\n\t\twhile(start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tif(targetArray[mid] == aaa)\n\t\t\t\treturn true;\n\t\t\telse if(targetArray[mid] < aaa) {\n\t\t\t\tstart = mid + 1;\n\t\t\t} else if(targetArray[mid] > aaa) {\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int arrayCnt = new Integer(s.nextLine()).intValue();
String[] tmp = s.nextLine().split(" ");
int[] targetArray = new int[arrayCnt];
for(int i=0 ; i < arrayCnt ; i++) {
targetArray[i] = new Integer(tmp[i]).intValue();
}
int cnt = new Integer(s.nextLine()).intValue();
String[] aaa = s.nextLine().split(" ");
int existCnt = 0;
for(int i=0 ; i<aaa.length ; i++) {
if(search(targetArray, new Integer(aaa[i]).intValue())) {
existCnt++;
}
}
System.out.println(existCnt);
}
public static boolean search(int[] targetArray, int aaa) {
int start = 0;
int end = targetArray.length-1;
while(start <= end) {
int mid = (start + end) / 2;
if(targetArray[mid] == aaa)
return true;
else if(targetArray[mid] < aaa) {
start = mid + 1;
} else if(targetArray[mid] > aaa) {
end = mid - 1;
}
}
return false;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
13,
41,
13,
42,
2,
2,
13,
13,
17,
30,
0,
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,
12,
13,
30,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
4,
13,
18,
13,
13,
40,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
195,
17
],
[
195,
18
],
[
18,
19
],
[
18,
20
],
[
195,
21
],
[
21,
22
],
[
21,
23
],
[
195,
24
],
[
24,
25
],
[
195,
26
],
[
26,
27
],
[
195,
28
],
[
28,
29
],
[
195,
30
],
[
30,
31
],
[
195,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
38,
40
],
[
34,
41
],
[
41,
42
],
[
34,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
57,
63
],
[
63,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
65,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
65,
76
],
[
76,
77
],
[
76,
78
],
[
34,
79
],
[
79,
80
],
[
80,
81
],
[
32,
82
],
[
82,
83
],
[
195,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
98,
99
],
[
86,
100
],
[
100,
101
],
[
100,
102
],
[
86,
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
],
[
124,
125
],
[
86,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
131,
132
],
[
132,
133
],
[
86,
134
],
[
134,
135
],
[
134,
136
],
[
86,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
138,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
158,
159
],
[
86,
160
],
[
160,
161
],
[
160,
162
],
[
86,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
168,
169
],
[
168,
170
],
[
163,
171
],
[
171,
172
],
[
172,
173
],
[
163,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
179,
181
],
[
176,
182
],
[
182,
183
],
[
175,
184
],
[
184,
185
],
[
86,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
186,
191
],
[
84,
192
],
[
192,
193
],
[
0,
194
],
[
194,
195
],
[
194,
196
]
] | [
"import java.util.*;\nimport java.io.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\n static final int N = 100000;\n static final int Q = 50000;\n static int n, q;\n static int s[], t[];\n\n public static int binary_search(int x) {\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }\n\n public static void main(String[] args) {\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import static java.util.Arrays.*;",
"import static java.util.Arrays.*;",
"import static java.util.Arrays.*;",
"import static java.util.Collections.*;",
"import static java.util.Collections.*;",
"import static java.util.Collections.*;",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"import static java.lang.Math.*;",
"public class Main {\n\n static final int N = 100000;\n static final int Q = 50000;\n static int n, q;\n static int s[], t[];\n\n public static int binary_search(int x) {\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }\n\n public static void main(String[] args) {\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }\n}",
"Main",
"static final int N = 100000;",
"N",
"100000",
"static final int Q = 50000;",
"Q",
"50000",
"static int n",
"n",
"q;",
"q",
"static int s[]",
"s",
"t[];",
"t",
"public static int binary_search(int x) {\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }",
"binary_search",
"{\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }",
"int l = 0;",
"l",
"0",
"int r = n;",
"r",
"n",
"int m;",
"m",
"while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }",
"r-l > 0",
"r-l",
"r",
"l",
"0",
"{\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }",
"m = (l+r)/2",
"m",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;",
"s[m] == x",
"s[m]",
"s",
"m",
"x",
"return m;",
"m",
"if (s[m] < x) \n l = m + 1;\n else\n r = m;",
"s[m] < x",
"s[m]",
"s",
"m",
"x",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"r = m",
"r",
"m",
"return -1;",
"-1",
"1",
"int x",
"x",
"public static void main(String[] args) {\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }",
"main",
"{\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }",
"int i;",
"i",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"s = new int[n]",
"s",
"new int[n]",
"n",
"for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());",
"i=0;",
"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",
"q = Integer.parseInt(sc.next())",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"t = new int[q]",
"t",
"new int[q]",
"q",
"for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"t[i] = Integer.parseInt(sc.next());",
"t[i] = Integer.parseInt(sc.next())",
"t[i]",
"t",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int res = 0;",
"res",
"0",
"for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"if (binary_search(t[i]) != -1)\n res++;",
"if (binary_search(t[i]) != -1)\n res++;",
"binary_search(t[i]) != -1",
"binary_search(t[i])",
"binary_search",
"t[i]",
"t",
"i",
"-1",
"1",
"res++",
"res",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\n static final int N = 100000;\n static final int Q = 50000;\n static int n, q;\n static int s[], t[];\n\n public static int binary_search(int x) {\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }\n\n public static void main(String[] args) {\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }\n}",
"public class Main {\n\n static final int N = 100000;\n static final int Q = 50000;\n static int n, q;\n static int s[], t[];\n\n public static int binary_search(int x) {\n int l = 0;\n int r = n;\n int m;\n while (r-l > 0) {\n m = (l+r)/2;\n if (s[m] == x)\n return m;\n else if (s[m] < x) \n l = m + 1;\n else\n r = m;\n }\n return -1;\n }\n\n public static void main(String[] args) {\n int i;\n Scanner sc = new Scanner(System.in); \n n = Integer.parseInt(sc.next());\n s = new int[n];\n for (i=0; i<n; i++)\n s[i] = Integer.parseInt(sc.next());\n\n q = Integer.parseInt(sc.next());\n t = new int[q];\n for (i=0; i<q; i++)\n t[i] = Integer.parseInt(sc.next());\n\n int res = 0;\n for (i=0; i<q; i++)\n if (binary_search(t[i]) != -1)\n res++;\n\n System.out.println(res);\n }\n}",
"Main"
] | import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
public class Main {
static final int N = 100000;
static final int Q = 50000;
static int n, q;
static int s[], t[];
public static int binary_search(int x) {
int l = 0;
int r = n;
int m;
while (r-l > 0) {
m = (l+r)/2;
if (s[m] == x)
return m;
else if (s[m] < x)
l = m + 1;
else
r = m;
}
return -1;
}
public static void main(String[] args) {
int i;
Scanner sc = new Scanner(System.in);
n = Integer.parseInt(sc.next());
s = new int[n];
for (i=0; i<n; i++)
s[i] = Integer.parseInt(sc.next());
q = Integer.parseInt(sc.next());
t = new int[q];
for (i=0; i<q; i++)
t[i] = Integer.parseInt(sc.next());
int res = 0;
for (i=0; i<q; i++)
if (binary_search(t[i]) != -1)
res++;
System.out.println(res);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
4,
18,
13,
17,
17,
41,
13,
17,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
2,
4,
18,
13,
17,
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
],
[
299,
11
],
[
299,
12
],
[
12,
13
],
[
12,
14
],
[
299,
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
],
[
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
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
43,
47
],
[
40,
48
],
[
18,
49
],
[
49,
50
],
[
49,
51
],
[
18,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
18,
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
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
74,
78
],
[
18,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
16,
85
],
[
85,
86
],
[
299,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
87,
95
],
[
95,
96
],
[
87,
97
],
[
97,
98
],
[
87,
99
],
[
99,
100
],
[
87,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
101,
109
],
[
109,
110
],
[
87,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
114,
119
],
[
119,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
125,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
147,
148
],
[
113,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
87,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
156,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
156,
170
],
[
170,
171
],
[
170,
172
],
[
156,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
178,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
156,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
87,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
193,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
193,
206
],
[
206,
207
],
[
206,
208
],
[
193,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
209,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
213,
218
],
[
218,
219
],
[
218,
220
],
[
220,
221
],
[
193,
222
],
[
222,
223
],
[
222,
224
],
[
193,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
225,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
236,
238
],
[
231,
239
],
[
239,
240
],
[
230,
241
],
[
241,
242
],
[
241,
243
],
[
230,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
246,
248
],
[
230,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
193,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
87,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
260,
261
],
[
261,
262
],
[
261,
263
],
[
260,
264
],
[
264,
265
],
[
265,
266
],
[
266,
267
],
[
265,
268
],
[
259,
269
],
[
269,
270
],
[
273,
271
],
[
283,
272
],
[
280,
273
],
[
273,
274
],
[
274,
275
],
[
274,
276
],
[
273,
277
],
[
277,
278
],
[
277,
279
],
[
280,
280
],
[
280,
281
],
[
280,
282
],
[
283,
283
],
[
283,
284
],
[
283,
285
],
[
273,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
257,
290
],
[
290,
291
],
[
87,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
0,
298
],
[
298,
299
],
[
298,
300
]
] | [
"/*\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n*/\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic class InputReader {\n\t private InputStream stream;\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t private SpaceCharFilter filter;\n\t \n\t public InputReader(InputStream stream) {\n\t this.stream = stream;\n\t }\n\t \n\t public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\t \n\t public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }\n\t \n\t public int nextInt() {\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public boolean isSpaceChar(int c) {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\t \n\t public interface SpaceCharFilter {\n\t public boolean isSpaceChar(int ch);\n\t }\n\t }\n\n\t\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 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 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 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 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 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 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.InputMismatchException;",
"InputMismatchException",
"java.util",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic class InputReader {\n\t private InputStream stream;\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t private SpaceCharFilter filter;\n\t \n\t public InputReader(InputStream stream) {\n\t this.stream = stream;\n\t }\n\t \n\t public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\t \n\t public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }\n\t \n\t public int nextInt() {\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public boolean isSpaceChar(int c) {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\t \n\t public interface SpaceCharFilter {\n\t public boolean isSpaceChar(int ch);\n\t }\n\t }\n\n\t\n}",
"Main",
"static int[] boo = new int[100000];",
"boo",
"new int[100000]",
"100000",
"public static void main(String[] args)throws Exception{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"InputReader sc = new InputReader(System.in);",
"sc",
"new InputReader(System.in)",
"int n = (sc.nextInt());",
"n",
"(sc.nextInt())",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"{\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}",
"boo[sc.nextInt()%100000] = 1",
"boo[sc.nextInt()%100000]",
"boo",
"sc.nextInt()%100000",
"sc.nextInt()",
"sc.nextInt",
"sc",
"100000",
"1",
"int ans = 0;",
"ans",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"{\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}",
"ans += boo[sc.nextInt()%100000]",
"ans",
"boo[sc.nextInt()%100000]",
"boo",
"sc.nextInt()%100000",
"sc.nextInt()",
"sc.nextInt",
"sc",
"100000",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static class InputReader {\n\t private InputStream stream;\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t private SpaceCharFilter filter;\n\t \n\t public InputReader(InputStream stream) {\n\t this.stream = stream;\n\t }\n\t \n\t public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\t \n\t public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }\n\t \n\t public int nextInt() {\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public boolean isSpaceChar(int c) {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\t \n\t public interface SpaceCharFilter {\n\t public boolean isSpaceChar(int ch);\n\t }\n\t }",
"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\t this.stream = stream;\n\t }",
"InputReader",
"{\n\t this.stream = stream;\n\t }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }",
"next",
"{\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }",
"if (numChars == -1)\n\t throw new InputMismatchException();",
"numChars == -1",
"numChars",
"-1",
"1",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }",
"curChar = 0",
"curChar",
"0",
"try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }",
"catch (IOException e) {\n\t throw new InputMismatchException();\n\t }",
"IOException e",
"{\n\t throw new InputMismatchException();\n\t }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n\t numChars = stream.read(buf);\n\t }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0)\n\t return -1;",
"numChars <= 0",
"numChars",
"0",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }",
"nextStr",
"{\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }",
"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\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t str.append((char)c);\n\t c = next();\n\t }",
"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\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }",
"nextInt",
"{\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }",
"int c = next();",
"c",
"next()",
"next",
"while (isSpaceChar(c))\n\t c = next();",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"c = next()",
"c",
"next()",
"next",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }",
"c == '-'",
"c",
"'-'",
"{\n\t sgn = -1;\n\t c = next();\n\t }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = next()",
"c",
"next()",
"next",
"int res = 0;",
"res",
"0",
"do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t }",
"if (c < '0' || c > '9')\n\t 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\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }",
"isSpaceChar",
"{\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }",
"if (filter != null)\n\t 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\t public boolean isSpaceChar(int ch);\n\t }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic class InputReader {\n\t private InputStream stream;\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t private SpaceCharFilter filter;\n\t \n\t public InputReader(InputStream stream) {\n\t this.stream = stream;\n\t }\n\t \n\t public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\t \n\t public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }\n\t \n\t public int nextInt() {\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public boolean isSpaceChar(int c) {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\t \n\t public interface SpaceCharFilter {\n\t public boolean isSpaceChar(int ch);\n\t }\n\t }\n\n\t\n}",
"public class Main {\n\tstatic int[] boo = new int[100000];\n\tpublic static void main(String[] args)throws Exception{\n\t//\t FastScanner sc = new FastScanner();\n\t\t InputReader sc = new InputReader(System.in);\n\t\t\n\t\tint n = (sc.nextInt());\n\t\t//String[] st = br.readLine().split(\" \");\n\t\t//boolean[] boo = new boolean[100000];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t//boo[Integer.parseInt(st[i])%100000] = 1;\n\t\t\tboo[sc.nextInt()%100000] = 1;\n\t\t}\n\t\t\n\t\tint ans = 0;\n\t\t//n = Integer.parseInt(br.readLine());\n\t\tn = sc.nextInt();\n\t\t//st = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n//\t\t\tans += boo[Integer.parseInt(st[i])%100000] ;\n\t\t\tans += boo[sc.nextInt()%100000] ;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tstatic class InputReader {\n\t private InputStream stream;\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t private SpaceCharFilter filter;\n\t \n\t public InputReader(InputStream stream) {\n\t this.stream = stream;\n\t }\n\t \n\t public int next() {\n\t if (numChars == -1)\n\t throw new InputMismatchException();\n\t if (curChar >= numChars) {\n\t curChar = 0;\n\t try {\n\t numChars = stream.read(buf);\n\t } catch (IOException e) {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\t \n\t public String nextStr() {\n\t int c = next();\n\t while(isSpaceChar(c)){c = next();}\n\t StringBuffer str = new StringBuffer();\n\t do{\n\t str.append((char)c);\n\t c = next();\n\t }while(!isSpaceChar(c));\n\t return str.toString();\n\t }\n\t \n\t public int nextInt() {\n\t int c = next();\n\t while (isSpaceChar(c))\n\t c = next();\n\t int sgn = 1;\n\t if (c == '-') {\n\t sgn = -1;\n\t c = next();\n\t }\n\t int res = 0;\n\t do {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = next();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public boolean isSpaceChar(int c) {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\t \n\t public interface SpaceCharFilter {\n\t public boolean isSpaceChar(int ch);\n\t }\n\t }\n\n\t\n}",
"Main"
] | /*
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
public class Main {
static int[] boo = new int[100000];
public static void main(String[] args)throws Exception{
// FastScanner sc = new FastScanner();
InputReader sc = new InputReader(System.in);
int n = (sc.nextInt());
//String[] st = br.readLine().split(" ");
//boolean[] boo = new boolean[100000];
for (int i = 0; i < n; i++) {
//boo[Integer.parseInt(st[i])%100000] = 1;
boo[sc.nextInt()%100000] = 1;
}
int ans = 0;
//n = Integer.parseInt(br.readLine());
n = sc.nextInt();
//st = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
// ans += boo[Integer.parseInt(st[i])%100000] ;
ans += boo[sc.nextInt()%100000] ;
}
System.out.println(ans);
}
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);
}
}
}
/*
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,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
18,
13,
13,
17,
30,
29,
17,
41,
13,
18,
13,
13,
41,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
29,
17,
14,
2,
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
],
[
190,
11
],
[
190,
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,
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
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
95,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
12,
110
],
[
110,
111
],
[
190,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
114,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
114,
133
],
[
133,
134
],
[
133,
135
],
[
114,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
114,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
145,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
145,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
165,
166
],
[
145,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
167,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
114,
183
],
[
183,
184
],
[
112,
185
],
[
185,
186
],
[
112,
187
],
[
187,
188
],
[
0,
189
],
[
189,
190
],
[
189,
191
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}\n\t\n\tpublic static int binarySearch(int[] arr, int target) {\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\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 IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}\n\t\n\tpublic static int binarySearch(int[] arr, int target) {\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}",
"main",
"{\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}",
"BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(reader.readLine());",
"n",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"String[] strArray = reader.readLine().split(\" \");",
"strArray",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"{\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"arr[i] = Integer.parseInt(strArray[i])",
"arr[i]",
"arr",
"i",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"int q = Integer.parseInt(reader.readLine());",
"q",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"strArray = reader.readLine().split(\" \")",
"strArray",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}",
"{\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}",
"ans += binarySearch(arr, Integer.parseInt(strArray[i]))",
"ans",
"binarySearch(arr, Integer.parseInt(strArray[i]))",
"binarySearch",
"arr",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public static int binarySearch(int[] arr, int target) {\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"binarySearch",
"{\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"if (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}",
"arr == null || arr.length == 0",
"arr == null",
"arr",
"null",
"arr.length == 0",
"arr.length",
"arr",
"arr.length",
"0",
"{\n\t\t\treturn 0;\n\t\t}",
"return 0;",
"0",
"int n = arr.length;",
"n",
"arr.length",
"arr",
"arr.length",
"int floor = 0;",
"floor",
"0",
"int ceiling = n - 1;",
"ceiling",
"n - 1",
"n",
"1",
"while (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}",
"floor <= ceiling",
"floor",
"ceiling",
"{\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}",
"int guessIdx = floor + (ceiling - floor) / 2;",
"guessIdx",
"floor + (ceiling - floor) / 2",
"floor",
"(ceiling - floor) / 2",
"(ceiling - floor)",
"ceiling",
"floor",
"2",
"int guessValue = arr[guessIdx];",
"guessValue",
"arr[guessIdx]",
"arr",
"guessIdx",
"if (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}",
"guessValue == target",
"guessValue",
"target",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}",
"guessValue < target",
"guessValue",
"target",
"{\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t}",
"floor = guessIdx + 1",
"floor",
"guessIdx + 1",
"guessIdx",
"1",
"{\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}",
"ceiling = guessIdx - 1",
"ceiling",
"guessIdx - 1",
"guessIdx",
"1",
"return 0;",
"0",
"int[] arr",
"arr",
"int target",
"target",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}\n\t\n\tpublic static int binarySearch(int[] arr, int target) {\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 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) throws IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] strArray = reader.readLine().split(\" \");\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint q = Integer.parseInt(reader.readLine());\n\t\tstrArray = reader.readLine().split(\" \");\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tans += binarySearch(arr, Integer.parseInt(strArray[i]));\n\t\t}\n\t\tSystem.out.println(ans);\t\t\n\t}\n\t\n\tpublic static int binarySearch(int[] arr, int target) {\n\t\t\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tint n = arr.length;\n\t\t\n\t\tint floor = 0;\n\t\tint ceiling = n - 1;\n\t\t\n\t\twhile (floor <= ceiling) {\n\t\t\tint guessIdx = floor + (ceiling - floor) / 2;\n\t\t\tint guessValue = arr[guessIdx];\n\t\t\tif (guessValue == target) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (guessValue < target) {\n\t\t\t\tfloor = guessIdx + 1;\n\t\t\t} else {\n\t\t\t\tceiling = guessIdx - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\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 reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
String[] strArray = reader.readLine().split(" ");
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = Integer.parseInt(strArray[i]);
}
int q = Integer.parseInt(reader.readLine());
strArray = reader.readLine().split(" ");
int ans = 0;
for (int i = 0; i < q; i++) {
ans += binarySearch(arr, Integer.parseInt(strArray[i]));
}
System.out.println(ans);
}
public static int binarySearch(int[] arr, int target) {
if (arr == null || arr.length == 0) {
return 0;
}
int n = arr.length;
int floor = 0;
int ceiling = n - 1;
while (floor <= ceiling) {
int guessIdx = floor + (ceiling - floor) / 2;
int guessValue = arr[guessIdx];
if (guessValue == target) {
return 1;
}
if (guessValue < target) {
floor = guessIdx + 1;
} else {
ceiling = guessIdx - 1;
}
}
return 0;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
0,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
2,
4,
18,
13,
17,
2,
13,
4,
18,
13,
2,
4,
18,
13,
17,
9,
4,
18,
13,
13,
0,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
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
],
[
118,
11
],
[
118,
12
],
[
12,
13
],
[
12,
14
],
[
118,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
17,
23
],
[
23,
24
],
[
17,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
17,
30
],
[
30,
31
],
[
30,
32
],
[
17,
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
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
53,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
63,
67
],
[
51,
68
],
[
45,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
17,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
17,
78
],
[
78,
79
],
[
78,
80
],
[
17,
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
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
17,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
17,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
113,
114
],
[
15,
115
],
[
115,
116
],
[
0,
117
],
[
117,
118
],
[
117,
119
]
] | [
"import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n } \n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n } \n}",
"Main",
"static final int INF = 1000000000;",
"INF",
"1000000000",
"public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n }",
"main",
"{ \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int n",
"n",
"q;",
"q",
"n = input.nextInt()",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"ArrayList<Integer> s = new ArrayList<Integer>();",
"s",
"new ArrayList<Integer>()",
"for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"{\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }",
"{\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }",
"int x = input.nextInt();",
"x",
"input.nextInt()",
"input.nextInt",
"input",
"if (s.size() > 0 && x == s.get(s.size() - 1)) continue;",
"s.size() > 0 && x == s.get(s.size() - 1)",
"s.size() > 0",
"s.size()",
"s.size",
"s",
"0",
"x == s.get(s.size() - 1)",
"x",
"s.get(s.size() - 1)",
"s.get",
"s",
"s.size() - 1",
"s.size()",
"s.size",
"s",
"1",
"continue;",
"s.add(x)",
"s.add",
"s",
"x",
"q = input.nextInt()",
"q",
"input.nextInt()",
"input.nextInt",
"input",
"ArrayList<Integer> t = new ArrayList<Integer>();",
"t",
"new ArrayList<Integer>()",
"for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"{\n int x = input.nextInt();\n t.add(x);\n }",
"{\n int x = input.nextInt();\n t.add(x);\n }",
"int x = input.nextInt();",
"x",
"input.nextInt()",
"input.nextInt",
"input",
"t.add(x)",
"t.add",
"t",
"x",
"s.retainAll(t)",
"s.retainAll",
"s",
"t",
"System.out.println(s.size())",
"System.out.println",
"System.out",
"System",
"System.out",
"s.size()",
"s.size",
"s",
"String[] args",
"args",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n } \n}",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n, q;\n n = input.nextInt();\n ArrayList<Integer> s = new ArrayList<Integer>();\n for (int i = 0; i < n; ++i) {\n int x = input.nextInt();\n if (s.size() > 0 && x == s.get(s.size() - 1)) continue;\n s.add(x);\n }\n q = input.nextInt();\n ArrayList<Integer> t = new ArrayList<Integer>();\n for (int i = 0; i < q; ++i) {\n int x = input.nextInt();\n t.add(x);\n }\n s.retainAll(t);\n System.out.println(s.size());\n } \n}",
"Main"
] | import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
static final int INF = 1000000000;
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(System.in);
int n, q;
n = input.nextInt();
ArrayList<Integer> s = new ArrayList<Integer>();
for (int i = 0; i < n; ++i) {
int x = input.nextInt();
if (s.size() > 0 && x == s.get(s.size() - 1)) continue;
s.add(x);
}
q = input.nextInt();
ArrayList<Integer> t = new ArrayList<Integer>();
for (int i = 0; i < q; ++i) {
int x = input.nextInt();
t.add(x);
}
s.retainAll(t);
System.out.println(s.size());
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
17,
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,
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,
18,
13,
13,
13,
2,
13,
18,
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,
2,
13,
17,
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
],
[
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
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
11,
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
],
[
71,
72
],
[
71,
73
],
[
60,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
75,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
74,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
104,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
104,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
11,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
4,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
126,
132
],
[
132,
133
]
] | [
"import java.util.*;\nclass Main{\n\tScanner sc= new Scanner(System.in);\n\tvoid aaaa(){\n\t\tint gundam=0;\n\t\tint n=sc.nextInt();\n\t\tint[] N=new int[n];\n\t\tfor(int i=0;i<n;i++)N[i]=sc.nextInt();\n\t\tint q=sc.nextInt();\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(gundam);\n\t}\n\tpublic static void main(String[]args){\n\t\tnew Main().aaaa();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tScanner sc= new Scanner(System.in);\n\tvoid aaaa(){\n\t\tint gundam=0;\n\t\tint n=sc.nextInt();\n\t\tint[] N=new int[n];\n\t\tfor(int i=0;i<n;i++)N[i]=sc.nextInt();\n\t\tint q=sc.nextInt();\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(gundam);\n\t}\n\tpublic static void main(String[]args){\n\t\tnew Main().aaaa();\n\t}\n}",
"Main",
"Scanner sc= new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"void aaaa(){\n\t\tint gundam=0;\n\t\tint n=sc.nextInt();\n\t\tint[] N=new int[n];\n\t\tfor(int i=0;i<n;i++)N[i]=sc.nextInt();\n\t\tint q=sc.nextInt();\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(gundam);\n\t}",
"aaaa",
"{\n\t\tint gundam=0;\n\t\tint n=sc.nextInt();\n\t\tint[] N=new int[n];\n\t\tfor(int i=0;i<n;i++)N[i]=sc.nextInt();\n\t\tint q=sc.nextInt();\n\t\tfor(int i=0;i<q;i++){\n\t\t\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(gundam);\n\t}",
"int gundam=0;",
"gundam",
"0",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] N=new int[n];",
"N",
"new int[n]",
"n",
"for(int i=0;i<n;i++)N[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"N[i]=sc.nextInt();",
"N[i]=sc.nextInt()",
"N[i]",
"N",
"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\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+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\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint Q=sc.nextInt();\n\t\t\tint L=0;\n\t\t\tint R=n-1;\n\t\t\twhile(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}\n\t\t}",
"int Q=sc.nextInt();",
"Q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int L=0;",
"L",
"0",
"int R=n-1;",
"R",
"n-1",
"n",
"1",
"while(N[L]<=Q&&Q<=N[R]){\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}",
"N[L]<=Q&&Q<=N[R]",
"N[L]<=Q",
"N[L]",
"N",
"L",
"Q",
"Q<=N[R]",
"Q",
"N[R]",
"N",
"R",
"{\n\t\t\t\tint cent=(L+R)/2;\n\t\t\t\tif(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;\n\t\t\t}",
"int cent=(L+R)/2;",
"cent",
"(L+R)/2",
"(L+R)",
"L",
"R",
"2",
"if(N[cent]==Q){\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;",
"N[cent]==Q",
"N[cent]",
"N",
"cent",
"Q",
"{\n\t\t\t\t\tgundam++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"gundam++",
"gundam",
"break;",
"if(N[cent]>Q)R=cent-1;\n\t\t\t\telse L=cent+1;",
"N[cent]>Q",
"N[cent]",
"N",
"cent",
"Q",
"R=cent-1",
"R",
"cent-1",
"cent",
"1",
"L=cent+1",
"L",
"cent+1",
"cent",
"1",
"System.out.println(gundam)",
"System.out.println",
"System.out",
"System",
"System.out",
"gundam",
"public static void main(String[]args){\n\t\tnew Main().aaaa();\n\t}",
"main",
"{\n\t\tnew Main().aaaa();\n\t}",
"new Main().aaaa()",
"new Main().aaaa",
"new Main()",
"String[]args",
"args"
] | import java.util.*;
class Main{
Scanner sc= new Scanner(System.in);
void aaaa(){
int gundam=0;
int n=sc.nextInt();
int[] N=new int[n];
for(int i=0;i<n;i++)N[i]=sc.nextInt();
int q=sc.nextInt();
for(int i=0;i<q;i++){
int Q=sc.nextInt();
int L=0;
int R=n-1;
while(N[L]<=Q&&Q<=N[R]){
int cent=(L+R)/2;
if(N[cent]==Q){
gundam++;
break;
}else if(N[cent]>Q)R=cent-1;
else L=cent+1;
}
}
System.out.println(gundam);
}
public static void main(String[]args){
new Main().aaaa();
}
} |
[
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,
4,
18,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
13,
13,
13,
40,
17,
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,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
29,
13,
14,
2,
18,
13,
13,
13,
30,
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
],
[
165,
5
],
[
165,
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
],
[
73,
74
],
[
8,
75
],
[
75,
76
],
[
75,
77
],
[
8,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
85,
88
],
[
84,
89
],
[
89,
90
],
[
83,
91
],
[
91,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
165,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
103,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
103,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
126,
132
],
[
132,
133
],
[
125,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
134,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
125,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
103,
157
],
[
157,
158
],
[
158,
159
],
[
101,
160
],
[
160,
161
],
[
101,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static int binarySearch(int[] ary, int target) {\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}\n\t\treturn -1;\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static int binarySearch(int[] ary, int target) {\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\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",
"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] = 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",
"sc.close()",
"sc.close",
"sc",
"int count = 0;",
"count",
"0",
"for(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}",
"int sagasu",
"t",
"{\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}",
"{\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}",
"if(binarySearch(s, sagasu) != -1) count++;",
"binarySearch(s, sagasu) != -1",
"binarySearch(s, sagasu)",
"binarySearch",
"s",
"sagasu",
"-1",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"private static int binarySearch(int[] ary, int target) {\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}\n\t\treturn -1;\n\t}",
"int low = 0;",
"low",
"0",
"int high = ary.length-1;",
"high",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"int mid = (low + high) / 2;",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"while(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}",
"low < high",
"low",
"high",
"{\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}",
"if(ary[mid] == target) return mid;",
"ary[mid] == target",
"ary[mid]",
"ary",
"mid",
"target",
"return mid;",
"mid",
"if(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}",
"ary[mid] < target",
"ary[mid]",
"ary",
"mid",
"target",
"{\n\t\t\t\tlow = mid + 1;\n\t\t\t}",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"{\n\t\t\t\thigh = mid;\n\t\t\t}",
"high = mid",
"high",
"mid",
"mid = (low + high) / 2",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"return -1;",
"-1",
"1",
"int[] ary",
"ary",
"int target",
"target",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static int binarySearch(int[] ary, int target) {\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\n\t\t}\n\t\treturn -1;\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] s = new int[n + 1];\t\t// ????????¨???????°?????????¨?????¨???????????????\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\t\tfor (int i = 0; i < q; i++) {\n\t\t\tt[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint count = 0;\n\t\tfor(int sagasu : t) {\n\t\t\tif(binarySearch(s, sagasu) != -1) count++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static int binarySearch(int[] ary, int target) {\n\t\tint low = 0;\n\t\tint high = ary.length-1;\n\t\tint mid = (low + high) / 2;\n\n\t\twhile(low < high) {\n\n\t\t\tif(ary[mid] == target) return mid;\n\n\t\t\tif(ary[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid;\n\t\t\t}\n\t\t\tmid = (low + high) / 2;\n\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);
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[] t = new int[q];
for (int i = 0; i < q; i++) {
t[i] = sc.nextInt();
}
sc.close();
int count = 0;
for(int sagasu : t) {
if(binarySearch(s, sagasu) != -1) count++;
}
System.out.println(count);
}
private static int binarySearch(int[] ary, int target) {
int low = 0;
int high = ary.length-1;
int mid = (low + high) / 2;
while(low < high) {
if(ary[mid] == target) return mid;
if(ary[mid] < target) {
low = mid + 1;
} else {
high = mid;
}
mid = (low + high) / 2;
}
return -1;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
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,
41,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
40,
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
],
[
94,
8
],
[
94,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
11,
19
],
[
19,
20
],
[
19,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
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
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
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
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
76,
80
],
[
75,
81
],
[
81,
82
],
[
74,
83
],
[
83,
84
],
[
11,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
9,
91
],
[
91,
92
],
[
0,
93
],
[
93,
94
],
[
93,
95
]
] | [
"import java.util.Arrays;\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 countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}\n\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\tScanner sc = new Scanner(System.in);\n\t\tint countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int countA",
"countA",
"countB",
"countB",
"sum=0;",
"sum",
"0",
"countA = sc.nextInt()",
"countA",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] s = new int[countA];",
"s",
"new int[countA]",
"countA",
"for(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<countA",
"i",
"countA",
"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",
"countB = sc.nextInt()",
"countB",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<countB",
"i",
"countB",
"i++",
"i++",
"i",
"{\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}",
"{\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}",
"int tmp = sc.nextInt();",
"tmp",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;",
"Arrays.binarySearch(s, tmp) > -1",
"Arrays.binarySearch(s, tmp)",
"Arrays.binarySearch",
"Arrays",
"s",
"tmp",
"-1",
"1",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint countA,countB,sum=0;\n\t\tcountA = sc.nextInt();\n\t\tint[] s = new int[countA];\n\t\tfor(int i=0; i<countA; i++) {\n\t\t\ts[i] = sc.nextInt();\n\t\t}\n\t\tcountB = sc.nextInt();\n\n\n\t\tfor(int i=0; i<countB; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif(Arrays.binarySearch(s, tmp) > -1)\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\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 countA,countB,sum=0;
countA = sc.nextInt();
int[] s = new int[countA];
for(int i=0; i<countA; i++) {
s[i] = sc.nextInt();
}
countB = sc.nextInt();
for(int i=0; i<countB; i++) {
int tmp = sc.nextInt();
if(Arrays.binarySearch(s, tmp) > -1)
sum++;
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
2,
13,
13,
17,
30,
14,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
13,
40,
13,
14,
2,
18,
13,
13,
13,
40,
13,
14,
2,
18,
13,
13,
13,
4,
13,
13,
13,
13,
4,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
0,
18,
13,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
0,
18,
13,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
18,
13,
13,
13,
4,
18,
13,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
17,
2,
13,
17,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
17,
18,
13,
13,
4,
18,
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
],
[
4,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
14,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
22,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
30,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
29,
41
],
[
41,
42
],
[
22,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
43,
49
],
[
49,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
51,
57
],
[
57,
58
],
[
57,
59
],
[
57,
60
],
[
57,
61
],
[
51,
62
],
[
62,
63
],
[
62,
64
],
[
62,
65
],
[
62,
66
],
[
12,
67
],
[
67,
68
],
[
12,
69
],
[
69,
70
],
[
12,
71
],
[
71,
72
],
[
0,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
77,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
77,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
77,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
108,
114
],
[
114,
115
],
[
115,
116
],
[
77,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
77,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
77,
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
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
141,
147
],
[
147,
148
],
[
148,
149
],
[
77,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
77,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
160,
161
],
[
160,
162
],
[
155,
163
],
[
163,
164
],
[
164,
165
],
[
155,
166
],
[
167,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
168,
172
],
[
172,
173
],
[
172,
174
],
[
168,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
77,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
180,
185
],
[
180,
186
],
[
186,
187
],
[
186,
188
],
[
77,
189
],
[
189,
190
],
[
190,
191
],
[
75,
192
],
[
192,
193
]
] | [
"import java.util.Scanner;\n\nclass Solve{\n\tpublic int s[];\n\tpublic int t[];\n\tpublic int count;\n\tpublic void binary(int left,int right,int num){\n\t\tint mid = (left + right) / 2;\n\t\tif(right - left <= 1) {\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}\n\t\telse if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);\n\t}\n}\n\nclass Main{//一部全探索の問題のコードを使用\n\tpublic static void main(String[] args) \t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tSolve sv = new Solve();\n\t\t//prepare s\n\t\tint n = sc.nextInt();\n\t\tsv.s = new int[n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}\n\t\t//prepare t\n\t\tint q = sc.nextInt();\n\t\tsv.t = new int[q];\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}\n\t\t//find and count\n\t\tsv.count = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}\n\t\t//print\n\t\tSystem.out.printf(\"%d\\n\",sv.count);\n\t\tsc.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Solve{\n\tpublic int s[];\n\tpublic int t[];\n\tpublic int count;\n\tpublic void binary(int left,int right,int num){\n\t\tint mid = (left + right) / 2;\n\t\tif(right - left <= 1) {\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}\n\t\telse if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);\n\t}\n}",
"Solve",
"public int s[];",
"s",
"public int t[];",
"t",
"public int count;",
"count",
"public void binary(int left,int right,int num){\n\t\tint mid = (left + right) / 2;\n\t\tif(right - left <= 1) {\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}\n\t\telse if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);\n\t}",
"binary",
"{\n\t\tint mid = (left + right) / 2;\n\t\tif(right - left <= 1) {\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}\n\t\telse if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);\n\t}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(right - left <= 1) {\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}\n\t\telse if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);",
"right - left <= 1",
"right - left",
"right",
"left",
"1",
"{\n\t\t\tif(s[right] == num || s[left] == num) count++;\n\t\t}",
"if(s[right] == num || s[left] == num) count++;",
"s[right] == num || s[left] == num",
"s[right] == num",
"s[right]",
"s",
"right",
"num",
"s[left] == num",
"s[left]",
"s",
"left",
"num",
"count++",
"count",
"if(s[mid] == num) count++;\n\t\telse if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);",
"s[mid] == num",
"s[mid]",
"s",
"mid",
"num",
"count++",
"count",
"if(s[mid] < num) binary(mid,right,num);\n\t\telse binary(left,mid,num);",
"s[mid] < num",
"s[mid]",
"s",
"mid",
"num",
"binary(mid,right,num)",
"binary",
"mid",
"right",
"num",
"binary(left,mid,num)",
"binary",
"left",
"mid",
"num",
"int left",
"left",
"int right",
"right",
"int num",
"num",
"class Main{//一部全探索の問題のコードを使用\n\tpublic static void main(String[] args) \t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tSolve sv = new Solve();\n\t\t//prepare s\n\t\tint n = sc.nextInt();\n\t\tsv.s = new int[n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}\n\t\t//prepare t\n\t\tint q = sc.nextInt();\n\t\tsv.t = new int[q];\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}\n\t\t//find and count\n\t\tsv.count = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}\n\t\t//print\n\t\tSystem.out.printf(\"%d\\n\",sv.count);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) \t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tSolve sv = new Solve();\n\t\t//prepare s\n\t\tint n = sc.nextInt();\n\t\tsv.s = new int[n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}\n\t\t//prepare t\n\t\tint q = sc.nextInt();\n\t\tsv.t = new int[q];\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}\n\t\t//find and count\n\t\tsv.count = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}\n\t\t//print\n\t\tSystem.out.printf(\"%d\\n\",sv.count);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tSolve sv = new Solve();\n\t\t//prepare s\n\t\tint n = sc.nextInt();\n\t\tsv.s = new int[n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}\n\t\t//prepare t\n\t\tint q = sc.nextInt();\n\t\tsv.t = new int[q];\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}\n\t\t//find and count\n\t\tsv.count = 0;\n\t\tfor(int i = 0;i < q;i++) {\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}\n\t\t//print\n\t\tSystem.out.printf(\"%d\\n\",sv.count);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Solve sv = new Solve();",
"sv",
"new Solve()",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sv.s = new int[n]",
"sv.s",
"sv",
"sv.s",
"new int[n]",
"n",
"for(int i = 0;i < n;i++) {\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tsv.s[i] = sc.nextInt();\n\t\t}",
"sv.s[i] = sc.nextInt()",
"sv.s[i]",
"sv.s",
"sv",
"sv.s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sv.t = new int[q]",
"sv.t",
"sv",
"sv.t",
"new int[q]",
"q",
"for(int i = 0;i < q;i++) {\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tsv.t[i] = sc.nextInt();\n\t\t}",
"sv.t[i] = sc.nextInt()",
"sv.t[i]",
"sv.t",
"sv",
"sv.t",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sv.count = 0",
"sv.count",
"sv",
"sv.count",
"0",
"for(int i = 0;i < q;i++) {\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}",
"{\n\t\t\tsv.binary(0,n - 1,sv.t[i]);\n\t\t}",
"sv.binary(0,n - 1,sv.t[i])",
"sv.binary",
"sv",
"0",
"n - 1",
"n",
"1",
"sv.t[i]",
"sv.t",
"sv",
"sv.t",
"i",
"System.out.printf(\"%d\\n\",sv.count)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"sv.count",
"sv",
"sv.count",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args"
] | import java.util.Scanner;
class Solve{
public int s[];
public int t[];
public int count;
public void binary(int left,int right,int num){
int mid = (left + right) / 2;
if(right - left <= 1) {
if(s[right] == num || s[left] == num) count++;
}
else if(s[mid] == num) count++;
else if(s[mid] < num) binary(mid,right,num);
else binary(left,mid,num);
}
}
class Main{//一部全探索の問題のコードを使用
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Solve sv = new Solve();
//prepare s
int n = sc.nextInt();
sv.s = new int[n];
for(int i = 0;i < n;i++) {
sv.s[i] = sc.nextInt();
}
//prepare t
int q = sc.nextInt();
sv.t = new int[q];
for(int i = 0;i < q;i++) {
sv.t[i] = sc.nextInt();
}
//find and count
sv.count = 0;
for(int i = 0;i < q;i++) {
sv.binary(0,n - 1,sv.t[i]);
}
//print
System.out.printf("%d\n",sv.count);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
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,
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,
17,
28,
13,
13,
30,
14,
2,
4,
13,
13,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
40,
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,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
13,
29,
17,
23,
13,
23,
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
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
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
],
[
11,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
11,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
11,
68
],
[
68,
69
],
[
68,
70
],
[
11,
71
],
[
71,
72
],
[
71,
73
],
[
71,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
77,
80
],
[
76,
81
],
[
75,
82
],
[
82,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
4,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
92,
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
],
[
117,
123
],
[
123,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
125,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
125,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
142,
144
],
[
92,
145
],
[
145,
146
],
[
90,
147
],
[
147,
148
],
[
90,
149
],
[
149,
150
],
[
4,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
151,
157
],
[
157,
158
]
] | [
"import java.util.*;\n\nclass Main {\n\n\tstatic Scanner in = new Scanner(System.in);\n\n void solve() {\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; i++) s[i] = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; i++) t[i] = in.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i : t) if(serch(s, i) > 0) ans++;\n\t\tSystem.out.println(ans);\n\t}\n\n\tint serch(int[] a, int n){\n\t\tint left = 0;\n\t\tint right = a.length;\n\t\tint mid = -1;\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}\n\t\treturn 0;\n\t}\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\n\tstatic Scanner in = new Scanner(System.in);\n\n void solve() {\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; i++) s[i] = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; i++) t[i] = in.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i : t) if(serch(s, i) > 0) ans++;\n\t\tSystem.out.println(ans);\n\t}\n\n\tint serch(int[] a, int n){\n\t\tint left = 0;\n\t\tint right = a.length;\n\t\tint mid = -1;\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}\n\t\treturn 0;\n\t}\n\n public static void main(String[] args) {\n new Main().solve();\n }\n}",
"Main",
"static Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"void solve() {\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; i++) s[i] = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; i++) t[i] = in.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i : t) if(serch(s, i) > 0) ans++;\n\t\tSystem.out.println(ans);\n\t}",
"solve",
"{\n\t\tint n = in.nextInt();\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0; i < n; i++) s[i] = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint[] t = new int[q];\n\t\tfor(int i = 0; i < q; i++) t[i] = in.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i : t) if(serch(s, i) > 0) ans++;\n\t\tSystem.out.println(ans);\n\t}",
"int 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++) s[i] = in.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"s[i] = in.nextInt();",
"s[i] = in.nextInt()",
"s[i]",
"s",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int 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++) t[i] = in.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"t[i] = in.nextInt();",
"t[i] = in.nextInt()",
"t[i]",
"t",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int ans = 0;",
"ans",
"0",
"for(int i : t) if(serch(s, i) > 0) ans++;",
"int i",
"t",
"if(serch(s, i) > 0) ans++;",
"if(serch(s, i) > 0) ans++;",
"serch(s, i) > 0",
"serch(s, i)",
"serch",
"s",
"i",
"0",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"int serch(int[] a, int n){\n\t\tint left = 0;\n\t\tint right = a.length;\n\t\tint mid = -1;\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}\n\t\treturn 0;\n\t}",
"serch",
"{\n\t\tint left = 0;\n\t\tint right = a.length;\n\t\tint mid = -1;\n\t\twhile(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}\n\t\treturn 0;\n\t}",
"int left = 0;",
"left",
"0",
"int right = a.length;",
"right",
"a.length",
"a",
"a.length",
"int mid = -1;",
"mid",
"-1",
"1",
"while(left < right){\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\tmid = (left + right) / 2;\n\t\t\tif(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;\n\t\t}",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(a[mid] == n) return 1;\n\t\t\telse if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;",
"a[mid] == n",
"a[mid]",
"a",
"mid",
"n",
"return 1;",
"1",
"if(n > a[mid]) left = mid + 1;\n\t\t\telse if(n < a[mid]) right = mid;",
"n > a[mid]",
"n",
"a[mid]",
"a",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"if(n < a[mid]) right = mid;",
"n < a[mid]",
"n",
"a[mid]",
"a",
"mid",
"right = mid",
"right",
"mid",
"return 0;",
"0",
"int[] a",
"a",
"int n",
"n",
"public static void main(String[] args) {\n new Main().solve();\n }",
"main",
"{\n new Main().solve();\n }",
"new Main().solve()",
"new Main().solve",
"new Main()",
"String[] args",
"args"
] | import java.util.*;
class Main {
static Scanner in = new Scanner(System.in);
void solve() {
int n = in.nextInt();
int[] s = new int[n];
for(int i = 0; i < n; i++) s[i] = in.nextInt();
int q = in.nextInt();
int[] t = new int[q];
for(int i = 0; i < q; i++) t[i] = in.nextInt();
int ans = 0;
for(int i : t) if(serch(s, i) > 0) ans++;
System.out.println(ans);
}
int serch(int[] a, int n){
int left = 0;
int right = a.length;
int mid = -1;
while(left < right){
mid = (left + right) / 2;
if(a[mid] == n) return 1;
else if(n > a[mid]) left = mid + 1;
else if(n < a[mid]) right = mid;
}
return 0;
}
public static void main(String[] args) {
new Main().solve();
}
} |
[
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,
4,
18,
13,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
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
],
[
137,
8
],
[
137,
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
],
[
76,
79
],
[
11,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
11,
84
],
[
84,
85
],
[
84,
86
],
[
11,
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
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
121,
127
],
[
11,
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\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[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\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[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }\n System.out.println(count);\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[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\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 Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\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];",
"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",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int idx = 0;",
"idx",
"0",
"for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = 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 = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }",
"{\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }",
"for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }",
"int j = idx;",
"int j = idx;",
"j",
"idx",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }",
"{\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }",
"if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }",
"T[i] == S[j]",
"T[i]",
"T",
"i",
"S[j]",
"S",
"j",
"{\n idx = j;\n count++;\n break;\n }",
"idx = j",
"idx",
"j",
"count++",
"count",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\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[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"public class Main {\n\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[q];\n for (int i = 0; i < q; i++) {\n T[i] = sc.nextInt();\n }\n int count = 0;\n Arrays.sort(S);\n Arrays.sort(T);\n int idx = 0;\n for (int i = 0; i < q; i++) {\n for (int j = idx; j < n; j++) {\n if (T[i] == S[j]) {\n idx = j;\n count++;\n break;\n }\n }\n }\n System.out.println(count);\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[q];
for (int i = 0; i < q; i++) {
T[i] = sc.nextInt();
}
int count = 0;
Arrays.sort(S);
Arrays.sort(T);
int idx = 0;
for (int i = 0; i < q; i++) {
for (int j = idx; j < n; j++) {
if (T[i] == S[j]) {
idx = j;
count++;
break;
}
}
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
18,
13,
13,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
20,
41,
13,
20,
42,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
0,
13,
4,
18,
13,
4,
18,
13,
0,
13,
20,
41,
13,
20,
42,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
4,
18,
13,
13,
30,
40,
13,
29,
14,
2,
13,
13,
29,
14,
2,
13,
4,
18,
13,
13,
4,
13,
13,
13,
2,
13,
17,
14,
2,
4,
18,
13,
13,
13,
4,
13,
13,
2,
13,
17,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
4,
13,
13,
17,
2,
4,
18,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
205,
8
],
[
205,
9
],
[
9,
10
],
[
205,
11
],
[
11,
12
],
[
205,
13
],
[
13,
14
],
[
205,
15
],
[
15,
16
],
[
205,
17
],
[
17,
18
],
[
17,
19
],
[
205,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
22,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
36,
38
],
[
29,
39
],
[
39,
40
],
[
40,
41
],
[
29,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
22,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
20,
60
],
[
60,
61
],
[
205,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
65,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
72,
84
],
[
84,
85
],
[
84,
86
],
[
72,
87
],
[
87,
88
],
[
87,
89
],
[
72,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
101,
102
],
[
72,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
72,
111
],
[
111,
112
],
[
111,
113
],
[
72,
114
],
[
114,
115
],
[
114,
116
],
[
72,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
128,
129
],
[
205,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
140,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
132,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
132,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
156,
163
],
[
163,
164
],
[
163,
165
],
[
163,
166
],
[
163,
167
],
[
167,
168
],
[
167,
169
],
[
132,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
171,
176
],
[
170,
177
],
[
177,
178
],
[
177,
179
],
[
177,
180
],
[
180,
181
],
[
180,
182
],
[
177,
183
],
[
130,
184
],
[
184,
185
],
[
130,
186
],
[
186,
187
],
[
130,
188
],
[
188,
189
],
[
205,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
193,
196
],
[
193,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
197,
201
],
[
190,
202
],
[
202,
203
],
[
0,
204
],
[
204,
205
],
[
204,
206
]
] | [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tpublic ArrayList<Integer> S;\n\tpublic ArrayList<Integer> T;\n\tpublic int n;\n\tpublic int q;\n\tpublic int count = 0;\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}\n\tpublic void init() {\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tprivate void biSearch(int x, int left, int right) {\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}\n\tpublic void biSearch(int x) {\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}\n}\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic ArrayList<Integer> S;\n\tpublic ArrayList<Integer> T;\n\tpublic int n;\n\tpublic int q;\n\tpublic int count = 0;\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}\n\tpublic void init() {\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tprivate void biSearch(int x, int left, int right) {\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}\n\tpublic void biSearch(int x) {\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}\n}",
"Main",
"public ArrayList<Integer> S;",
"S",
"public ArrayList<Integer> T;",
"T",
"public int n;",
"n",
"public int q;",
"q",
"public int count = 0;",
"count",
"0",
"public static void main(String[] args) {\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}",
"main",
"{\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}",
"Main m = new Main();",
"m",
"new Main()",
"m.init()",
"m.init",
"m",
"for (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m.q",
"i",
"m.q",
"m",
"m.q",
"++i",
"++i",
"i",
"m.biSearch(m.T.get(i));",
"m.biSearch(m.T.get(i))",
"m.biSearch",
"m",
"m.T.get(i)",
"m.T.get",
"m.T",
"m",
"m.T",
"i",
"System.out.println(m.count)",
"System.out.println",
"System.out",
"System",
"System.out",
"m.count",
"m",
"m.count",
"String[] args",
"args",
"public void init() {\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"init",
"{\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"try {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t}",
"BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"n = Integer.parseInt(reader.readLine())",
"n",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"S = new ArrayList<>()",
"S",
"new ArrayList<>()",
"StringTokenizer stS = new StringTokenizer(reader.readLine());",
"stS",
"new StringTokenizer(reader.readLine())",
"while (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));",
"stS.hasMoreTokens()",
"stS.hasMoreTokens",
"stS",
"S.add(Integer.parseInt(stS.nextToken()))",
"S.add",
"S",
"Integer.parseInt(stS.nextToken())",
"Integer.parseInt",
"Integer",
"stS.nextToken()",
"stS.nextToken",
"stS",
"q = Integer.parseInt(reader.readLine())",
"q",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"T = new ArrayList<>()",
"T",
"new ArrayList<>()",
"StringTokenizer stT = new StringTokenizer(reader.readLine());",
"stT",
"new StringTokenizer(reader.readLine())",
"while (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));",
"stT.hasMoreTokens()",
"stT.hasMoreTokens",
"stT",
"T.add(Integer.parseInt(stT.nextToken()))",
"T.add",
"T",
"Integer.parseInt(stT.nextToken())",
"Integer.parseInt",
"Integer",
"stT.nextToken()",
"stT.nextToken",
"stT",
"private void biSearch(int x, int left, int right) {\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}",
"biSearch",
"{\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}",
"int index = (left + right) / 2;",
"index",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}",
"x == S.get(index)",
"x",
"S.get(index)",
"S.get",
"S",
"index",
"{\n\t\t\t++count;\n\t\t\treturn;\n\t\t}",
"++count",
"count",
"return;",
"if (left > right)\n\t\t\treturn;",
"left > right",
"left",
"right",
"return;",
"if (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);",
"x <= S.get(index)",
"x",
"S.get(index)",
"S.get",
"S",
"index",
"biSearch(x, left, index - 1)",
"biSearch",
"x",
"left",
"index - 1",
"index",
"1",
"if (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);",
"S.get(index) <= x",
"S.get(index)",
"S.get",
"S",
"index",
"x",
"biSearch(x, index + 1, right)",
"biSearch",
"x",
"index + 1",
"index",
"1",
"right",
"int x",
"x",
"int left",
"left",
"int right",
"right",
"public void biSearch(int x) {\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}",
"biSearch",
"{\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}",
"biSearch(x, 0, S.size() - 1)",
"biSearch",
"x",
"0",
"S.size() - 1",
"S.size()",
"S.size",
"S",
"1",
"int x",
"x",
"public class Main {\n\tpublic ArrayList<Integer> S;\n\tpublic ArrayList<Integer> T;\n\tpublic int n;\n\tpublic int q;\n\tpublic int count = 0;\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}\n\tpublic void init() {\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tprivate void biSearch(int x, int left, int right) {\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}\n\tpublic void biSearch(int x) {\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}\n}",
"public class Main {\n\tpublic ArrayList<Integer> S;\n\tpublic ArrayList<Integer> T;\n\tpublic int n;\n\tpublic int q;\n\tpublic int count = 0;\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\t\tm.init();\n\t\tfor (int i = 0; i < m.q; ++i)\n\t\t\tm.biSearch(m.T.get(i));\n\t\tSystem.out.println(m.count);\n\t}\n\tpublic void init() {\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tn = Integer.parseInt(reader.readLine());\n\t\t\tS = new ArrayList<>();\n\t\t\tStringTokenizer stS = new StringTokenizer(reader.readLine());\n\t\t\twhile (stS.hasMoreTokens())\n\t\t\t\tS.add(Integer.parseInt(stS.nextToken()));\n\t\t\tq = Integer.parseInt(reader.readLine());\n\t\t\tT = new ArrayList<>();\n\t\t\tStringTokenizer stT = new StringTokenizer(reader.readLine());\n\t\t\twhile (stT.hasMoreTokens())\n\t\t\t\tT.add(Integer.parseInt(stT.nextToken()));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tprivate void biSearch(int x, int left, int right) {\n\t\tint index = (left + right) / 2;\n\t\tif (x == S.get(index)) {\n\t\t\t++count;\n\t\t\treturn;\n\t\t}\n\t\tif (left > right)\n\t\t\treturn;\n\t\tif (x <= S.get(index))\n\t\t\tbiSearch(x, left, index - 1);\n\t\tif (S.get(index) <= x)\n\t\t\tbiSearch(x, index + 1, right);\n\t}\n\tpublic void biSearch(int x) {\n\t\tbiSearch(x, 0, S.size() - 1);\n\t}\n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main {
public ArrayList<Integer> S;
public ArrayList<Integer> T;
public int n;
public int q;
public int count = 0;
public static void main(String[] args) {
Main m = new Main();
m.init();
for (int i = 0; i < m.q; ++i)
m.biSearch(m.T.get(i));
System.out.println(m.count);
}
public void init() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(reader.readLine());
S = new ArrayList<>();
StringTokenizer stS = new StringTokenizer(reader.readLine());
while (stS.hasMoreTokens())
S.add(Integer.parseInt(stS.nextToken()));
q = Integer.parseInt(reader.readLine());
T = new ArrayList<>();
StringTokenizer stT = new StringTokenizer(reader.readLine());
while (stT.hasMoreTokens())
T.add(Integer.parseInt(stT.nextToken()));
} catch (Exception e) {
e.printStackTrace();
}
}
private void biSearch(int x, int left, int right) {
int index = (left + right) / 2;
if (x == S.get(index)) {
++count;
return;
}
if (left > right)
return;
if (x <= S.get(index))
biSearch(x, left, index - 1);
if (S.get(index) <= x)
biSearch(x, index + 1, right);
}
public void biSearch(int x) {
biSearch(x, 0, S.size() - 1);
}
}
|
[
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
4,
13,
13,
4,
18,
13,
18,
13,
13,
14,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
14,
2,
13,
18,
13,
2,
13,
17,
30,
14,
2,
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,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
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,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
2,
13,
17,
13,
30,
40,
13,
14,
2,
13,
18,
13,
2,
13,
17,
30,
14,
2,
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,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
18,
13,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
18,
13,
13,
13,
30,
40,
13,
14,
2,
18,
13,
2,
18,
13,
13,
17,
13,
30,
40,
13,
29,
2,
13,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
323,
5
],
[
323,
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
],
[
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
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
93,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
99,
100
],
[
99,
101
],
[
87,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
],
[
323,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
116,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
145,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
145,
159
],
[
159,
160
],
[
160,
161
],
[
145,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
163,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
136,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
173,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
182,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
191,
193
],
[
182,
194
],
[
194,
195
],
[
195,
196
],
[
182,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
201,
203
],
[
198,
204
],
[
204,
205
],
[
205,
206
],
[
204,
207
],
[
173,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
212,
214
],
[
209,
215
],
[
208,
216
],
[
216,
217
],
[
217,
218
],
[
127,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
224,
226
],
[
219,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
231,
233
],
[
228,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
237,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
241,
243
],
[
235,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
246,
248
],
[
235,
249
],
[
249,
250
],
[
250,
251
],
[
235,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
256,
258
],
[
253,
259
],
[
259,
260
],
[
260,
261
],
[
259,
262
],
[
228,
263
],
[
263,
264
],
[
264,
265
],
[
264,
266
],
[
266,
267
],
[
266,
268
],
[
263,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
270,
275
],
[
275,
276
],
[
275,
277
],
[
270,
278
],
[
278,
279
],
[
279,
280
],
[
270,
281
],
[
281,
282
],
[
282,
283
],
[
283,
284
],
[
283,
285
],
[
285,
286
],
[
285,
287
],
[
282,
288
],
[
288,
289
],
[
289,
290
],
[
288,
291
],
[
263,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
293,
297
],
[
292,
298
],
[
298,
299
],
[
299,
300
],
[
219,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
309
],
[
302,
310
],
[
301,
311
],
[
311,
312
],
[
312,
313
],
[
116,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
114,
318
],
[
318,
319
],
[
114,
320
],
[
320,
321
],
[
0,
322
],
[
322,
323
],
[
322,
324
]
] | [
"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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \n \n \n }\n static boolean method(int[] s,int t){\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \n \n \n }\n static boolean method(int[] s,int t){\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \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",
"\" \"",
"boolean con;",
"con",
"int count=0;",
"count",
"0",
"for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}",
"{con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}",
"con=false",
"con",
"false",
"con=method(S,Integer.parseInt(str[i]))",
"con",
"method(S,Integer.parseInt(str[i]))",
"method",
"S",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"if(con)count++;",
"con",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static boolean method(int[] s,int t){\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\n }",
"method",
"{\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\n }",
"int count=0;",
"count",
"0",
"int q=s.length/4;",
"q",
"s.length/4",
"s.length",
"s",
"s.length",
"4",
"if(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}",
"t>s[q*2]",
"t",
"s[q*2]",
"s",
"q*2",
"q",
"2",
"{\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}",
"if(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}",
"t>s[q*3]",
"t",
"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==s[j]){count++;break;}}",
"for(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==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==s[j]){count++;break;}",
"if(t==s[j]){count++;break;}",
"t==s[j]",
"t",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}",
"t<s[q*3]",
"t",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"{\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}",
"for(int j=q*2;j<q*3;j++)if(t==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==s[j]){count++;break;}",
"if(t==s[j]){count++;break;}",
"t==s[j]",
"t",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(s[q*3]==t){count++;}",
"s[q*3]==t",
"s[q*3]",
"s",
"q*3",
"q",
"3",
"t",
"{count++;}",
"count++",
"count",
"if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}",
"t<s[q*2]",
"t",
"s[q*2]",
"s",
"q*2",
"q",
"2",
"{\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}",
"if(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}",
"t>s[q]",
"t",
"s[q]",
"s",
"q",
"{\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}",
"for(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==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==s[j]){count++;break;}",
"if(t==s[j]){count++;break;}",
"t==s[j]",
"t",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}",
"t<s[q]",
"t",
"s[q]",
"s",
"q",
"{\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}",
"for(int j=0;j<q;j++)if(t==s[j]){count++;break;}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"if(t==s[j]){count++;break;}",
"if(t==s[j]){count++;break;}",
"t==s[j]",
"t",
"s[j]",
"s",
"j",
"{count++;break;}",
"count++",
"count",
"break;",
"if(s[q]==t){count++;}",
"s[q]==t",
"s[q]",
"s",
"q",
"t",
"{count++;}",
"count++",
"count",
"if(s[s.length/2]==t){count++;}",
"s[s.length/2]==t",
"s[s.length/2]",
"s",
"s.length/2",
"s.length",
"s",
"s.length",
"2",
"t",
"{count++;}",
"count++",
"count",
"return count==1;",
"count==1",
"count",
"1",
"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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \n \n \n }\n static boolean method(int[] s,int t){\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\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 \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 boolean con;\n int count=0;\n for(int i=0;i<q;i++)\n {con=false;\n \tcon=method(S,Integer.parseInt(str[i]));\n if(con)count++;}\n System.out.println(count);\n \n \n \n \n }\n static boolean method(int[] s,int t){\n \n int count=0;\n int q=s.length/4;\n \n \tif(t>s[q*2]){\n \t\tif(t>s[q*3]){\n \t\tfor(int j=s[q*3];j<s.length;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q*3]){\n \t\tfor(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q*3]==t){count++;}}\n \t\n \telse if(t<s[q*2]){\n \t\tif(t>s[q]){\n \t\tfor(int j=s[q+1];j<q*2;j++)\n \t\t\tif(t==s[j]){count++;break;}}\n \telse if(t<s[q]){\n \t\tfor(int j=0;j<q;j++)if(t==s[j]){count++;break;}}\n \telse if(s[q]==t){count++;}}\n \t\n \t\t\n \telse if(s[s.length/2]==t){count++;}\n \t\t\n \t\n \n \n \n return count==1;\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(" ");
boolean con;
int count=0;
for(int i=0;i<q;i++)
{con=false;
con=method(S,Integer.parseInt(str[i]));
if(con)count++;}
System.out.println(count);
}
static boolean method(int[] s,int t){
int count=0;
int q=s.length/4;
if(t>s[q*2]){
if(t>s[q*3]){
for(int j=s[q*3];j<s.length;j++)
if(t==s[j]){count++;break;}}
else if(t<s[q*3]){
for(int j=q*2;j<q*3;j++)if(t==s[j]){count++;break;}}
else if(s[q*3]==t){count++;}}
else if(t<s[q*2]){
if(t>s[q]){
for(int j=s[q+1];j<q*2;j++)
if(t==s[j]){count++;break;}}
else if(t<s[q]){
for(int j=0;j<q;j++)if(t==s[j]){count++;break;}}
else if(s[q]==t){count++;}}
else if(s[s.length/2]==t){count++;}
return count==1;
}
} |
[
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,
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,
17,
41,
13,
4,
18,
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,
14,
4,
13,
13,
13,
13,
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,
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
],
[
152,
8
],
[
152,
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
],
[
11,
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
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
58,
59
],
[
11,
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
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
78,
79
],
[
79,
80
],
[
72,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
82,
86
],
[
81,
87
],
[
87,
88
],
[
11,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
9,
95
],
[
95,
96
],
[
152,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
99,
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
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
99,
143
],
[
143,
144
],
[
97,
145
],
[
145,
146
],
[
97,
147
],
[
147,
148
],
[
97,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }\n\n private static boolean search(long[] A, int n, long key) {\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }\n\n private static boolean search(long[] A, int n, long key) {\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long[] S = new long[n];",
"S",
"new long[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 cnt = 0;",
"cnt",
"0",
"int 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 long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }",
"{\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }",
"long T = Integer.parseInt(sc.next());",
"T",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"if (search(S, n, T)) cnt++;",
"search(S, n, T)",
"search",
"S",
"n",
"T",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"private static boolean search(long[] A, int n, long key) {\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }\n return false;\n }",
"search",
"{\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }\n return false;\n }",
"int l = 0;",
"l",
"0",
"int r = n;",
"r",
"n",
"while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }",
"l < r",
"l",
"r",
"{\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }",
"int m = (l + r) / 2;",
"m",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }",
"A[m] == key",
"A[m]",
"A",
"m",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }",
"key < A[m]",
"key",
"A[m]",
"A",
"m",
"{\n r = m;\n }",
"r = m",
"r",
"m",
"{\n l = m + 1;\n }",
"l = m + 1",
"l",
"m + 1",
"m",
"1",
"return false;",
"false",
"long[] A",
"A",
"int n",
"n",
"long key",
"key",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }\n\n private static boolean search(long[] A, int n, long key) {\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n long[] S = new long[n];\n for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());\n\n int cnt = 0;\n\n int q = Integer.parseInt(sc.next());\n for (int i = 0; i < q; i++) {\n long T = Integer.parseInt(sc.next());\n if (search(S, n, T)) cnt++;\n }\n System.out.println(cnt);\n }\n\n private static boolean search(long[] A, int n, long key) {\n// return Arrays.binarySearch(A, key) >= 0;\n int l = 0;\n int r = n;\n while (l < r) {\n int m = (l + r) / 2;\n if (A[m] == key) {\n return true;\n } else if (key < A[m]) {\n r = m;\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 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
long[] S = new long[n];
for (int i = 0; i < n; i++) S[i] = Integer.parseInt(sc.next());
int cnt = 0;
int q = Integer.parseInt(sc.next());
for (int i = 0; i < q; i++) {
long T = Integer.parseInt(sc.next());
if (search(S, n, T)) cnt++;
}
System.out.println(cnt);
}
private static boolean search(long[] A, int n, long key) {
// return Arrays.binarySearch(A, key) >= 0;
int l = 0;
int r = n;
while (l < r) {
int m = (l + r) / 2;
if (A[m] == key) {
return true;
} else if (key < A[m]) {
r = m;
} else {
l = m + 1;
}
}
return false;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
13,
41,
13,
4,
13,
41,
13,
4,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
13,
41,
13,
40,
17,
42,
2,
2,
13,
13,
17,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
30,
0,
13,
13,
14,
2,
2,
13,
40,
17,
2,
18,
13,
13,
18,
13,
13,
40,
13,
4,
18,
13,
13,
12,
13,
30,
42,
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,
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,
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,
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,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
0,
13,
20,
41,
13,
20,
4,
18,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
274,
17
],
[
274,
18
],
[
18,
19
],
[
274,
20
],
[
20,
21
],
[
274,
22
],
[
22,
23
],
[
274,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
33,
35
],
[
26,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
26,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
26,
45
],
[
45,
46
],
[
45,
47
],
[
26,
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
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
82,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
60,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
99,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
98,
111
],
[
111,
112
],
[
26,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
274,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
120,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
274,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
274,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
149,
150
],
[
274,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
158,
159
],
[
274,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
172,
174
],
[
167,
175
],
[
175,
176
],
[
176,
177
],
[
167,
178
],
[
179,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
162,
186
],
[
186,
187
],
[
160,
188
],
[
188,
189
],
[
274,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
192,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
197,
202
],
[
202,
203
],
[
202,
204
],
[
197,
205
],
[
205,
206
],
[
206,
207
],
[
197,
208
],
[
209,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
192,
216
],
[
216,
217
],
[
190,
218
],
[
218,
219
],
[
274,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
227,
232
],
[
232,
233
],
[
232,
234
],
[
227,
235
],
[
235,
236
],
[
236,
237
],
[
227,
238
],
[
239,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
222,
246
],
[
246,
247
],
[
220,
248
],
[
248,
249
],
[
274,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
256
],
[
256,
257
],
[
256,
258
],
[
252,
259
],
[
259,
260
],
[
259,
261
],
[
252,
262
],
[
262,
263
],
[
262,
264
],
[
252,
265
],
[
265,
266
],
[
266,
267
],
[
252,
268
],
[
268,
269
],
[
269,
270
],
[
250,
271
],
[
271,
272
],
[
0,
273
],
[
273,
274
],
[
273,
275
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class Main {\n\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n\n void solve() throws IOException {\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }\n\n String ns() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String[] nsa(int n) throws IOException {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }\n\n int[] nia(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }\n\n long[] nla(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }\n\n public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\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.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n\n void solve() throws IOException {\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }\n\n String ns() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String[] nsa(int n) throws IOException {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }\n\n int[] nia(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }\n\n long[] nla(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }\n\n public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\n }\n}",
"Main",
"static BufferedReader in;",
"in",
"static PrintWriter out;",
"out",
"static StringTokenizer tok;",
"tok",
"void solve() throws IOException {\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }",
"solve",
"{\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }",
"int n = ni();",
"n",
"ni()",
"ni",
"int[] s = nia(n);",
"s",
"nia(n)",
"nia",
"n",
"int q = ni();",
"q",
"ni()",
"ni",
"int[] t = nia(q);",
"t",
"nia(q)",
"nia",
"q",
"int ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }",
"{\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }",
"int high = n;",
"high",
"n",
"int low = -1;",
"low",
"-1",
"1",
"while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }",
"high - low > 1",
"high - low",
"high",
"low",
"1",
"{\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }",
"int mid = (high + low) / 2;",
"mid",
"(high + low) / 2",
"(high + low)",
"high",
"low",
"2",
"if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }",
"s[mid] > t[i]",
"s[mid]",
"s",
"mid",
"t[i]",
"t",
"i",
"{\n high = mid;\n }",
"high = mid",
"high",
"mid",
"{\n low = mid;\n }",
"low = mid",
"low",
"mid",
"if (low != -1 && s[low] == t[i]) ans++;",
"low != -1 && s[low] == t[i]",
"low != -1",
"low",
"-1",
"1",
"s[low] == t[i]",
"s[low]",
"s",
"low",
"t[i]",
"t",
"i",
"ans++",
"ans",
"out.println(ans)",
"out.println",
"out",
"ans",
"String ns() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }",
"ns",
"{\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }",
"while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }",
"!tok.hasMoreTokens()",
"tok.hasMoreTokens()",
"tok.hasMoreTokens",
"tok",
"{\n tok = new StringTokenizer(in.readLine(), \" \");\n }",
"tok = new StringTokenizer(in.readLine(), \" \")",
"tok",
"new StringTokenizer(in.readLine(), \" \")",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"int ni() throws IOException {\n return Integer.parseInt(ns());\n }",
"ni",
"{\n return Integer.parseInt(ns());\n }",
"return Integer.parseInt(ns());",
"Integer.parseInt(ns())",
"Integer.parseInt",
"Integer",
"ns()",
"ns",
"long nl() throws IOException {\n return Long.parseLong(ns());\n }",
"nl",
"{\n return Long.parseLong(ns());\n }",
"return Long.parseLong(ns());",
"Long.parseLong(ns())",
"Long.parseLong",
"Long",
"ns()",
"ns",
"double nd() throws IOException {\n return Double.parseDouble(ns());\n }",
"nd",
"{\n return Double.parseDouble(ns());\n }",
"return Double.parseDouble(ns());",
"Double.parseDouble(ns())",
"Double.parseDouble",
"Double",
"ns()",
"ns",
"String[] nsa(int n) throws IOException {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }",
"nsa",
"{\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }",
"String[] res = new String[n];",
"res",
"new String[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = ns();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = ns();\n }",
"{\n res[i] = ns();\n }",
"res[i] = ns()",
"res[i]",
"res",
"i",
"ns()",
"ns",
"return res;",
"res",
"int n",
"n",
"int[] nia(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }",
"nia",
"{\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }",
"int[] res = new int[n];",
"res",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = ni();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = ni();\n }",
"{\n res[i] = ni();\n }",
"res[i] = ni()",
"res[i]",
"res",
"i",
"ni()",
"ni",
"return res;",
"res",
"int n",
"n",
"long[] nla(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }",
"nla",
"{\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }",
"long[] res = new long[n];",
"res",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nl();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nl();\n }",
"{\n res[i] = nl();\n }",
"res[i] = nl()",
"res[i]",
"res",
"i",
"nl()",
"nl",
"return res;",
"res",
"int n",
"n",
"public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\n }",
"main",
"{\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\n }",
"in = new BufferedReader(new InputStreamReader(System.in))",
"in",
"new BufferedReader(new InputStreamReader(System.in))",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"tok = new StringTokenizer(\"\")",
"tok",
"new StringTokenizer(\"\")",
"Main main = new Main();",
"main",
"new Main()",
"main.solve()",
"main.solve",
"main",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"public class Main {\n\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n\n void solve() throws IOException {\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }\n\n String ns() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String[] nsa(int n) throws IOException {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }\n\n int[] nia(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }\n\n long[] nla(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }\n\n public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\n }\n}",
"public class Main {\n\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n\n void solve() throws IOException {\n int n = ni();\n int[] s = nia(n);\n int q = ni();\n int[] t = nia(q);\n\n int ans = 0;\n for (int i = 0; i < q; i++) {\n int high = n;\n int low = -1;\n while (high - low > 1) {\n int mid = (high + low) / 2;\n if (s[mid] > t[i]) {\n high = mid;\n } else {\n low = mid;\n }\n }\n if (low != -1 && s[low] == t[i]) ans++;\n }\n\n out.println(ans);\n }\n\n String ns() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine(), \" \");\n }\n return tok.nextToken();\n }\n\n int ni() throws IOException {\n return Integer.parseInt(ns());\n }\n\n long nl() throws IOException {\n return Long.parseLong(ns());\n }\n\n double nd() throws IOException {\n return Double.parseDouble(ns());\n }\n\n String[] nsa(int n) throws IOException {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) {\n res[i] = ns();\n }\n return res;\n }\n\n int[] nia(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = ni();\n }\n return res;\n }\n\n long[] nla(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nl();\n }\n return res;\n }\n\n public static void main(String[] args) throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n tok = new StringTokenizer(\"\");\n Main main = new Main();\n main.solve();\n out.close();\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer tok;
void solve() throws IOException {
int n = ni();
int[] s = nia(n);
int q = ni();
int[] t = nia(q);
int ans = 0;
for (int i = 0; i < q; i++) {
int high = n;
int low = -1;
while (high - low > 1) {
int mid = (high + low) / 2;
if (s[mid] > t[i]) {
high = mid;
} else {
low = mid;
}
}
if (low != -1 && s[low] == t[i]) ans++;
}
out.println(ans);
}
String ns() throws IOException {
while (!tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine(), " ");
}
return tok.nextToken();
}
int ni() throws IOException {
return Integer.parseInt(ns());
}
long nl() throws IOException {
return Long.parseLong(ns());
}
double nd() throws IOException {
return Double.parseDouble(ns());
}
String[] nsa(int n) throws IOException {
String[] res = new String[n];
for (int i = 0; i < n; i++) {
res[i] = ns();
}
return res;
}
int[] nia(int n) throws IOException {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = ni();
}
return res;
}
long[] nla(int n) throws IOException {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nl();
}
return res;
}
public static void main(String[] args) throws IOException {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
tok = new StringTokenizer("");
Main main = new Main();
main.solve();
out.close();
}
} |
[
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,
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
],
[
113,
8
],
[
113,
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
],
[
75,
77
],
[
13,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
13,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
9,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
] | [
"import java.util.Arrays;\nimport 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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\n}\n \t\t",
"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 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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \t\t}\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n \t\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \t\t}\n \t}",
"{\n \t\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \t\t}\n \t}",
"if(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \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\tC++;\n \t\t}",
"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 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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\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\tif(Arrays.binarySearch(S, T[i])>=0) {\n \t\t\tC++;\n \t\t}\n \t}\n \tSystem.out.println(C);\n }\n }\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();
}
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,
6,
13,
12,
13,
30,
38,
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,
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,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
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,
29,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
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
],
[
181,
11
],
[
181,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
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
],
[
16,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
34,
39
],
[
16,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
59,
61
],
[
16,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
68,
69
],
[
16,
70
],
[
70,
71
],
[
70,
72
],
[
16,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
76,
81
],
[
16,
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
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
16,
104
],
[
104,
105
],
[
104,
106
],
[
16,
107
],
[
107,
108
],
[
107,
109
],
[
107,
110
],
[
111,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
113,
116
],
[
112,
117
],
[
117,
118
],
[
16,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
12,
125
],
[
125,
126
],
[
181,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
129,
138
],
[
138,
139
],
[
129,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
152,
158
],
[
158,
159
],
[
152,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
160,
166
],
[
166,
167
],
[
166,
168
],
[
160,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
129,
174
],
[
174,
175
],
[
127,
176
],
[
176,
177
],
[
127,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"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 try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }\n\n static boolean isExistSeachByBinary(int[] tar, int ref) {\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\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 try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }\n\n static boolean isExistSeachByBinary(int[] tar, int ref) {\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }\n\n return false;\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n \n try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }",
"main",
"{\n \n try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }",
"try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }",
"{\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"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[] seqS = new int[n];",
"seqS",
"new int[n]",
"n",
"String[] line = br.readLine().split(\" \");",
"line",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"seqS[i] = Integer.parseInt(line[i]);",
"seqS[i] = Integer.parseInt(line[i])",
"seqS[i]",
"seqS",
"i",
"Integer.parseInt(line[i])",
"Integer.parseInt",
"Integer",
"line[i]",
"line",
"i",
"int q = Integer.parseInt(br.readLine());",
"q",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] seqT = new int[q];",
"seqT",
"new int[q]",
"q",
"line = br.readLine().split(\" \")",
"line",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"seqT[i] = Integer.parseInt(line[i]);",
"seqT[i] = Integer.parseInt(line[i])",
"seqT[i]",
"seqT",
"i",
"Integer.parseInt(line[i])",
"Integer.parseInt",
"Integer",
"line[i]",
"line",
"i",
"int cnt=0;",
"cnt",
"0",
"for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }",
"int ref",
"seqT",
"{\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }",
"{\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }",
"if( isExistSeachByBinary(seqS, ref) )\n cnt++;",
"isExistSeachByBinary(seqS, ref)",
"isExistSeachByBinary",
"seqS",
"ref",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"static boolean isExistSeachByBinary(int[] tar, int ref) {\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }\n\n return false;\n }",
"isExistSeachByBinary",
"{\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }\n\n return false;\n }",
"int left = 0;",
"left",
"0",
"int right= tar.length;",
"right",
"tar.length",
"tar",
"tar.length",
"int mid;",
"mid",
"while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;",
"tar[mid] == ref",
"tar[mid]",
"tar",
"mid",
"ref",
"return true;",
"true",
"if( tar[mid] > ref ) right = mid;\n else left = mid + 1;",
"tar[mid] > ref",
"tar[mid]",
"tar",
"mid",
"ref",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"return false;",
"false",
"int[] tar",
"tar",
"int ref",
"ref",
"public class Main {\n\n public static void main(String[] args) throws IOException {\n \n try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }\n\n static boolean isExistSeachByBinary(int[] tar, int ref) {\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\n }\n\n return false;\n }\n}",
"public class Main {\n\n public static void main(String[] args) throws IOException {\n \n try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n int[] seqS = new int[n];\n String[] line = br.readLine().split(\" \");\n for (int i=0; i<n; i++)\n seqS[i] = Integer.parseInt(line[i]);\n\n int q = Integer.parseInt(br.readLine());\n int[] seqT = new int[q];\n line = br.readLine().split(\" \");\n for(int i=0; i<q; i++)\n seqT[i] = Integer.parseInt(line[i]);\n \n int cnt=0;\n for (int ref : seqT) {\n if( isExistSeachByBinary(seqS, ref) )\n cnt++;\n }\n\n System.out.println(cnt);\n }\n }\n\n static boolean isExistSeachByBinary(int[] tar, int ref) {\n int left = 0;\n int right= tar.length;\n int mid;\n while( left < right ) {\n mid = (left + right) / 2;\n if( tar[mid] == ref ) return true;\n else if( tar[mid] > ref ) right = mid;\n else left = mid + 1;\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 {
try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int n = Integer.parseInt(br.readLine());
int[] seqS = new int[n];
String[] line = br.readLine().split(" ");
for (int i=0; i<n; i++)
seqS[i] = Integer.parseInt(line[i]);
int q = Integer.parseInt(br.readLine());
int[] seqT = new int[q];
line = br.readLine().split(" ");
for(int i=0; i<q; i++)
seqT[i] = Integer.parseInt(line[i]);
int cnt=0;
for (int ref : seqT) {
if( isExistSeachByBinary(seqS, ref) )
cnt++;
}
System.out.println(cnt);
}
}
static boolean isExistSeachByBinary(int[] tar, int ref) {
int left = 0;
int right= tar.length;
int mid;
while( left < right ) {
mid = (left + right) / 2;
if( tar[mid] == ref ) return true;
else if( tar[mid] > ref ) right = mid;
else left = mid + 1;
}
return false;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
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,
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
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
13,
18
],
[
9,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
29,
30
],
[
19,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
33,
38
],
[
19,
39
],
[
39,
40
],
[
39,
41
],
[
19,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
63,
65
],
[
19,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
72,
73
],
[
19,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
76,
81
],
[
19,
82
],
[
82,
83
],
[
82,
84
],
[
19,
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
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
19,
109
],
[
109,
110
],
[
109,
111
],
[
19,
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
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
125,
136
],
[
137,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
19,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
6,
156
],
[
156,
157
]
] | [
"import java.io.*;\n\nclass Main {\n public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main {\n public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }",
"main",
"{\n try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }\n }",
"try {\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n } catch( IOException e ) {\n System.err.println( e );\n }",
"catch( IOException e ) {\n System.err.println( e );\n }",
"IOException e",
"{\n System.err.println( e );\n }",
"System.err.println( e )",
"System.err.println",
"System.err",
"System",
"System.err",
"e",
"{\n \tBufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n \tint n = Integer.parseInt( kb.readLine( ) );\n\t\t\tString[] str = kb.readLine( ).split( \" \" );\n\t\t\tint[] S = new int[ n ];\n\t\t\tfor( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n \tint q = Integer.parseInt( kb.readLine( ) );\n\t\t\tstr = kb.readLine( ).split( \" \" );\n\t\t\tint[] T = new int[ q ];\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}\n\n\t\t\tint cnt = 0;\n\t\t\tfor( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println( cnt );\n\n }",
"BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );",
"kb",
"new BufferedReader( new InputStreamReader( System.in ) )",
"int n = Integer.parseInt( kb.readLine( ) );",
"n",
"Integer.parseInt( kb.readLine( ) )",
"Integer.parseInt",
"Integer",
"kb.readLine( )",
"kb.readLine",
"kb",
"String[] str = kb.readLine( ).split( \" \" );",
"str",
"kb.readLine( ).split( \" \" )",
"kb.readLine( ).split",
"kb.readLine( )",
"kb.readLine",
"kb",
"\" \"",
"int[] S = new int[ n ];",
"S",
"new int[ n ]",
"n",
"for( int i=0; i<n; i++ ) {\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\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] = Integer.parseInt( str[i] );\n\t\t\t}",
"{\n\t\t\t\tS[i] = Integer.parseInt( str[i] );\n\t\t\t}",
"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( kb.readLine( ) );",
"q",
"Integer.parseInt( kb.readLine( ) )",
"Integer.parseInt",
"Integer",
"kb.readLine( )",
"kb.readLine",
"kb",
"str = kb.readLine( ).split( \" \" )",
"str",
"kb.readLine( ).split( \" \" )",
"kb.readLine( ).split",
"kb.readLine( )",
"kb.readLine",
"kb",
"\" \"",
"int[] T = new int[ q ];",
"T",
"new int[ q ]",
"q",
"for( int i=0; i<q; i++ ) {\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\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] = Integer.parseInt( str[i] );\n\t\t\t}",
"{\n\t\t\t\tT[i] = Integer.parseInt( str[i] );\n\t\t\t}",
"T[i] = Integer.parseInt( str[i] )",
"T[i]",
"T",
"i",
"Integer.parseInt( str[i] )",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int cnt = 0;",
"cnt",
"0",
"for( int i=0; i<q; i++ ) {\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tfor( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for( int j=0; j<n; j++ ) {\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}",
"if( T[i] == S[j] ) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"T[i] == S[j]",
"T[i]",
"T",
"i",
"S[j]",
"S",
"j",
"{\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"cnt++",
"cnt",
"break;",
"System.out.println( cnt )",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args"
] | import java.io.*;
class Main {
public static void main(String[] args) {
try {
BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
int n = Integer.parseInt( kb.readLine( ) );
String[] str = kb.readLine( ).split( " " );
int[] S = new int[ n ];
for( int i=0; i<n; i++ ) {
S[i] = Integer.parseInt( str[i] );
}
int q = Integer.parseInt( kb.readLine( ) );
str = kb.readLine( ).split( " " );
int[] T = new int[ q ];
for( int i=0; i<q; i++ ) {
T[i] = Integer.parseInt( str[i] );
}
int cnt = 0;
for( int i=0; i<q; i++ ) {
for( int j=0; j<n; j++ ) {
if( T[i] == S[j] ) {
cnt++;
break;
}
}
}
System.out.println( cnt );
} catch( IOException e ) {
System.err.println( e );
}
}
} |
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
42,
2,
13,
4,
18,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
42,
2,
13,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
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,
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
],
[
165,
11
],
[
165,
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,
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
],
[
42,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
14,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
14,
59
],
[
59,
60
],
[
59,
61
],
[
14,
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
],
[
75,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
82,
83
],
[
14,
84
],
[
84,
85
],
[
85,
86
],
[
14,
87
],
[
87,
88
],
[
87,
89
],
[
14,
90
],
[
90,
91
],
[
90,
92
],
[
14,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
99,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
99,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
128,
131
],
[
127,
132
],
[
126,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
126,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
137,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
137,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
99,
154
],
[
154,
155
],
[
14,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
12,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\n//5-3 二分探索\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"ArrayList<Integer> S = new ArrayList<>();",
"S",
"new ArrayList<>()",
"for(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}",
"{\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}",
"S.add(Integer.parseInt(sc.next()))",
"S.add",
"S",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int q = Integer.parseInt(sc.next());",
"q",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"ArrayList<Integer> T = new ArrayList<>();",
"T",
"new ArrayList<>()",
"for(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}",
"{\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}",
"T.add(Integer.parseInt(sc.next()))",
"T.add",
"T",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"sc.close()",
"sc.close",
"sc",
"int i = 0;",
"i",
"0",
"int count = 0;",
"count",
"0",
"while(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}",
"i != T.size()",
"i",
"T.size()",
"T.size",
"T",
"{\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = S.size();",
"right",
"S.size()",
"S.size",
"S",
"int key = T.get(i);",
"key",
"T.get(i)",
"T.get",
"T",
"i",
"while(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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}",
"int mid = (left + right) / 2;",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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}",
"S.get(mid) == key",
"S.get(mid)",
"S.get",
"S",
"mid",
"key",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if(key < S.get(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}",
"key < S.get(mid)",
"key",
"S.get(mid)",
"S.get",
"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",
"i++",
"i",
"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 IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> S = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tint q = Integer.parseInt(sc.next());\n\t\tArrayList<Integer> T = new ArrayList<>();\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tT.add(Integer.parseInt(sc.next()));\n\t\t}\n\t\tsc.close();\n\n\t\t//二分探索\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i != T.size()) {\n\t\t\tint left = 0;\n\t\t\tint right = S.size();\n\t\t\tint key = T.get(i);\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(S.get(mid) == key) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(key < S.get(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\ti++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
//5-3 二分探索
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
ArrayList<Integer> S = new ArrayList<>();
for(int i = 0; i < n; i++) {
S.add(Integer.parseInt(sc.next()));
}
int q = Integer.parseInt(sc.next());
ArrayList<Integer> T = new ArrayList<>();
for(int i = 0; i < q; i++) {
T.add(Integer.parseInt(sc.next()));
}
sc.close();
//二分探索
int i = 0;
int count = 0;
while(i != T.size()) {
int left = 0;
int right = S.size();
int key = T.get(i);
while(left < right) {
int mid = (left + right) / 2;
if(S.get(mid) == key) {
count++;
break;
}else if(key < S.get(mid)) {
right = mid;
}else {
left = mid + 1;
}
}
i++;
}
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,
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,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
28,
13,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
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
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
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
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
31,
36
],
[
17,
37
],
[
37,
38
],
[
37,
39
],
[
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
],
[
68,
69
],
[
17,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
72,
77
],
[
17,
78
],
[
78,
79
],
[
78,
80
],
[
78,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
85,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
84,
93
],
[
83,
94
],
[
94,
95
],
[
17,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
15,
102
],
[
102,
103
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\nclass Main{\n public static void main(String[] args) throws IOException{\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] s = new int[n];\n for(int i = 0; i<n; i++){\n s[i] = Integer.parseInt(in[i]);\n }\n int c = 0;\n br.readLine();\n final String[] t = br.readLine().split(\" \");\n for(final String ti:t){\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }\n System.out.println(c);\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",
"class Main{\n public static void main(String[] args) throws IOException{\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] s = new int[n];\n for(int i = 0; i<n; i++){\n s[i] = Integer.parseInt(in[i]);\n }\n int c = 0;\n br.readLine();\n final String[] t = br.readLine().split(\" \");\n for(final String ti:t){\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }\n System.out.println(c);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException{\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] s = new int[n];\n for(int i = 0; i<n; i++){\n s[i] = Integer.parseInt(in[i]);\n }\n int c = 0;\n br.readLine();\n final String[] t = br.readLine().split(\" \");\n for(final String ti:t){\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }\n System.out.println(c);\n }",
"main",
"{\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] s = new int[n];\n for(int i = 0; i<n; i++){\n s[i] = Integer.parseInt(in[i]);\n }\n int c = 0;\n br.readLine();\n final String[] t = br.readLine().split(\" \");\n for(final String ti:t){\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }\n System.out.println(c);\n }",
"final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"final int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"final String[] in = br.readLine().split(\" \");",
"in",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"final int[] s = new int[n];",
"s",
"new int[n]",
"n",
"for(int i = 0; i<n; i++){\n s[i] = Integer.parseInt(in[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = Integer.parseInt(in[i]);\n }",
"{\n s[i] = Integer.parseInt(in[i]);\n }",
"s[i] = Integer.parseInt(in[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(in[i])",
"Integer.parseInt",
"Integer",
"in[i]",
"in",
"i",
"int c = 0;",
"c",
"0",
"br.readLine()",
"br.readLine",
"br",
"final String[] t = br.readLine().split(\" \");",
"t",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(final String ti:t){\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }",
"final String ti",
"t",
"{\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }",
"{\n if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;\n }",
"if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;",
"Arrays.binarySearch(s, Integer.parseInt(ti))>=0",
"Arrays.binarySearch(s, Integer.parseInt(ti))",
"Arrays.binarySearch",
"Arrays",
"s",
"Integer.parseInt(ti)",
"Integer.parseInt",
"Integer",
"ti",
"0",
"c++",
"c",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
class Main{
public static void main(String[] args) throws IOException{
final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int n = Integer.parseInt(br.readLine());
final String[] in = br.readLine().split(" ");
final int[] s = new int[n];
for(int i = 0; i<n; i++){
s[i] = Integer.parseInt(in[i]);
}
int c = 0;
br.readLine();
final String[] t = br.readLine().split(" ");
for(final String ti:t){
if(Arrays.binarySearch(s, Integer.parseInt(ti))>=0) c++;
}
System.out.println(c);
}
} |
[
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,
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,
28,
13,
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,
13,
18,
13,
13,
30,
40,
13,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
13,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
23,
13,
23,
13,
12,
13,
30,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
2,
13,
13,
42,
2,
2,
13,
17,
2,
18,
13,
13,
18,
13,
13,
30,
0,
18,
13,
13,
18,
13,
13,
0,
13,
13,
40,
13,
0,
18,
13,
2,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
30,
30,
14,
2,
13,
13,
30,
3,
0,
13,
2,
2,
13,
17,
17,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
13,
0,
13,
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
],
[
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
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
68,
73
],
[
11,
74
],
[
74,
75
],
[
74,
76
],
[
11,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
11,
101
],
[
101,
102
],
[
101,
103
],
[
11,
104
],
[
104,
105
],
[
104,
106
],
[
104,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
108,
115
],
[
115,
116
],
[
108,
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
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
135,
138
],
[
129,
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
],
[
149,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
11,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
9,
167
],
[
167,
168
],
[
7,
169
],
[
169,
170
],
[
169,
171
],
[
169,
172
],
[
172,
173
],
[
169,
174
],
[
174,
175
],
[
7,
176
],
[
176,
177
],
[
176,
178
],
[
176,
179
],
[
179,
180
],
[
176,
181
],
[
181,
182
],
[
7,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
186,
191
],
[
191,
192
],
[
191,
193
],
[
186,
194
],
[
194,
195
],
[
195,
196
],
[
186,
197
],
[
198,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
201,
203
],
[
198,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
206,
208
],
[
198,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
214,
218
],
[
218,
219
],
[
218,
220
],
[
209,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
222,
226
],
[
226,
227
],
[
226,
228
],
[
221,
229
],
[
229,
230
],
[
229,
231
],
[
221,
232
],
[
232,
233
],
[
198,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
237,
239
],
[
234,
240
],
[
183,
241
],
[
241,
242
],
[
183,
243
],
[
243,
244
],
[
183,
245
],
[
245,
246
],
[
183,
247
],
[
247,
248
],
[
7,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
252,
257
],
[
258,
258
],
[
258,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
259,
263
],
[
263,
264
],
[
258,
265
],
[
265,
266
],
[
265,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
267,
271
],
[
249,
272
],
[
272,
273
],
[
249,
274
],
[
274,
275
],
[
0,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
276,
280
],
[
280,
281
],
[
276,
282
],
[
282,
283
],
[
282,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
284,
288
],
[
288,
289
],
[
288,
290
],
[
282,
291
],
[
291,
292
],
[
282,
293
],
[
293,
294
]
] | [
"import java.util.*;\nimport java.lang.*;\n\nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] data =new int[n];\n for(int i=0; i < n; i++){\n data[i] = Integer.parseInt(line[i]);\n }\n\n int q = Integer.parseInt(sc.nextLine());\n String[] line2 = sc.nextLine().split(\" \");\n int[] searcher = new int[q];\n for(int i=0; i < q; i++){\n searcher[i] = Integer.parseInt(line2[i]);\n }\n\n \n int result = 0;\n for(int search : searcher){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }\n System.out.println(result);\n \n\n\n\n }\n static void bubble(int[] arr, int n){\n\n }\n static void selection(int[] arr, int n){\n\n }\n static void insertionSort(int[] arr, int n, int g,int count){\n for(int i = g; i < n; i++){\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }\n }\n static void shellsort(int[] arr, int n){\n\n for(int i = 1; ; ){\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }\n }\n}\nclass Struct{\n String name;\n int time;\n public Struct(String n, int t){\n name = n;\n time = t;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"class Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] data =new int[n];\n for(int i=0; i < n; i++){\n data[i] = Integer.parseInt(line[i]);\n }\n\n int q = Integer.parseInt(sc.nextLine());\n String[] line2 = sc.nextLine().split(\" \");\n int[] searcher = new int[q];\n for(int i=0; i < q; i++){\n searcher[i] = Integer.parseInt(line2[i]);\n }\n\n \n int result = 0;\n for(int search : searcher){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }\n System.out.println(result);\n \n\n\n\n }\n static void bubble(int[] arr, int n){\n\n }\n static void selection(int[] arr, int n){\n\n }\n static void insertionSort(int[] arr, int n, int g,int count){\n for(int i = g; i < n; i++){\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }\n }\n static void shellsort(int[] arr, int n){\n\n for(int i = 1; ; ){\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }\n }\n}",
"Main",
"public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] data =new int[n];\n for(int i=0; i < n; i++){\n data[i] = Integer.parseInt(line[i]);\n }\n\n int q = Integer.parseInt(sc.nextLine());\n String[] line2 = sc.nextLine().split(\" \");\n int[] searcher = new int[q];\n for(int i=0; i < q; i++){\n searcher[i] = Integer.parseInt(line2[i]);\n }\n\n \n int result = 0;\n for(int search : searcher){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }\n System.out.println(result);\n \n\n\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] data =new int[n];\n for(int i=0; i < n; i++){\n data[i] = Integer.parseInt(line[i]);\n }\n\n int q = Integer.parseInt(sc.nextLine());\n String[] line2 = sc.nextLine().split(\" \");\n int[] searcher = new int[q];\n for(int i=0; i < q; i++){\n searcher[i] = Integer.parseInt(line2[i]);\n }\n\n \n int result = 0;\n for(int search : searcher){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }\n System.out.println(result);\n \n\n\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.nextLine());",
"n",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] line = sc.nextLine().split(\" \");",
"line",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] data =new int[n];",
"data",
"new int[n]",
"n",
"for(int i=0; i < n; i++){\n data[i] = Integer.parseInt(line[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n data[i] = Integer.parseInt(line[i]);\n }",
"{\n data[i] = Integer.parseInt(line[i]);\n }",
"data[i] = Integer.parseInt(line[i])",
"data[i]",
"data",
"i",
"Integer.parseInt(line[i])",
"Integer.parseInt",
"Integer",
"line[i]",
"line",
"i",
"int q = Integer.parseInt(sc.nextLine());",
"q",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] line2 = sc.nextLine().split(\" \");",
"line2",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] searcher = new int[q];",
"searcher",
"new int[q]",
"q",
"for(int i=0; i < q; i++){\n searcher[i] = Integer.parseInt(line2[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n searcher[i] = Integer.parseInt(line2[i]);\n }",
"{\n searcher[i] = Integer.parseInt(line2[i]);\n }",
"searcher[i] = Integer.parseInt(line2[i])",
"searcher[i]",
"searcher",
"i",
"Integer.parseInt(line2[i])",
"Integer.parseInt",
"Integer",
"line2[i]",
"line2",
"i",
"int result = 0;",
"result",
"0",
"for(int search : searcher){\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }",
"int search",
"searcher",
"{\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }",
"{\n int left = 0;\n int right = n;\n int mid;\n while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left < right){\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }",
"left < right",
"left",
"right",
"{\n mid = (left + right) / 2;\n if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }\n }",
"mid = (left + right) / 2",
"mid",
"(left + right) / 2",
"(left + right)",
"left",
"right",
"2",
"if(search == data[mid]){\n result++;\n break;\n }else if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }",
"search == data[mid]",
"search",
"data[mid]",
"data",
"mid",
"{\n result++;\n break;\n }",
"result++",
"result",
"break;",
"if(search < data[mid]){\n right = mid;\n }else if(search > data[mid]){\n left = mid + 1;\n }",
"search < data[mid]",
"search",
"data[mid]",
"data",
"mid",
"{\n right = mid;\n }",
"right = mid",
"right",
"mid",
"if(search > data[mid]){\n left = mid + 1;\n }",
"search > data[mid]",
"search",
"data[mid]",
"data",
"mid",
"{\n left = mid + 1;\n }",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String args[]",
"args",
"static void bubble(int[] arr, int n){\n\n }",
"bubble",
"{\n\n }",
"int[] arr",
"arr",
"int n",
"n",
"static void selection(int[] arr, int n){\n\n }",
"selection",
"{\n\n }",
"int[] arr",
"arr",
"int n",
"n",
"static void insertionSort(int[] arr, int n, int g,int count){\n for(int i = g; i < n; i++){\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }\n }",
"insertionSort",
"{\n for(int i = g; i < n; i++){\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }\n }",
"for(int i = g; i < n; i++){\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }",
"int i = g;",
"int i = g;",
"i",
"g",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }",
"{\n int v = arr[i];\n int j = i - g;\n while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }\n arr[j + g] = v;\n }",
"int v = arr[i];",
"v",
"arr[i]",
"arr",
"i",
"int j = i - g;",
"j",
"i - g",
"i",
"g",
"while(j >= 0 && arr[j] > arr[i]){\n arr[i] = arr[j];\n j-=g;\n count++;\n }",
"j >= 0 && arr[j] > arr[i]",
"j >= 0",
"j",
"0",
"arr[j] > arr[i]",
"arr[j]",
"arr",
"j",
"arr[i]",
"arr",
"i",
"{\n arr[i] = arr[j];\n j-=g;\n count++;\n }",
"arr[i] = arr[j]",
"arr[i]",
"arr",
"i",
"arr[j]",
"arr",
"j",
"j-=g",
"j",
"g",
"count++",
"count",
"arr[j + g] = v",
"arr[j + g]",
"arr",
"j + g",
"j",
"g",
"v",
"int[] arr",
"arr",
"int n",
"n",
"int g",
"g",
"int count",
"count",
"static void shellsort(int[] arr, int n){\n\n for(int i = 1; ; ){\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }\n }",
"shellsort",
"{\n\n for(int i = 1; ; ){\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }\n }",
"for(int i = 1; ; ){\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"{\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }",
"{\n if(i > n){\n break;\n }\n\n i = (i * 3) + 1;\n }",
"if(i > n){\n break;\n }",
"i > n",
"i",
"n",
"{\n break;\n }",
"break;",
"i = (i * 3) + 1",
"i",
"(i * 3) + 1",
"(i * 3)",
"i",
"3",
"1",
"int[] arr",
"arr",
"int n",
"n",
"class Struct{\n String name;\n int time;\n public Struct(String n, int t){\n name = n;\n time = t;\n }\n}",
"Struct",
"String name;",
"name",
"int time;",
"time",
"public Struct(String n, int t){\n name = n;\n time = t;\n }",
"Struct",
"{\n name = n;\n time = t;\n }",
"name = n",
"name",
"n",
"time = t",
"time",
"t",
"String n",
"n",
"int t",
"t"
] | import java.util.*;
import java.lang.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String[] line = sc.nextLine().split(" ");
int[] data =new int[n];
for(int i=0; i < n; i++){
data[i] = Integer.parseInt(line[i]);
}
int q = Integer.parseInt(sc.nextLine());
String[] line2 = sc.nextLine().split(" ");
int[] searcher = new int[q];
for(int i=0; i < q; i++){
searcher[i] = Integer.parseInt(line2[i]);
}
int result = 0;
for(int search : searcher){
int left = 0;
int right = n;
int mid;
while(left < right){
mid = (left + right) / 2;
if(search == data[mid]){
result++;
break;
}else if(search < data[mid]){
right = mid;
}else if(search > data[mid]){
left = mid + 1;
}
}
}
System.out.println(result);
}
static void bubble(int[] arr, int n){
}
static void selection(int[] arr, int n){
}
static void insertionSort(int[] arr, int n, int g,int count){
for(int i = g; i < n; i++){
int v = arr[i];
int j = i - g;
while(j >= 0 && arr[j] > arr[i]){
arr[i] = arr[j];
j-=g;
count++;
}
arr[j + g] = v;
}
}
static void shellsort(int[] arr, int n){
for(int i = 1; ; ){
if(i > n){
break;
}
i = (i * 3) + 1;
}
}
}
class Struct{
String name;
int time;
public Struct(String n, int t){
name = n;
time = t;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
14,
2,
13,
13,
30,
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,
13,
30,
29,
4,
13,
13,
13,
2,
2,
2,
13,
13,
17,
17,
13,
30,
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,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
4,
13,
13,
17,
2,
13,
17,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
170,
8
],
[
170,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
18,
26
],
[
17,
27
],
[
27,
28
],
[
28,
29
],
[
17,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
31,
39
],
[
30,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
42,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
45,
51
],
[
42,
52
],
[
42,
53
],
[
30,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
56,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
56,
67
],
[
12,
68
],
[
68,
69
],
[
69,
70
],
[
9,
71
],
[
71,
72
],
[
9,
73
],
[
73,
74
],
[
9,
75
],
[
75,
76
],
[
9,
77
],
[
77,
78
],
[
170,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
81,
90
],
[
90,
91
],
[
90,
92
],
[
81,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
94,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
81,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
81,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
81,
123
],
[
123,
124
],
[
123,
125
],
[
81,
126
],
[
126,
127
],
[
81,
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
],
[
144,
145
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
147,
150
],
[
147,
151
],
[
151,
152
],
[
151,
153
],
[
147,
154
],
[
146,
155
],
[
155,
156
],
[
156,
157
],
[
81,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
81,
164
],
[
164,
165
],
[
165,
166
],
[
79,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\npublic class Main {\n\t\n\tstatic boolean search(int[] S,int a,int b,int target){\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tstatic boolean search(int[] S,int a,int b,int target){\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"Main",
"static boolean search(int[] S,int a,int b,int target){\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}",
"search",
"{\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}",
"if(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}",
"a<=b",
"a",
"b",
"{\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}",
"if(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}",
"S[(a+b)/2]==target",
"S[(a+b)/2]",
"S",
"(a+b)/2",
"(a+b)",
"a",
"b",
"2",
"target",
"{\n\t\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}",
"S[(a+b)/2]<target",
"S[(a+b)/2]",
"S",
"(a+b)/2",
"(a+b)",
"a",
"b",
"2",
"target",
"{\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}",
"return search(S,((a+b)/2)+1,b,target);",
"search(S,((a+b)/2)+1,b,target)",
"search",
"S",
"((a+b)/2)+1",
"((a+b)/2)",
"(a+b)",
"a",
"b",
"2",
"1",
"b",
"target",
"{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}",
"return search(S,a,((a+b)/2)-1,target);",
"search(S,a,((a+b)/2)-1,target)",
"search",
"S",
"a",
"((a+b)/2)-1",
"((a+b)/2)",
"(a+b)",
"a",
"b",
"2",
"1",
"target",
"{\n\t\t\treturn false;\n\t\t}",
"return false;",
"false",
"int[] S",
"S",
"int a",
"a",
"int b",
"b",
"int target",
"target",
"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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\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",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"int q=scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count=0;",
"count",
"0",
"int x;",
"x",
"for(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\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\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"x=scan.nextInt()",
"x",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}",
"search(S,0,n-1,x)",
"search",
"S",
"0",
"n-1",
"n",
"1",
"x",
"{\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 class Main {\n\t\n\tstatic boolean search(int[] S,int a,int b,int target){\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"public class Main {\n\t\n\tstatic boolean search(int[] S,int a,int b,int target){\n\t\tif(a<=b){\n\t\t\tif(S[(a+b)/2]==target){\n\t\t\t\treturn true;\n\t\t\t}else if(S[(a+b)/2]<target){\n\t\t\t\treturn search(S,((a+b)/2)+1,b,target);\n\t\t\t}else{\n\t\t\t\treturn search(S,a,((a+b)/2)-1,target);\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\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\tArrays.sort(S);\n\t\tint q=scan.nextInt();\n\t\tint count=0;\n\t\tint x;\n\t\tfor(int i=0;i<q;i++){\n\t\t\tx=scan.nextInt();\n\t\t\tif(search(S,0,n-1,x)){\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
static boolean search(int[] S,int a,int b,int target){
if(a<=b){
if(S[(a+b)/2]==target){
return true;
}else if(S[(a+b)/2]<target){
return search(S,((a+b)/2)+1,b,target);
}else{
return search(S,a,((a+b)/2)-1,target);
}
}else{
return false;
}
}
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();
}
Arrays.sort(S);
int q=scan.nextInt();
int count=0;
int x;
for(int i=0;i<q;i++){
x=scan.nextInt();
if(search(S,0,n-1,x)){
count++;
}
}
System.out.println(count);
scan.close();
}
} |
[
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,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
40,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
40,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
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,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
2,
13,
17,
29,
13,
29,
40,
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
],
[
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
],
[
36,
44
],
[
44,
45
],
[
11,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
11,
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
],
[
67,
75
],
[
75,
76
],
[
11,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
82,
85
],
[
9,
86
],
[
86,
87
],
[
7,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
94,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
110,
117
],
[
109,
118
],
[
118,
119
],
[
90,
120
],
[
120,
121
],
[
88,
122
],
[
122,
123
],
[
88,
124
],
[
124,
125
],
[
7,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
128,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
143,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
153,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
153,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
164,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
172,
174
],
[
164,
175
],
[
175,
176
],
[
128,
177
],
[
177,
178
],
[
178,
179
],
[
126,
180
],
[
180,
181
],
[
126,
182
],
[
182,
183
]
] | [
"import java.util.Scanner;\nimport java.util.Arrays;\n\nclass Main { \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n int[] S = new int[n];\n for (int i = 0; n != 0; i++) {\n S[i] = in.nextInt();\n n--;\n }\n \n int q = in.nextInt();\n int[] T = new int[q];\n for (int i = 0; q != 0; i++) {\n T[i] = in.nextInt();\n q--;\n }\n \n System.out.println(include(S, T));\n }\n \n static int include(int[] S, int[] T) {\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) >= 0) count++;\n }\n return count;\n }\n static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\n }\n return -1;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"class Main { \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n int[] S = new int[n];\n for (int i = 0; n != 0; i++) {\n S[i] = in.nextInt();\n n--;\n }\n \n int q = in.nextInt();\n int[] T = new int[q];\n for (int i = 0; q != 0; i++) {\n T[i] = in.nextInt();\n q--;\n }\n \n System.out.println(include(S, T));\n }\n \n static int include(int[] S, int[] T) {\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) >= 0) count++;\n }\n return count;\n }\n static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\n }\n return -1;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n int[] S = new int[n];\n for (int i = 0; n != 0; i++) {\n S[i] = in.nextInt();\n n--;\n }\n \n int q = in.nextInt();\n int[] T = new int[q];\n for (int i = 0; q != 0; i++) {\n T[i] = in.nextInt();\n q--;\n }\n \n System.out.println(include(S, T));\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n int[] S = new int[n];\n for (int i = 0; n != 0; i++) {\n S[i] = in.nextInt();\n n--;\n }\n \n int q = in.nextInt();\n int[] T = new int[q];\n for (int i = 0; q != 0; i++) {\n T[i] = in.nextInt();\n q--;\n }\n \n System.out.println(include(S, T));\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i = 0; n != 0; i++) {\n S[i] = in.nextInt();\n n--;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"n != 0",
"n",
"0",
"i++",
"i++",
"i",
"{\n S[i] = in.nextInt();\n n--;\n }",
"{\n S[i] = in.nextInt();\n n--;\n }",
"S[i] = in.nextInt()",
"S[i]",
"S",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"n--",
"n",
"int q = in.nextInt();",
"q",
"in.nextInt()",
"in.nextInt",
"in",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i = 0; q != 0; i++) {\n T[i] = in.nextInt();\n q--;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"q != 0",
"q",
"0",
"i++",
"i++",
"i",
"{\n T[i] = in.nextInt();\n q--;\n }",
"{\n T[i] = in.nextInt();\n q--;\n }",
"T[i] = in.nextInt()",
"T[i]",
"T",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"q--",
"q",
"System.out.println(include(S, T))",
"System.out.println",
"System.out",
"System",
"System.out",
"include(S, T)",
"include",
"S",
"T",
"String[] args",
"args",
"static int include(int[] S, int[] T) {\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) >= 0) count++;\n }\n return count;\n }",
"include",
"{\n int count = 0;\n for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) >= 0) count++;\n }\n return count;\n }",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < T.length; i++) {\n if (binarySearch(S, T[i]) >= 0) 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]) >= 0) count++;\n }",
"{\n if (binarySearch(S, T[i]) >= 0) count++;\n }",
"if (binarySearch(S, T[i]) >= 0) count++;",
"binarySearch(S, T[i]) >= 0",
"binarySearch(S, T[i])",
"binarySearch",
"S",
"T[i]",
"T",
"i",
"0",
"count++",
"count",
"return count;",
"count",
"int[] S",
"S",
"int[] T",
"T",
"static int binarySearch(int[] a, int key) {\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\n }\n return -1;\n }",
"binarySearch",
"{\n int lo = 0;\n int hi = a.length - 1;\n while (lo <= hi) {\n // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\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 // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\n }",
"lo <= hi",
"lo",
"hi",
"{\n // Key is in a[lo..hi] or not present.\n int mid = lo + (hi - lo) / 2;\n if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;\n }",
"int mid = lo + (hi - lo) / 2;",
"mid",
"lo + (hi - lo) / 2",
"lo",
"(hi - lo) / 2",
"(hi - lo)",
"hi",
"lo",
"2",
"if (key < a[mid]) hi = mid - 1;\n else if (key > a[mid]) lo = mid + 1;\n else return mid;",
"key < a[mid]",
"key",
"a[mid]",
"a",
"mid",
"hi = mid - 1",
"hi",
"mid - 1",
"mid",
"1",
"if (key > a[mid]) lo = mid + 1;\n else return mid;",
"key > a[mid]",
"key",
"a[mid]",
"a",
"mid",
"lo = mid + 1",
"lo",
"mid + 1",
"mid",
"1",
"return mid;",
"mid",
"return -1;",
"-1",
"1",
"int[] a",
"a",
"int key",
"key"
] | import java.util.Scanner;
import java.util.Arrays;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] S = new int[n];
for (int i = 0; n != 0; i++) {
S[i] = in.nextInt();
n--;
}
int q = in.nextInt();
int[] T = new int[q];
for (int i = 0; q != 0; i++) {
T[i] = in.nextInt();
q--;
}
System.out.println(include(S, T));
}
static int include(int[] S, int[] T) {
int count = 0;
for (int i = 0; i < T.length; i++) {
if (binarySearch(S, T[i]) >= 0) count++;
}
return count;
}
static int binarySearch(int[] a, int key) {
int lo = 0;
int hi = a.length - 1;
while (lo <= hi) {
// Key is in a[lo..hi] or not present.
int mid = lo + (hi - lo) / 2;
if (key < a[mid]) hi = mid - 1;
else if (key > a[mid]) lo = mid + 1;
else return mid;
}
return -1;
}
} |
[
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,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
17,
41,
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,
0,
13,
13,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
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
],
[
171,
8
],
[
171,
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
],
[
48,
49
],
[
47,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
11,
56
],
[
56,
57
],
[
56,
58
],
[
11,
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
],
[
11,
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
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
92,
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
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
111,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
131,
133
],
[
123,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
11,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
11,
145
],
[
145,
146
],
[
146,
147
],
[
171,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
148,
160
],
[
160,
161
],
[
171,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
162,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main{\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n\tvoid debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\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\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n\tvoid debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main",
"void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}",
"run",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"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",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] 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 i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 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\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"while(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}",
"left < right",
"left",
"right",
"{\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}",
"int mid = (left + right)/2;",
"mid",
"(left + right)/2",
"(left + right)",
"left",
"right",
"2",
"if(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;",
"T[i] == S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"count++",
"count",
"break;",
"if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;",
"T[i] < S[mid]",
"T[i]",
"T",
"i",
"S[mid]",
"S",
"mid",
"right = mid",
"right",
"mid",
"left = mid + 1",
"left",
"mid + 1",
"mid",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"sc.close()",
"sc.close",
"sc",
"void debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}",
"debug",
"{\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}",
"System.out.println(Arrays.deepToString(o))",
"System.out.println",
"System.out",
"System",
"System.out",
"Arrays.deepToString(o)",
"Arrays.deepToString",
"Arrays",
"o",
"Object... o",
"o",
"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\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n\tvoid debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"public class Main{\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint n = sc.nextInt();\n\t\tint[] S = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tS[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(S);\n\t\tint q = sc.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor(int j = 0; j < q; j++) {\n\t\t\tT[j] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < q; i++) {\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\twhile(left < right) {\n\t\t\t\tint mid = (left + right)/2;\n\t\t\t\tif(T[i] == S[mid]) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(T[i] < S[mid]) right = mid;\n\t\t\t\telse left = mid + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n\tvoid debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\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{
void run() {
Scanner sc = new Scanner(System.in);
int count = 0;
int n = sc.nextInt();
int[] S = new int[n];
for(int i = 0; i < n; i++) {
S[i] = sc.nextInt();
}
Arrays.sort(S);
int q = sc.nextInt();
int[] T = new int[q];
for(int j = 0; j < q; j++) {
T[j] = sc.nextInt();
}
for(int i = 0; i < q; i++) {
int left = 0;
int right = n;
while(left < right) {
int mid = (left + right)/2;
if(T[i] == S[mid]) {
count++;
break;
}
else if(T[i] < S[mid]) right = mid;
else left = mid + 1;
}
}
System.out.println(count);
sc.close();
}
void debug(Object... o) {
System.out.println(Arrays.deepToString(o));
}
public static void main(String[] args) {
new Main().run();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
30,
29,
40,
17,
14,
2,
13,
18,
13,
13,
30,
29,
17,
14,
2,
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,
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,
13,
13,
18,
13,
13,
17,
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
],
[
395,
17
],
[
395,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
20,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
39,
41
],
[
36,
42
],
[
42,
43
],
[
43,
44
],
[
36,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
45,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
53,
56
],
[
53,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
45,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
63,
66
],
[
63,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
18,
71
],
[
71,
72
],
[
18,
73
],
[
73,
74
],
[
18,
75
],
[
75,
76
],
[
18,
77
],
[
77,
78
],
[
395,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
81,
90
],
[
90,
91
],
[
90,
92
],
[
81,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
94,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
81,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
81,
119
],
[
119,
120
],
[
119,
121
],
[
81,
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
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
81,
143
],
[
143,
144
],
[
143,
145
],
[
81,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
146,
154
],
[
154,
155
],
[
155,
156
],
[
146,
157
],
[
158,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
161,
164
],
[
164,
165
],
[
164,
166
],
[
161,
167
],
[
161,
168
],
[
168,
169
],
[
168,
170
],
[
160,
171
],
[
159,
172
],
[
172,
173
],
[
173,
174
],
[
81,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
79,
181
],
[
181,
182
],
[
395,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
183,
187
],
[
187,
188
],
[
187,
189
],
[
183,
191
],
[
191,
192
],
[
183,
193
],
[
193,
194
],
[
183,
195
],
[
195,
196
],
[
183,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
197,
205
],
[
205,
206
],
[
183,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
210,
215
],
[
215,
216
],
[
209,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
221,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
225,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
234,
237
],
[
221,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
238,
242
],
[
242,
243
],
[
243,
244
],
[
209,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
183,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
255,
256
],
[
252,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
252,
266
],
[
266,
267
],
[
266,
268
],
[
252,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
269,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
275,
278
],
[
274,
279
],
[
279,
280
],
[
279,
281
],
[
281,
282
],
[
252,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
183,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
289,
294
],
[
294,
295
],
[
295,
296
],
[
295,
297
],
[
294,
298
],
[
298,
299
],
[
298,
300
],
[
300,
301
],
[
289,
302
],
[
302,
303
],
[
302,
304
],
[
289,
305
],
[
305,
306
],
[
306,
307
],
[
306,
308
],
[
305,
309
],
[
309,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
309,
314
],
[
314,
315
],
[
314,
316
],
[
316,
317
],
[
289,
318
],
[
318,
319
],
[
318,
320
],
[
289,
321
],
[
321,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
321,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
332,
334
],
[
327,
335
],
[
335,
336
],
[
326,
337
],
[
337,
338
],
[
337,
339
],
[
326,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
342,
344
],
[
326,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
289,
349
],
[
349,
350
],
[
350,
351
],
[
350,
352
],
[
183,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
356,
357
],
[
357,
358
],
[
357,
359
],
[
356,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
361,
364
],
[
355,
365
],
[
365,
366
],
[
369,
367
],
[
379,
368
],
[
376,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
369,
373
],
[
373,
374
],
[
373,
375
],
[
376,
376
],
[
376,
377
],
[
376,
378
],
[
379,
379
],
[
379,
380
],
[
379,
381
],
[
369,
382
],
[
382,
383
],
[
382,
384
],
[
384,
385
],
[
353,
386
],
[
386,
387
],
[
183,
388
],
[
388,
389
],
[
388,
390
],
[
390,
391
],
[
390,
392
],
[
392,
393
],
[
0,
394
],
[
394,
395
],
[
394,
396
]
] | [
"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 private static int binarySearch(int sp2[], int key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\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 (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\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 private static int binarySearch(int sp2[], int key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\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 (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {\n sum++;\n }\n }\n System.out.println(sum);\n }\n}",
"Main",
"private static int binarySearch(int sp2[], int key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > 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 -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > 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 -1;\n }",
"left > right",
"left",
"right",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"if (key==sp2[mid]) {\n return 1;\n } else if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }",
"key==sp2[mid]",
"key",
"sp2[mid]",
"sp2",
"mid",
"{\n return 1;\n }",
"return 1;",
"1",
"if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }",
"key > sp2[mid]",
"key",
"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",
"int sp2[]",
"sp2",
"int key",
"key",
"int left",
"left",
"int right",
"right",
"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 (binarySearch(sp1, sp2[j],0,sp1.length) > 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 (binarySearch(sp1, sp2[j],0,sp1.length) > 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 (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {\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,sp1.length) > 0) {\n sum++;\n }\n }",
"{\n if (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {\n sum++;\n }\n }",
"if (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {\n sum++;\n }",
"binarySearch(sp1, sp2[j],0,sp1.length) > 0",
"binarySearch(sp1, sp2[j],0,sp1.length)",
"binarySearch",
"sp1",
"sp2[j]",
"sp2",
"j",
"0",
"sp1.length",
"sp1",
"sp1.length",
"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 private static int binarySearch(int sp2[], int key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\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 (binarySearch(sp1, sp2[j],0,sp1.length) > 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 private static int binarySearch(int sp2[], int key, int left, int right) {\n int mid = (left + right) / 2;\n if (left > right) {\n return -1;\n }\n if (key==sp2[mid]) {\n return 1;\n } else if (key > sp2[mid]) {\n return binarySearch(sp2, key, mid+1, right);\n } else {\n return binarySearch(sp2, key, left, mid-1);\n }\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 (binarySearch(sp1, sp2[j],0,sp1.length) > 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);
}
}
private static int binarySearch(int sp2[], int key, int left, int right) {
int mid = (left + right) / 2;
if (left > right) {
return -1;
}
if (key==sp2[mid]) {
return 1;
} else if (key > sp2[mid]) {
return binarySearch(sp2, key, mid+1, right);
} else {
return binarySearch(sp2, key, left, mid-1);
}
}
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 (binarySearch(sp1, sp2[j],0,sp1.length) > 0) {
sum++;
}
}
System.out.println(sum);
}
}
|
[
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,
17,
41,
13,
4,
13,
13,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
4,
18,
13,
13,
13,
17,
30,
40,
13,
29,
13,
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
],
[
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,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
54,
57
],
[
54,
58
],
[
54,
59
],
[
11,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
9,
66
],
[
66,
67
],
[
7,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
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
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
94,
97
],
[
94,
98
],
[
93,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
70,
103
],
[
103,
104
],
[
68,
105
],
[
105,
106
],
[
68,
107
],
[
107,
108
],
[
68,
109
],
[
109,
110
],
[
68,
111
],
[
111,
112
]
] | [
"\nimport java.util.*;\nimport java.util.Arrays;\nclass Main {\n public static void main(String[] args) {\n \n Scanner scner = new Scanner(System.in);\n\n int n = scner.nextInt();\n int[] S = new int[n];\n for (int i=0; i<n; i++) {\n S[i] = scner.nextInt();\n }\n\n int q = scner.nextInt();\n int T = 0;\n \n int num = seSearch(S, T, q, scner);\n System.out.println(num);\n }\n\n public static int seSearch(int[] a, int b, int f,Scanner c){\n int solve = 0;\n for (int i=0; i<f; ++i){\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}\n return solve;\n\n } \n }",
"import java.util.*;",
"util.*",
"java",
"import java.util.Arrays;",
"Arrays",
"java.util",
"class Main {\n public static void main(String[] args) {\n \n Scanner scner = new Scanner(System.in);\n\n int n = scner.nextInt();\n int[] S = new int[n];\n for (int i=0; i<n; i++) {\n S[i] = scner.nextInt();\n }\n\n int q = scner.nextInt();\n int T = 0;\n \n int num = seSearch(S, T, q, scner);\n System.out.println(num);\n }\n\n public static int seSearch(int[] a, int b, int f,Scanner c){\n int solve = 0;\n for (int i=0; i<f; ++i){\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}\n return solve;\n\n } \n }",
"Main",
"public static void main(String[] args) {\n \n Scanner scner = new Scanner(System.in);\n\n int n = scner.nextInt();\n int[] S = new int[n];\n for (int i=0; i<n; i++) {\n S[i] = scner.nextInt();\n }\n\n int q = scner.nextInt();\n int T = 0;\n \n int num = seSearch(S, T, q, scner);\n System.out.println(num);\n }",
"main",
"{\n \n Scanner scner = new Scanner(System.in);\n\n int n = scner.nextInt();\n int[] S = new int[n];\n for (int i=0; i<n; i++) {\n S[i] = scner.nextInt();\n }\n\n int q = scner.nextInt();\n int T = 0;\n \n int num = seSearch(S, T, q, scner);\n System.out.println(num);\n }",
"Scanner scner = new Scanner(System.in);",
"scner",
"new Scanner(System.in)",
"int n = scner.nextInt();",
"n",
"scner.nextInt()",
"scner.nextInt",
"scner",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {\n S[i] = scner.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S[i] = scner.nextInt();\n }",
"{\n S[i] = scner.nextInt();\n }",
"S[i] = scner.nextInt()",
"S[i]",
"S",
"i",
"scner.nextInt()",
"scner.nextInt",
"scner",
"int q = scner.nextInt();",
"q",
"scner.nextInt()",
"scner.nextInt",
"scner",
"int T = 0;",
"T",
"0",
"int num = seSearch(S, T, q, scner);",
"num",
"seSearch(S, T, q, scner)",
"seSearch",
"S",
"T",
"q",
"scner",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"String[] args",
"args",
"public static int seSearch(int[] a, int b, int f,Scanner c){\n int solve = 0;\n for (int i=0; i<f; ++i){\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}\n return solve;\n\n }",
"seSearch",
"{\n int solve = 0;\n for (int i=0; i<f; ++i){\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}\n return solve;\n\n }",
"int solve = 0;",
"solve",
"0",
"for (int i=0; i<f; ++i){\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<f",
"i",
"f",
"++i",
"++i",
"i",
"{\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}",
"{\n b = c.nextInt();\n if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }\n \n \n \n}",
"b = c.nextInt()",
"b",
"c.nextInt()",
"c.nextInt",
"c",
"if (Arrays.binarySearch(a,b) >= 0) {\n solve++;\n }",
"Arrays.binarySearch(a,b) >= 0",
"Arrays.binarySearch(a,b)",
"Arrays.binarySearch",
"Arrays",
"a",
"b",
"0",
"{\n solve++;\n }",
"solve++",
"solve",
"return solve;",
"solve",
"int[] a",
"a",
"int b",
"b",
"int f",
"f",
"Scanner c",
"c"
] |
import java.util.*;
import java.util.Arrays;
class Main {
public static void main(String[] args) {
Scanner scner = new Scanner(System.in);
int n = scner.nextInt();
int[] S = new int[n];
for (int i=0; i<n; i++) {
S[i] = scner.nextInt();
}
int q = scner.nextInt();
int T = 0;
int num = seSearch(S, T, q, scner);
System.out.println(num);
}
public static int seSearch(int[] a, int b, int f,Scanner c){
int solve = 0;
for (int i=0; i<f; ++i){
b = c.nextInt();
if (Arrays.binarySearch(a,b) >= 0) {
solve++;
}
}
return solve;
}
}
|
[
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,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
41,
13,
41,
13,
28,
13,
13,
30,
30,
0,
13,
17,
0,
13,
18,
13,
13,
42,
17,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
3,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
30,
0,
13,
13,
14,
2,
13,
13,
30,
3,
4,
18,
18,
13,
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
],
[
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
],
[
70,
73
],
[
6,
74
],
[
74,
75
],
[
4,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
78,
84
],
[
84,
85
],
[
78,
86
],
[
86,
87
],
[
78,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
103,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
121,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
103,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
78,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
76,
149
],
[
149,
150
],
[
76,
151
],
[
151,
152
]
] | [
"import java.util.Scanner;\n\nclass Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n\n int[] elements = new int[size];\n for (int i = 0; i < size; i++) {\n elements[i] = sc.nextInt();\n }\n\n int searchSize = sc.nextInt();\n int[] searches = new int[searchSize];\n for (int i = 0; i < searchSize; i++) {\n searches[i] = sc.nextInt();\n }\n\n search(elements, searches);\n }\n\n public static void search(int[] elements, int[] searches) {\n int count = 0;\n int s;\n int l;\n int m;\n for (int search : searches) {\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }\n System.out.println(count);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n\n int[] elements = new int[size];\n for (int i = 0; i < size; i++) {\n elements[i] = sc.nextInt();\n }\n\n int searchSize = sc.nextInt();\n int[] searches = new int[searchSize];\n for (int i = 0; i < searchSize; i++) {\n searches[i] = sc.nextInt();\n }\n\n search(elements, searches);\n }\n\n public static void search(int[] elements, int[] searches) {\n int count = 0;\n int s;\n int l;\n int m;\n for (int search : searches) {\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n\n int[] elements = new int[size];\n for (int i = 0; i < size; i++) {\n elements[i] = sc.nextInt();\n }\n\n int searchSize = sc.nextInt();\n int[] searches = new int[searchSize];\n for (int i = 0; i < searchSize; i++) {\n searches[i] = sc.nextInt();\n }\n\n search(elements, searches);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n\n int[] elements = new int[size];\n for (int i = 0; i < size; i++) {\n elements[i] = sc.nextInt();\n }\n\n int searchSize = sc.nextInt();\n int[] searches = new int[searchSize];\n for (int i = 0; i < searchSize; i++) {\n searches[i] = sc.nextInt();\n }\n\n search(elements, searches);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int size = sc.nextInt();",
"size",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] elements = new int[size];",
"elements",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n elements[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n elements[i] = sc.nextInt();\n }",
"{\n elements[i] = sc.nextInt();\n }",
"elements[i] = sc.nextInt()",
"elements[i]",
"elements",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int searchSize = sc.nextInt();",
"searchSize",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] searches = new int[searchSize];",
"searches",
"new int[searchSize]",
"searchSize",
"for (int i = 0; i < searchSize; i++) {\n searches[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < searchSize",
"i",
"searchSize",
"i++",
"i++",
"i",
"{\n searches[i] = sc.nextInt();\n }",
"{\n searches[i] = sc.nextInt();\n }",
"searches[i] = sc.nextInt()",
"searches[i]",
"searches",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"search(elements, searches)",
"search",
"elements",
"searches",
"String... args",
"args",
"public static void search(int[] elements, int[] searches) {\n int count = 0;\n int s;\n int l;\n int m;\n for (int search : searches) {\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }\n System.out.println(count);\n }",
"search",
"{\n int count = 0;\n int s;\n int l;\n int m;\n for (int search : searches) {\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }\n System.out.println(count);\n }",
"int count = 0;",
"count",
"0",
"int s;",
"s",
"int l;",
"l",
"int m;",
"m",
"for (int search : searches) {\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }",
"int search",
"searches",
"{\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }",
"{\n s = 0;\n l = elements.length;\n while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }\n }",
"s = 0",
"s",
"0",
"l = elements.length",
"l",
"elements.length",
"elements",
"elements.length",
"while (true) {\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }",
"true",
"{\n m = (s + l) / 2;\n\n if (elements[m]==search) {\n count++;\n break;\n }\n\n if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }\n\n if (s >= l) {\n break;\n }\n }",
"m = (s + l) / 2",
"m",
"(s + l) / 2",
"(s + l)",
"s",
"l",
"2",
"if (elements[m]==search) {\n count++;\n break;\n }",
"elements[m]==search",
"elements[m]",
"elements",
"m",
"search",
"{\n count++;\n break;\n }",
"count++",
"count",
"break;",
"if (search >= elements[m]) {\n s = m + 1;\n } else {\n l = m;\n }",
"search >= elements[m]",
"search",
"elements[m]",
"elements",
"m",
"{\n s = m + 1;\n }",
"s = m + 1",
"s",
"m + 1",
"m",
"1",
"{\n l = m;\n }",
"l = m",
"l",
"m",
"if (s >= l) {\n break;\n }",
"s >= l",
"s",
"l",
"{\n break;\n }",
"break;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] elements",
"elements",
"int[] searches",
"searches"
] | import java.util.Scanner;
class Main {
public static void main(String... args) {
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();
int[] elements = new int[size];
for (int i = 0; i < size; i++) {
elements[i] = sc.nextInt();
}
int searchSize = sc.nextInt();
int[] searches = new int[searchSize];
for (int i = 0; i < searchSize; i++) {
searches[i] = sc.nextInt();
}
search(elements, searches);
}
public static void search(int[] elements, int[] searches) {
int count = 0;
int s;
int l;
int m;
for (int search : searches) {
s = 0;
l = elements.length;
while (true) {
m = (s + l) / 2;
if (elements[m]==search) {
count++;
break;
}
if (search >= elements[m]) {
s = m + 1;
} else {
l = m;
}
if (s >= l) {
break;
}
}
}
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,
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,
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,
41,
13,
17,
41,
13,
13,
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,
14,
2,
18,
13,
13,
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
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
132,
14
],
[
132,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
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
],
[
17,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
17,
57
],
[
57,
58
],
[
57,
59
],
[
17,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
17,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
77,
83
],
[
83,
84
],
[
83,
85
],
[
77,
86
],
[
86,
87
],
[
86,
88
],
[
77,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
103,
112
],
[
112,
113
],
[
112,
114
],
[
77,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
115,
121
],
[
121,
122
],
[
17,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
15,
129
],
[
129,
130
],
[
0,
131
],
[
131,
132
],
[
131,
133
]
] | [
"import java.io.*;\nimport java.util.*;\nimport java.lang.Math;\nimport java.util.Arrays;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }\n \n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.lang.Math;",
"Math",
"java.lang",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }\n \n}",
"Main",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = 0;",
"n",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int 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",
"Arrays.sort(A)",
"Arrays.sort",
"Arrays",
"A",
"int ans = 0;",
"ans",
"0",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }",
"{\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }",
"int m = sc.nextInt();",
"m",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ok = 0",
"ok",
"0",
"ng = n;",
"ng",
"n",
"while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }",
"ng - ok > 1",
"ng - ok",
"ng",
"ok",
"1",
"{\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }",
"int mid = (ok + ng) / 2;",
"mid",
"(ok + ng) / 2",
"(ok + ng)",
"ok",
"ng",
"2",
"if(A[mid] <= m)ok = mid;\n else ng = mid;",
"A[mid] <= m",
"A[mid]",
"A",
"mid",
"m",
"ok = mid",
"ok",
"mid",
"ng = mid",
"ng",
"mid",
"if(A[ok] == m)ans++;",
"A[ok] == m",
"A[ok]",
"A",
"ok",
"m",
"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\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }\n \n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n \n int n = 0;\n n = sc.nextInt();\n int A[] = new int[n];\n for(int i = 0; i < n; i++){\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int ans = 0;\n int q = sc.nextInt();\n for(int i = 0; i < q; i++){\n int m = sc.nextInt();\n int ok = 0, ng = n;\n while(ng - ok > 1){\n int mid = (ok + ng) / 2;\n if(A[mid] <= m)ok = mid;\n else ng = mid;\n }\n if(A[ok] == m)ans++;\n }\n System.out.println(ans);\n }\n \n}",
"Main"
] | import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = 0;
n = sc.nextInt();
int A[] = new int[n];
for(int i = 0; i < n; i++){
A[i] = sc.nextInt();
}
Arrays.sort(A);
int ans = 0;
int q = sc.nextInt();
for(int i = 0; i < q; i++){
int m = sc.nextInt();
int ok = 0, ng = n;
while(ng - ok > 1){
int mid = (ok + ng) / 2;
if(A[mid] <= m)ok = mid;
else ng = mid;
}
if(A[ok] == m)ans++;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
2,
13,
17,
11,
1,
0,
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,
41,
13,
20,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
0,
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
],
[
146,
5
],
[
146,
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
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
24,
27
],
[
27,
28
],
[
28,
29
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
33,
34
],
[
33,
35
],
[
8,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
36,
41
],
[
41,
42
],
[
41,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
36,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
8,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
8,
67
],
[
67,
68
],
[
67,
69
],
[
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
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
94,
95
],
[
8,
96
],
[
96,
97
],
[
96,
98
],
[
8,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
99,
110
],
[
111,
111
],
[
111,
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
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
8,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
6,
143
],
[
143,
144
],
[
0,
145
],
[
145,
146
],
[
145,
147
]
] | [
"import java.util.Scanner;\n\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\tpublic static void main(String args[]){\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String args[]){\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}",
"main",
"{\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}",
"int i",
"i",
"j",
"j",
"k",
"k",
"n",
"n",
"q;",
"q",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n=Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"long s[]=new long[n+1];",
"s",
"new long[n+1]",
"n+1",
"n",
"1",
"for(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}",
"{\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}",
"s[i]=Integer.parseInt(sc.next())",
"s[i]",
"s",
"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",
"long T[]=new long[q+1];",
"T",
"new long[q+1]",
"q+1",
"q",
"1",
"for(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}",
"i=0;",
"i=0",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}",
"{\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}",
"T[i]=Integer.parseInt(sc.next())",
"T[i]",
"T",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int count=0;",
"count",
"0",
"for(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}",
"j=0;",
"j=0",
"j",
"0",
"j<q",
"j",
"q",
"j++",
"j++",
"j",
"{\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}",
"{\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}",
"for(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}",
"{\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}",
"if(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}",
"T[j]==s[i]",
"T[j]",
"T",
"j",
"s[i]",
"s",
"i",
"{\n\t\t\tcount++;\n\t\t\tbreak;\n\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[]){\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}\n}",
"public class Main{\n\n\tpublic static void main(String args[]){\n\tint i,j,k,n,q;;\n\tScanner sc=new Scanner(System.in);\n\t\n\tn=Integer.parseInt(sc.next());\n\tlong s[]=new long[n+1];\n\tfor(i=0;i<n;i++){\n\t\ts[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tq=Integer.parseInt(sc.next());\n\tlong T[]=new long[q+1];\n\t\n\tfor(i=0;i<q;i++){\n\t\tT[i]=Integer.parseInt(sc.next());\n\t}\n\t\n\tint count=0;\n\t\n\tfor(j=0;j<q;j++){\n\t\tfor(i=0;i<n;i++){\n\tif(T[j]==s[i]){\n\t\t\tcount++;\n\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String args[]){
int i,j,k,n,q;;
Scanner sc=new Scanner(System.in);
n=Integer.parseInt(sc.next());
long s[]=new long[n+1];
for(i=0;i<n;i++){
s[i]=Integer.parseInt(sc.next());
}
q=Integer.parseInt(sc.next());
long T[]=new long[q+1];
for(i=0;i<q;i++){
T[i]=Integer.parseInt(sc.next());
}
int count=0;
for(j=0;j<q;j++){
for(i=0;i<n;i++){
if(T[j]==s[i]){
count++;
break;
}
}
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
42,
4,
18,
13,
30,
0,
13,
17,
0,
13,
4,
18,
13,
14,
2,
13,
17,
3,
0,
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,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
4,
13,
4,
18,
13,
40,
13,
4,
18,
18,
13,
13,
17,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
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,
2,
13,
17,
29,
17,
23,
13,
12,
13,
30,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
157,
5
],
[
157,
6
],
[
6,
7
],
[
157,
8
],
[
8,
9
],
[
157,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
12,
16
],
[
16,
17
],
[
12,
18
],
[
18,
19
],
[
12,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
24,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
24,
38
],
[
38,
39
],
[
38,
40
],
[
24,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
24,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
24,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
24,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
82,
88
],
[
88,
89
],
[
24,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
90,
96
],
[
157,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
99,
108
],
[
108,
109
],
[
99,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
122,
128
],
[
128,
129
],
[
114,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
130,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
130,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
99,
146
],
[
146,
147
],
[
97,
148
],
[
148,
149
],
[
157,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
150,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"import java.util.*;\n\npublic class Main{\n int n;\n long[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n boolean func(long v){\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n int n;\n long[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n boolean func(long v){\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"Main",
"int n;",
"n",
"long[] a;",
"a",
"Main(){\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }",
"Main",
"{\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int cnt",
"cnt",
"q;",
"q",
"while(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}",
"cnt = 0",
"cnt",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n == 0) break;",
"n == 0",
"n",
"0",
"break;",
"a = new long[n]",
"a",
"new long[n]",
"n",
"for(int i = 0; i < n; ++i) a[i] = sc.nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"a[i] = sc.nextLong();",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"++i",
"++i",
"i",
"if(func(sc.nextLong())) ++cnt;",
"if(func(sc.nextLong())) ++cnt;",
"func(sc.nextLong())",
"func",
"sc.nextLong()",
"sc.nextLong",
"sc",
"++cnt",
"cnt",
"System.out.printf(\"%d\\n\", cnt)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"cnt",
"boolean func(long v){\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }",
"func",
"{\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }",
"int p = 0",
"p",
"0",
"q = n-1",
"q",
"n-1",
"n",
"1",
"m;",
"m",
"while(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}",
"p <= q",
"p",
"q",
"{\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}",
"m = (p+q)/2",
"m",
"(p+q)/2",
"(p+q)",
"p",
"q",
"2",
"if(a[m] == v) return true;",
"a[m] == v",
"a[m]",
"a",
"m",
"v",
"return true;",
"true",
"if(a[m] > v) q = m-1;\n\t else p = m+1;",
"a[m] > v",
"a[m]",
"a",
"m",
"v",
"q = m-1",
"q",
"m-1",
"m",
"1",
"p = m+1",
"p",
"m+1",
"m",
"1",
"return false;",
"false",
"long v",
"v",
"public static void main(String[] args){\n\tnew Main();\n }",
"main",
"{\n\tnew Main();\n }",
"new Main()",
"String[] args",
"args",
"public class Main{\n int n;\n long[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n boolean func(long v){\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"public class Main{\n int n;\n long[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\tint cnt, q;\n\n\twhile(sc.hasNext()){\n\t cnt = 0;\n\t n = sc.nextInt();\n\t if(n == 0) break;\n\t a = new long[n];\n\n\t for(int i = 0; i < n; ++i) a[i] = sc.nextLong();\n\t Arrays.sort(a);\n\n\t q = sc.nextInt();\n\t for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n boolean func(long v){\n\tint p = 0, q = n-1, m;\n\n\twhile(p <= q){\n\t m = (p+q)/2;\n\t if(a[m] == v) return true;\n\t if(a[m] > v) q = m-1;\n\t else p = m+1;\n\t}\n\n\treturn false;\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"Main"
] | import java.util.*;
public class Main{
int n;
long[] a;
Main(){
Scanner sc = new Scanner(System.in);
int cnt, q;
while(sc.hasNext()){
cnt = 0;
n = sc.nextInt();
if(n == 0) break;
a = new long[n];
for(int i = 0; i < n; ++i) a[i] = sc.nextLong();
Arrays.sort(a);
q = sc.nextInt();
for(int i = 0; i < q; ++i) if(func(sc.nextLong())) ++cnt;
System.out.printf("%d\n", cnt);
}
}
boolean func(long v){
int p = 0, q = n-1, m;
while(p <= q){
m = (p+q)/2;
if(a[m] == v) return true;
if(a[m] > v) q = m-1;
else p = m+1;
}
return false;
}
public static void main(String[] args){
new Main();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
2,
13,
13,
41,
13,
2,
13,
2,
13,
17,
14,
2,
13,
13,
30,
29,
2,
18,
13,
13,
13,
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,
2,
13,
17,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
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,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
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,
0,
13,
17,
30,
30,
14,
4,
13,
13,
18,
13,
13,
17,
2,
18,
13,
13,
17,
30,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
218,
5
],
[
218,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
27,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
32,
38
],
[
38,
39
],
[
39,
40
],
[
32,
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
],
[
49,
54
],
[
41,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
57,
60
],
[
57,
61
],
[
61,
62
],
[
61,
63
],
[
57,
64
],
[
6,
65
],
[
65,
66
],
[
6,
67
],
[
67,
68
],
[
6,
69
],
[
69,
70
],
[
6,
71
],
[
71,
72
],
[
218,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
75,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
75,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
92,
97
],
[
75,
98
],
[
98,
99
],
[
98,
100
],
[
75,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
107,
108
],
[
107,
109
],
[
102,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
102,
114
],
[
115,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
123,
125
],
[
75,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
75,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
75,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
139,
144
],
[
75,
145
],
[
145,
146
],
[
145,
147
],
[
75,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
149,
161
],
[
162,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
170,
171
],
[
170,
172
],
[
75,
173
],
[
173,
174
],
[
173,
175
],
[
75,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
183,
185
],
[
176,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
176,
190
],
[
191,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
193,
196
],
[
196,
197
],
[
196,
198
],
[
193,
199
],
[
193,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
192,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
75,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
209,
214
],
[
73,
215
],
[
215,
216
],
[
0,
217
],
[
217,
218
],
[
217,
219
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\t\n\tpublic static boolean exist(int[] list, int number, int start, int end) {\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\t\n\tpublic static boolean exist(int[] list, int number, int start, int end) {\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}\n\n}",
"Main",
"public static boolean exist(int[] list, int number, int start, int end) {\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}",
"exist",
"{\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}",
"int l = end - start;",
"l",
"end - start",
"end",
"start",
"int midIndex = start + l/2;",
"midIndex",
"start + l/2",
"start",
"l/2",
"l",
"2",
"if(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}",
"start == end",
"start",
"end",
"{\n\t\t\treturn list[start] == number;\n\t\t}",
"return list[start] == number;",
"list[start] == number",
"list[start]",
"list",
"start",
"number",
"if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}",
"list[midIndex] == number",
"list[midIndex]",
"list",
"midIndex",
"number",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}",
"list[midIndex] > number",
"list[midIndex]",
"list",
"midIndex",
"number",
"{\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}",
"return exist(list,number,start,midIndex);",
"exist(list,number,start,midIndex)",
"exist",
"list",
"number",
"start",
"midIndex",
"{\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}",
"return exist(list, number, midIndex+1, end);",
"exist(list, number, midIndex+1, end)",
"exist",
"list",
"number",
"midIndex+1",
"midIndex",
"1",
"end",
"int[] list",
"list",
"int number",
"number",
"int start",
"start",
"int end",
"end",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String arraySizeS = sc.nextLine();",
"arraySizeS",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int arraySize = Integer.parseInt(arraySizeS);",
"arraySize",
"Integer.parseInt(arraySizeS)",
"Integer.parseInt",
"Integer",
"arraySizeS",
"String[] inputArrayS = sc.nextLine().split(\" \");",
"inputArrayS",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] inputArray = new int[arraySize];",
"inputArray",
"new int[arraySize]",
"arraySize",
"for( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arraySize",
"i",
"arraySize",
"i += 1",
"i += 1",
"i",
"1",
"{\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}",
"{\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}",
"inputArray[i] = Integer.parseInt(inputArrayS[i])",
"inputArray[i]",
"inputArray",
"i",
"Integer.parseInt(inputArrayS[i])",
"Integer.parseInt",
"Integer",
"inputArrayS[i]",
"inputArrayS",
"i",
"String arraySizeS2 = sc.nextLine();",
"arraySizeS2",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int arraySize2 = Integer.parseInt(arraySizeS2);",
"arraySize2",
"Integer.parseInt(arraySizeS2)",
"Integer.parseInt",
"Integer",
"arraySizeS2",
"String[] inputArrayS2 = sc.nextLine().split(\" \");",
"inputArrayS2",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] inputArray2 = new int[arraySize2];",
"inputArray2",
"new int[arraySize2]",
"arraySize2",
"for( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < arraySize2",
"j",
"arraySize2",
"j += 1",
"j += 1",
"j",
"1",
"{\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}",
"{\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}",
"inputArray2[j] = Integer.parseInt(inputArrayS2[j])",
"inputArray2[j]",
"inputArray2",
"j",
"Integer.parseInt(inputArrayS2[j])",
"Integer.parseInt",
"Integer",
"inputArrayS2[j]",
"inputArrayS2",
"j",
"int counter = 0;",
"counter",
"0",
"for(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}",
"int m = 0;",
"int m = 0;",
"m",
"0",
"m < inputArray2.length",
"m",
"inputArray2.length",
"inputArray2",
"inputArray2.length",
"m += 1",
"m += 1",
"m",
"1",
"{\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}",
"if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}",
"exist(inputArray,inputArray2[m],0,inputArray.length-1)",
"exist",
"inputArray",
"inputArray2[m]",
"inputArray2",
"m",
"0",
"inputArray.length-1",
"inputArray.length",
"inputArray",
"inputArray.length",
"1",
"{\n\t\t\t\tcounter += 1;\n\t\t\t}",
"counter += 1",
"counter",
"1",
"System.out.println(counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"counter",
"String[] args",
"args",
"public class Main {\n\n\t\n\tpublic static boolean exist(int[] list, int number, int start, int end) {\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}\n\n}",
"public class Main {\n\n\t\n\tpublic static boolean exist(int[] list, int number, int start, int end) {\n\t\n\t\tint l = end - start;\n\t\tint midIndex = start + l/2;\n\t\t\n\t\tif(start == end) {\n\t\t\treturn list[start] == number;\n\t\t}\n\t\telse if(list[midIndex] == number) {\n\t\t\treturn true;\n\t\t}\n\t\telse if(list[midIndex] > number) {\n\t\t\treturn exist(list,number,start,midIndex);\n\t\t}\n\t\telse {\n\t\t\treturn exist(list, number, midIndex+1, end);\n\t\t}\n\t\t\n\t\t\t\t\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString arraySizeS = sc.nextLine();\n\t\tint arraySize = Integer.parseInt(arraySizeS);\n\t\tString[] inputArrayS = sc.nextLine().split(\" \");\n\t\tint[] inputArray = new int[arraySize];\n\t\tfor( int i = 0; i < arraySize; i += 1) {\n\t\t\tinputArray[i] = Integer.parseInt(inputArrayS[i]);}\n\t\tString arraySizeS2 = sc.nextLine();\n\t\tint arraySize2 = Integer.parseInt(arraySizeS2);\n\t\tString[] inputArrayS2 = sc.nextLine().split(\" \");\n\t\tint[] inputArray2 = new int[arraySize2];\n\t\tfor( int j = 0; j < arraySize2; j += 1) {\n\t\t\tinputArray2[j] = Integer.parseInt(inputArrayS2[j]);\t\n\t\t}\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor(int m = 0; m < inputArray2.length; m += 1) {\n\t\t\tif (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {\n\t\t\t\tcounter += 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\t\t\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static boolean exist(int[] list, int number, int start, int end) {
int l = end - start;
int midIndex = start + l/2;
if(start == end) {
return list[start] == number;
}
else if(list[midIndex] == number) {
return true;
}
else if(list[midIndex] > number) {
return exist(list,number,start,midIndex);
}
else {
return exist(list, number, midIndex+1, end);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String arraySizeS = sc.nextLine();
int arraySize = Integer.parseInt(arraySizeS);
String[] inputArrayS = sc.nextLine().split(" ");
int[] inputArray = new int[arraySize];
for( int i = 0; i < arraySize; i += 1) {
inputArray[i] = Integer.parseInt(inputArrayS[i]);}
String arraySizeS2 = sc.nextLine();
int arraySize2 = Integer.parseInt(arraySizeS2);
String[] inputArrayS2 = sc.nextLine().split(" ");
int[] inputArray2 = new int[arraySize2];
for( int j = 0; j < arraySize2; j += 1) {
inputArray2[j] = Integer.parseInt(inputArrayS2[j]);
}
int counter = 0;
for(int m = 0; m < inputArray2.length; m += 1) {
if (exist(inputArray,inputArray2[m],0,inputArray.length-1)) {
counter += 1;
}
}
System.out.println(counter);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
4,
13,
17,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
40,
13,
29,
14,
2,
13,
13,
30,
29,
14,
2,
18,
13,
13,
13,
30,
4,
13,
13,
13,
14,
2,
18,
13,
13,
13,
30,
4,
13,
2,
13,
17,
13,
23,
13,
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
],
[
166,
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
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
97,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
14,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
12,
109
],
[
109,
110
],
[
166,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
121,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
144,
147
],
[
137,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
148,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
111,
161
],
[
161,
162
],
[
111,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\tstatic int[] s;\n\tstatic int tt;\n\tstatic int ans;\n\t\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 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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tprivate static void binarySearch(int startIndex, int endIndex) {\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tstatic int[] s;\n\tstatic int tt;\n\tstatic int ans;\n\t\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 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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tprivate static void binarySearch(int startIndex, int endIndex) {\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}\n}",
"Main",
"static int[] s;",
"s",
"static int tt;",
"tt",
"static int ans;",
"ans",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = 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\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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = 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\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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\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 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",
"ans = 0",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}",
"{\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}",
"tt = t[i]",
"tt",
"t[i]",
"t",
"i",
"binarySearch(0, n - 1)",
"binarySearch",
"0",
"n - 1",
"n",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"private static void binarySearch(int startIndex, int endIndex) {\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}",
"binarySearch",
"{\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}",
"int index = (startIndex + endIndex) / 2;",
"index",
"(startIndex + endIndex) / 2",
"(startIndex + endIndex)",
"startIndex",
"endIndex",
"2",
"if (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}",
"s[index] == tt",
"s[index]",
"s",
"index",
"tt",
"{\n\t\t\tans++;\n\t\t\treturn;\n\t\t}",
"ans++",
"ans",
"return;",
"if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}",
"startIndex == endIndex",
"startIndex",
"endIndex",
"{\n\t\t\treturn;\n\t\t}",
"return;",
"if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}",
"s[index] > tt",
"s[index]",
"s",
"index",
"tt",
"{\n\t\t\tbinarySearch(startIndex, index);\n\t\t}",
"binarySearch(startIndex, index)",
"binarySearch",
"startIndex",
"index",
"if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}",
"s[index] < tt",
"s[index]",
"s",
"index",
"tt",
"{\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}",
"binarySearch(index + 1, endIndex)",
"binarySearch",
"index + 1",
"index",
"1",
"endIndex",
"int startIndex",
"startIndex",
"int endIndex",
"endIndex",
"public class Main {\n\t\n\tstatic int[] s;\n\tstatic int tt;\n\tstatic int ans;\n\t\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 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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tprivate static void binarySearch(int startIndex, int endIndex) {\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}\n}",
"public class Main {\n\t\n\tstatic int[] s;\n\tstatic int tt;\n\tstatic int ans;\n\t\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 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\t\n\t\tans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\ttt = t[i];\n\t\t\tbinarySearch(0, n - 1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tprivate static void binarySearch(int startIndex, int endIndex) {\n\t\tint index = (startIndex + endIndex) / 2;\n\t\tif (s[index] == tt) {\n\t\t\tans++;\n\t\t\treturn;\n\t\t} else if (startIndex == endIndex) {\n\t\t\treturn;\n\t\t} else if (s[index] > tt) {\n\t\t\tbinarySearch(startIndex, index);\n\t\t} else if (s[index] < tt) {\n\t\t\tbinarySearch(index + 1, endIndex);\n\t\t}\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int[] s;
static int tt;
static int ans;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int 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();
}
ans = 0;
for (int i = 0; i < q; i++) {
tt = t[i];
binarySearch(0, n - 1);
}
System.out.println(ans);
}
private static void binarySearch(int startIndex, int endIndex) {
int index = (startIndex + endIndex) / 2;
if (s[index] == tt) {
ans++;
return;
} else if (startIndex == endIndex) {
return;
} else if (s[index] > tt) {
binarySearch(startIndex, index);
} else if (s[index] < tt) {
binarySearch(index + 1, endIndex);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
20,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
20,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
20,
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,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
4,
13,
18,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
2,
13,
17,
2,
2,
13,
13,
17,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
17,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
226,
5
],
[
226,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
13,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
28
],
[
28,
29
],
[
29,
30
],
[
8,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
8,
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
],
[
8,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
99,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
114,
121
],
[
121,
122
],
[
8,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
6,
129
],
[
129,
130
],
[
226,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
133,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
133,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
133,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
154,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
165,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
175,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
175,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
197
],
[
192,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
204,
208
],
[
133,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
209,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
133,
219
],
[
219,
220
],
[
131,
221
],
[
221,
222
],
[
131,
223
],
[
223,
224
],
[
0,
225
],
[
225,
226
],
[
225,
227
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}\n\t\n\tpublic static boolean contains(int query, int[] check) {\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}\n\t\n\tpublic static boolean contains(int query, int[] check) {\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}",
"main",
"{\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}",
"int[] S;",
"S",
"int[] T;",
"T",
"int C = 0;",
"C",
"0",
"Scanner keyboard = new Scanner(System.in);",
"keyboard",
"new Scanner(System.in)",
"int S_length = keyboard.nextInt();",
"S_length",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"S = new int[S_length]",
"S",
"new int[S_length]",
"S_length",
"keyboard.nextLine()",
"keyboard.nextLine",
"keyboard",
"String S_inputString = keyboard.nextLine();",
"S_inputString",
"keyboard.nextLine()",
"keyboard.nextLine",
"keyboard",
"Scanner S_input = new Scanner(S_inputString);",
"S_input",
"new Scanner(S_inputString)",
"int T_length = keyboard.nextInt();",
"T_length",
"keyboard.nextInt()",
"keyboard.nextInt",
"keyboard",
"T = new int[T_length]",
"T",
"new int[T_length]",
"T_length",
"keyboard.nextLine()",
"keyboard.nextLine",
"keyboard",
"String T_inputString = keyboard.nextLine();",
"T_inputString",
"keyboard.nextLine()",
"keyboard.nextLine",
"keyboard",
"Scanner T_input = new Scanner(T_inputString);",
"T_input",
"new Scanner(T_inputString)",
"for(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < S_length",
"i",
"S_length",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = S_input.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = S_input.nextInt();\n\t\t}",
"S[i] = S_input.nextInt()",
"S[i]",
"S",
"i",
"S_input.nextInt()",
"S_input.nextInt",
"S_input",
"for(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T_length",
"i",
"T_length",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = T_input.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = T_input.nextInt();\n\t\t}",
"T[i] = T_input.nextInt()",
"T[i]",
"T",
"i",
"T_input.nextInt()",
"T_input.nextInt",
"T_input",
"for(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\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\tif(contains(T[i], S)) C++;\n\t\t}",
"{\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}",
"if(contains(T[i], S)) C++;",
"contains(T[i], S)",
"contains",
"T[i]",
"T",
"i",
"S",
"C++",
"C",
"System.out.println(C)",
"System.out.println",
"System.out",
"System",
"System.out",
"C",
"String[] args",
"args",
"public static boolean contains(int query, int[] check) {\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}",
"contains",
"{\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}",
"boolean containsInt = false;",
"containsInt",
"false",
"int low_index = 0;",
"low_index",
"0",
"int high_index = check.length - 1;",
"high_index",
"check.length - 1",
"check.length",
"check",
"check.length",
"1",
"int middle_index = check.length / 2;",
"middle_index",
"check.length / 2",
"check.length",
"check",
"check.length",
"2",
"while(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}",
"containsInt == false && high_index - low_index > 1",
"containsInt == false",
"containsInt",
"false",
"high_index - low_index > 1",
"high_index - low_index",
"high_index",
"low_index",
"1",
"{\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}",
"if(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}",
"check[middle_index] == query",
"check[middle_index]",
"check",
"middle_index",
"query",
"{\n\t\t\t\tcontainsInt = true;\n\t\t\t}",
"containsInt = true",
"containsInt",
"true",
"if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}",
"check[middle_index] > query",
"check[middle_index]",
"check",
"middle_index",
"query",
"{\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}",
"high_index = middle_index",
"high_index",
"middle_index",
"middle_index = (high_index + low_index) / 2",
"middle_index",
"(high_index + low_index) / 2",
"(high_index + low_index)",
"high_index",
"low_index",
"2",
"if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}",
"check[middle_index] < query",
"check[middle_index]",
"check",
"middle_index",
"query",
"{\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}",
"low_index = middle_index",
"low_index",
"middle_index",
"middle_index = (high_index + low_index) / 2",
"middle_index",
"(high_index + low_index) / 2",
"(high_index + low_index)",
"high_index",
"low_index",
"2",
"if(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}",
"check[high_index] == query",
"check[high_index]",
"check",
"high_index",
"query",
"{\n\t\t\tcontainsInt = true;\n\t\t}",
"containsInt = true",
"containsInt",
"true",
"return containsInt;",
"containsInt",
"int query",
"query",
"int[] check",
"check",
"public class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}\n\t\n\tpublic static boolean contains(int query, int[] check) {\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}\n}",
"public class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tint[] S;\n\t\tint[] T;\n\t\tint C = 0;\n\t\t\n\t\tScanner keyboard = new Scanner(System.in);\n\t\t\n\t\tint S_length = keyboard.nextInt();\n\t\tS = new int[S_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString S_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner S_input = new Scanner(S_inputString);\n\t\t\n\t\tint T_length = keyboard.nextInt();\n\t\tT = new int[T_length];\n\t\t\n\t\tkeyboard.nextLine();\n\t\t\n\t\tString T_inputString = keyboard.nextLine();\n\t\t\n\t\tScanner T_input = new Scanner(T_inputString);\n\t\t\n\t\tfor(int i = 0; i < S_length; i++) {\n\t\t\tS[i] = S_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T_length; i++) {\n\t\t\tT[i] = T_input.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < T.length; i++) {\n\t\t\tif(contains(T[i], S)) C++;\n\t\t}\n\t\t\n\t\tSystem.out.println(C);\n\t\t\n\t}\n\t\n\tpublic static boolean contains(int query, int[] check) {\n\t\t\n\t\tboolean containsInt = false;\n\t\t\n\t\tint low_index = 0;\n\t\tint high_index = check.length - 1;\n\t\tint middle_index = check.length / 2;\n//\t\tint iteration = 0;\n\t\t\n\t\twhile(containsInt == false && high_index - low_index > 1) {\n\t\t\t\n//\t\t\titeration++;\n//\t\t\t\n//\t\t\tSystem.out.println(\"----------------\");\n//\t\t\tSystem.out.println(\"Query: \" + query);\n//\t\t\tSystem.out.println(\"Iteration: \" + iteration);\n//\t\t\tSystem.out.println(\"L: \" + low_index);\n//\t\t\tSystem.out.println(\"M: \" + middle_index);\n//\t\t\tSystem.out.println(\"H: \" + high_index);\n\t\t\t\n\t\t\tif(check[middle_index] == query) {\n\t\t\t\tcontainsInt = true;\n\t\t\t}\n\t\t\telse if(check[middle_index] > query) {\n\t\t\t\thigh_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\telse if(check[middle_index] < query) {\n\t\t\t\tlow_index = middle_index;\n\t\t\t\tmiddle_index = (high_index + low_index) / 2;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(check[high_index] == query) {\n\t\t\tcontainsInt = true;\n\t\t}\n\t\t\n\t\treturn containsInt;\n\t\t\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
int[] S;
int[] T;
int C = 0;
Scanner keyboard = new Scanner(System.in);
int S_length = keyboard.nextInt();
S = new int[S_length];
keyboard.nextLine();
String S_inputString = keyboard.nextLine();
Scanner S_input = new Scanner(S_inputString);
int T_length = keyboard.nextInt();
T = new int[T_length];
keyboard.nextLine();
String T_inputString = keyboard.nextLine();
Scanner T_input = new Scanner(T_inputString);
for(int i = 0; i < S_length; i++) {
S[i] = S_input.nextInt();
}
for(int i = 0; i < T_length; i++) {
T[i] = T_input.nextInt();
}
for(int i = 0; i < T.length; i++) {
if(contains(T[i], S)) C++;
}
System.out.println(C);
}
public static boolean contains(int query, int[] check) {
boolean containsInt = false;
int low_index = 0;
int high_index = check.length - 1;
int middle_index = check.length / 2;
// int iteration = 0;
while(containsInt == false && high_index - low_index > 1) {
// iteration++;
//
// System.out.println("----------------");
// System.out.println("Query: " + query);
// System.out.println("Iteration: " + iteration);
// System.out.println("L: " + low_index);
// System.out.println("M: " + middle_index);
// System.out.println("H: " + high_index);
if(check[middle_index] == query) {
containsInt = true;
}
else if(check[middle_index] > query) {
high_index = middle_index;
middle_index = (high_index + low_index) / 2;
}
else if(check[middle_index] < query) {
low_index = middle_index;
middle_index = (high_index + low_index) / 2;
}
}
if(check[high_index] == query) {
containsInt = true;
}
return containsInt;
}
}
|
[
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
17,
40,
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
],
[
88,
8
],
[
88,
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,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
65,
73
],
[
64,
74
],
[
74,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
11,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
9,
85
],
[
85,
86
],
[
0,
87
],
[
87,
88
],
[
87,
89
]
] | [
"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}\n} \n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}",
"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\t\t\ts[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i ++",
"i ++",
"i",
"{\n\t\t\ts[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\ts[i] = scanner.nextInt();\n\t\t}",
"s[i] = scanner.nextInt()",
"s[i]",
"s",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int q = scanner.nextInt();",
"q",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int c = 0;",
"c",
"0",
"for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < q",
"i",
"q",
"i ++",
"i ++",
"i",
"if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;",
"if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;",
"Arrays.binarySearch(s, scanner.nextInt()) >= 0",
"Arrays.binarySearch(s, scanner.nextInt())",
"Arrays.binarySearch",
"Arrays",
"s",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"0",
"c ++",
"c",
"scanner.close()",
"scanner.close",
"scanner",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] s = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i ++) {\n\t\t\ts[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tint q = scanner.nextInt();\n\t\tint c = 0;\n\n\t\tfor (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tSystem.out.println(c);\n\t}\n}",
"Main"
] | import java.util.*;
import java.io.*;
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 c = 0;
for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
scanner.close();
System.out.println(c);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
13,
13,
30,
29,
8,
2,
18,
13,
13,
13,
13,
40,
17,
41,
13,
2,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
30,
29,
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
13,
8,
2,
4,
13,
13,
13,
17,
17,
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
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
8,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
30,
36
],
[
30,
37
],
[
37,
38
],
[
23,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
23,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
48,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
58,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
6,
76
],
[
76,
77
],
[
6,
78
],
[
78,
79
],
[
164,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
82,
91
],
[
91,
92
],
[
91,
93
],
[
82,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
95,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
113,
114
],
[
82,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
82,
120
],
[
120,
121
],
[
120,
122
],
[
82,
123
],
[
123,
124
],
[
123,
125
],
[
82,
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
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
138,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
148,
151
],
[
147,
152
],
[
146,
153
],
[
146,
154
],
[
82,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
80,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"\nimport java.util.Scanner;\n\n//this implements the bin search which return the position if find, otherwise negative\npublic class Main {\n\tpublic static int bin_search(int[] arr, int elem) {\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static int bin_search(int[] arr, int elem) {\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}\n\n}",
"Main",
"public static int bin_search(int[] arr, int elem) {\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}",
"bin_search",
"{\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}",
"int lo = 0;",
"lo",
"0",
"int hi = arr.length-1;",
"hi",
"arr.length-1",
"arr.length",
"arr",
"arr.length",
"1",
"while(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}",
"lo <= hi",
"lo",
"hi",
"{\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}",
"if(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}",
"lo == hi",
"lo",
"hi",
"{\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}",
"return (arr[lo] == elem)? lo: -1;",
"(arr[lo] == elem)? lo: -1",
"(arr[lo] == elem)",
"arr[lo]",
"arr",
"lo",
"elem",
"lo",
"-1",
"1",
"int mid = lo + (hi - lo) /2;",
"mid",
"lo + (hi - lo) /2",
"lo",
"(hi - lo) /2",
"(hi - lo)",
"hi",
"lo",
"2",
"if(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}",
"arr[mid]> elem",
"arr[mid]",
"arr",
"mid",
"elem",
"{\n\t\t\t\thi = mid;\n\t\t\t}",
"hi = mid",
"hi",
"mid",
"if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}",
"arr[mid] < elem",
"arr[mid]",
"arr",
"mid",
"elem",
"{\n\t\t\t\tlo = mid+1;\n\t\t\t}",
"lo = mid+1",
"lo",
"mid+1",
"mid",
"1",
"{\n\t\t\t\treturn mid;\n\t\t\t}",
"return mid;",
"mid",
"return -1;",
"-1",
"1",
"int[] arr",
"arr",
"int elem",
"elem",
"public static void main(String[] args) {\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}",
"Scanner cin = new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int n = cin.nextInt();",
"n",
"cin.nextInt()",
"cin.nextInt",
"cin",
"int [] S = new int[n];",
"S",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\t\tS[i] = cin.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] = cin.nextInt();\n\t\t\t}",
"{\n\t\t\t\tS[i] = cin.nextInt();\n\t\t\t}",
"S[i] = cin.nextInt()",
"S[i]",
"S",
"i",
"cin.nextInt()",
"cin.nextInt",
"cin",
"int m = cin.nextInt();",
"m",
"cin.nextInt()",
"cin.nextInt",
"cin",
"int x_i = 0;",
"x_i",
"0",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}",
"{\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}",
"x_i = cin.nextInt()",
"x_i",
"cin.nextInt()",
"cin.nextInt",
"cin",
"count += (bin_search(S, x_i) >=0)? 1:0",
"count",
"(bin_search(S, x_i) >=0)? 1:0",
"(bin_search(S, x_i) >=0)",
"bin_search(S, x_i)",
"bin_search",
"S",
"x_i",
"0",
"1",
"0",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static int bin_search(int[] arr, int elem) {\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}\n\n}",
"public class Main {\n\tpublic static int bin_search(int[] arr, int elem) {\n\t\tint lo = 0;\n\t\tint hi = arr.length-1;\n\t\t\n\t\twhile(lo <= hi) {\n\t\t\tif(lo == hi) {\n\t\t\t\treturn (arr[lo] == elem)? lo: -1; \n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tif(arr[mid]> elem) {\n\t\t\t\thi = mid;\n\t\t\t}else if(arr[mid] < elem) {\n\t\t\t\tlo = mid+1;\n\t\t\t}else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t\tScanner cin = new Scanner(System.in);\n\t\t\tint n = cin.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] = cin.nextInt();\n\t\t\t}\n\t\t\t\n\t\t\tint m = cin.nextInt();\n\t\t\tint x_i = 0;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < m; i++) {\n\t\t\t\tx_i = cin.nextInt();\n\t\t\t\tcount += (bin_search(S, x_i) >=0)? 1:0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
//this implements the bin search which return the position if find, otherwise negative
public class Main {
public static int bin_search(int[] arr, int elem) {
int lo = 0;
int hi = arr.length-1;
while(lo <= hi) {
if(lo == hi) {
return (arr[lo] == elem)? lo: -1;
}
int mid = lo + (hi - lo) /2;
if(arr[mid]> elem) {
hi = mid;
}else if(arr[mid] < elem) {
lo = mid+1;
}else {
return mid;
}
}
return -1;
}
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int [] S = new int[n];
for(int i = 0; i < n; i++) {
S[i] = cin.nextInt();
}
int m = cin.nextInt();
int x_i = 0;
int count = 0;
for(int i = 0; i < m; i++) {
x_i = cin.nextInt();
count += (bin_search(S, x_i) >=0)? 1:0;
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
17,
41,
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,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
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,
2,
4,
13,
13,
17,
40,
13,
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
],
[
6,
8
],
[
147,
10
],
[
10,
11
],
[
147,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
14,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
30,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
35,
41
],
[
41,
42
],
[
27,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
43,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
43,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
54,
60
],
[
60,
61
],
[
60,
62
],
[
14,
63
],
[
63,
64
],
[
12,
65
],
[
65,
66
],
[
147,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
69,
78
],
[
78,
79
],
[
69,
80
],
[
80,
81
],
[
69,
82
],
[
82,
83
],
[
69,
84
],
[
84,
85
],
[
84,
86
],
[
69,
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
],
[
69,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
69,
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
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
130,
136
],
[
136,
137
],
[
69,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
67,
144
],
[
144,
145
],
[
0,
146
],
[
146,
147
],
[
146,
148
]
] | [
"\n\nimport java.util.Scanner;\n\npublic class Main {\n static int[] A = new int[1000000];\n static int n;\n\n public static int binarySearch(int key) {\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int[] A = new int[1000000];\n static int n;\n\n public static int binarySearch(int key) {\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }\n}",
"Main",
"static int[] A = new int[1000000];",
"A",
"new int[1000000]",
"1000000",
"static int n;",
"n",
"public static int binarySearch(int key) {\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }",
"binarySearch",
"{\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid;",
"mid",
"while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\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 1;\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 1;",
"key == A[mid]",
"key",
"A[mid]",
"A",
"mid",
"return 1;",
"1",
"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 0;",
"0",
"int key",
"key",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int i",
"i",
"q",
"q",
"k",
"k",
"sum = 0;",
"sum",
"0",
"for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }",
"i = 0;",
"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",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }",
"{\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }",
"k = sc.nextInt()",
"k",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(binarySearch(k) == 1) sum++;",
"binarySearch(k) == 1",
"binarySearch(k)",
"binarySearch",
"k",
"1",
"sum++",
"sum",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n static int[] A = new int[1000000];\n static int n;\n\n public static int binarySearch(int key) {\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n static int[] A = new int[1000000];\n static int n;\n\n public static int binarySearch(int key) {\n int left = 0;\n int right = n;\n int mid;\n\n while(left < right)\n {\n mid = (left + right) / 2;\n if(key == A[mid]) return 1;\n if(key > A[mid]) left = mid + 1;\n else if(key < A[mid]) right = mid;\n }\n return 0;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int i, q, k, sum = 0;\n for(i = 0; i < n; i++) {\n A[i] = sc.nextInt();\n }\n q = sc.nextInt();\n for(i = 0; i < q; i++) {\n k = sc.nextInt();\n if(binarySearch(k) == 1) sum++;\n }\n System.out.println(sum);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static int[] A = new int[1000000];
static int n;
public static int binarySearch(int key) {
int left = 0;
int right = n;
int mid;
while(left < right)
{
mid = (left + right) / 2;
if(key == A[mid]) return 1;
if(key > A[mid]) left = mid + 1;
else if(key < A[mid]) right = mid;
}
return 0;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
int i, q, k, sum = 0;
for(i = 0; i < n; i++) {
A[i] = sc.nextInt();
}
q = sc.nextInt();
for(i = 0; i < q; i++) {
k = sc.nextInt();
if(binarySearch(k) == 1) sum++;
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
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,
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,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
90,
8
],
[
90,
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
],
[
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
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
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
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
11,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
9,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
] | [
"import java.util.Scanner;\nimport java.util.TreeSet;\npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.TreeSet;",
"TreeSet",
"java.util",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"TreeSet<Integer> st = new TreeSet<>();",
"st",
"new TreeSet<>()",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int b=sc.nextInt();\n st.add(b);\n }",
"{\n int b=sc.nextInt();\n st.add(b);\n }",
"int b=sc.nextInt();",
"b",
"sc.nextInt()",
"sc.nextInt",
"sc",
"st.add(b)",
"st.add",
"st",
"b",
"int q=sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans=0;",
"ans",
"0",
"for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }",
"{\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }",
"int c=sc.nextInt();",
"c",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(st.contains(c)) ans++;",
"st.contains(c)",
"st.contains",
"st",
"c",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n TreeSet<Integer> st = new TreeSet<>();\n int n=sc.nextInt();\n for(int i=0;i<n;i++){\n int b=sc.nextInt();\n st.add(b);\n }\n int q=sc.nextInt();\n int ans=0;\n for(int i=0;i<q;i++){\n int c=sc.nextInt();\n if(st.contains(c)) ans++; \n }\n System.out.println(ans);\n sc.close();\n \n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
TreeSet<Integer> st = new TreeSet<>();
int n=sc.nextInt();
for(int i=0;i<n;i++){
int b=sc.nextInt();
st.add(b);
}
int q=sc.nextInt();
int ans=0;
for(int i=0;i<q;i++){
int c=sc.nextInt();
if(st.contains(c)) ans++;
}
System.out.println(ans);
sc.close();
}
}
|
[
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,
4,
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,
14,
2,
18,
13,
13,
18,
13,
13,
30,
3,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
140,
8
],
[
140,
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
],
[
74,
75
],
[
73,
76
],
[
11,
77
],
[
77,
78
],
[
77,
79
],
[
11,
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
],
[
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
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
106,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
11,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
11,
134
],
[
134,
135
],
[
135,
136
],
[
9,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
] | [
"import java.util.Scanner;\nimport java.util.Arrays;\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[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"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[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\n sc.close();\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[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\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[] T = new int[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\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[] 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",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int Sum = 0;",
"Sum",
"0",
"for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\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(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }",
"{\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }",
"for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }",
"{\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }",
"if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }",
"S[j] == T[i]",
"S[j]",
"S",
"j",
"T[i]",
"T",
"i",
"{\n Sum++;\n break;\n }",
"Sum++",
"Sum",
"break;",
"if(S[j] > T[i]){\n break;\n }",
"S[j] > T[i]",
"S[j]",
"S",
"j",
"T[i]",
"T",
"i",
"{\n break;\n }",
"break;",
"System.out.println(Sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"Sum",
"sc.close()",
"sc.close",
"sc",
"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[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\n sc.close();\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[q];\n for(int i = 0; i < q; i++){\n T[i] = sc.nextInt();\n }\n Arrays.sort(T);\n int Sum = 0;\n for(int i = 0; i < q; i++){\n for(int j = 0; j < n; j++){\n if(S[j] == T[i]){\n Sum++;\n break;\n }else if(S[j] > T[i]){\n break;\n }\n }\n }\n System.out.println(Sum);\n sc.close();\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.Arrays;
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();
}
Arrays.sort(T);
int Sum = 0;
for(int i = 0; i < q; i++){
for(int j = 0; j < n; j++){
if(S[j] == T[i]){
Sum++;
break;
}else if(S[j] > T[i]){
break;
}
}
}
System.out.println(Sum);
sc.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,
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,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
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
],
[
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
],
[
70,
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
],
[
81,
86
],
[
86,
87
],
[
86,
88
],
[
81,
89
],
[
89,
90
],
[
90,
91
],
[
81,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
94,
104
],
[
104,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
6,
112
],
[
112,
113
]
] | [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint q = stdIn.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint q = stdIn.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint q = stdIn.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] S = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint q = stdIn.nextInt();\n\t\tint[] T = new int[q];\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}\n\t\t\n\t\tArrays.sort(S);\n\t\tArrays.sort(T);\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] S = new int[n];",
"S",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}",
"{\n\t\t\tS[i] = stdIn.nextInt();\n\t\t}",
"S[i] = stdIn.nextInt()",
"S[i]",
"S",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int q = stdIn.nextInt();",
"q",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] T = new int[q];",
"T",
"new int[q]",
"q",
"for (int i=0; i<q; i++) {\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}",
"{\n\t\t\tT[i] = stdIn.nextInt();\n\t\t}",
"T[i] = stdIn.nextInt()",
"T[i]",
"T",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"Arrays.sort(S)",
"Arrays.sort",
"Arrays",
"S",
"Arrays.sort(T)",
"Arrays.sort",
"Arrays",
"T",
"int count = 0;",
"count",
"0",
"for (int i=0; i<q; i++) {\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}",
"{\n\t\t\tif(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;\n\t\t}",
"if(Arrays.binarySearch(S,T[i]) >= 0)\n\t\t\t\tcount++;",
"Arrays.binarySearch(S,T[i]) >= 0",
"Arrays.binarySearch(S,T[i])",
"Arrays.binarySearch",
"Arrays",
"S",
"T[i]",
"T",
"i",
"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 void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] S = new int[n];
for (int i=0; i<n; i++) {
S[i] = stdIn.nextInt();
}
int q = stdIn.nextInt();
int[] T = new int[q];
for (int i=0; i<q; i++) {
T[i] = stdIn.nextInt();
}
Arrays.sort(S);
Arrays.sort(T);
int count = 0;
for (int i=0; i<q; i++) {
if(Arrays.binarySearch(S,T[i]) >= 0)
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,
38,
5,
13,
30,
4,
18,
13,
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,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
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,
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,
13,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
18,
13,
13,
9,
41,
13,
17,
41,
13,
2,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
18,
13,
13,
17,
40,
13,
3,
30,
0,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
17,
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
],
[
245,
14
],
[
245,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
21,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
21,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
41,
42
],
[
34,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
45,
50
],
[
34,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
34,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
61,
66
],
[
34,
67
],
[
67,
68
],
[
67,
69
],
[
34,
71
],
[
71,
72
],
[
71,
73
],
[
34,
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
],
[
88,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
34,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
98,
109
],
[
110,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
118,
120
],
[
34,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
34,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
34,
129
],
[
129,
130
],
[
129,
131
],
[
34,
132
],
[
132,
133
],
[
132,
134
],
[
34,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
136,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
34,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
159,
160
],
[
159,
161
],
[
154,
162
],
[
162,
163
],
[
163,
164
],
[
154,
165
],
[
166,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
166,
172
],
[
172,
173
],
[
172,
174
],
[
166,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
166,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
166,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
197
],
[
197,
198
],
[
197,
199
],
[
192,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
203,
205
],
[
192,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
211,
212
],
[
211,
213
],
[
206,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
215,
219
],
[
214,
220
],
[
220,
221
],
[
214,
222
],
[
206,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
226,
228
],
[
191,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
34,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
236,
241
],
[
15,
242
],
[
242,
243
],
[
0,
244
],
[
244,
245
],
[
244,
246
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\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.Arrays;",
"Arrays",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"main",
"{\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"BufferedReader in = new BufferedReader(new InputStreamReader(System.in));",
"in",
"new BufferedReader(new InputStreamReader(System.in))",
"try {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}",
"catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}",
"NumberFormatException e",
"{\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}",
"IOException e",
"{\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t}",
"int lima = Integer.parseInt(in.readLine());",
"lima",
"Integer.parseInt(in.readLine())",
"Integer.parseInt",
"Integer",
"in.readLine()",
"in.readLine",
"in",
"String[] sa = in.readLine().split(\" \");",
"sa",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"int limb = Integer.parseInt(in.readLine());",
"limb",
"Integer.parseInt(in.readLine())",
"Integer.parseInt",
"Integer",
"in.readLine()",
"in.readLine",
"in",
"String[] sb = in.readLine().split(\" \");",
"sb",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"int[] a = new int[lima];",
"a",
"new int[lima]",
"lima",
"int[] b = new int[limb];",
"b",
"new int[limb]",
"limb",
"for (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < lima",
"i",
"lima",
"i++",
"i++",
"i",
"{\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}",
"{\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}",
"a[i] = Integer.parseInt(sa[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(sa[i])",
"Integer.parseInt",
"Integer",
"sa[i]",
"sa",
"i",
"for (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < limb",
"i",
"limb",
"i++",
"i++",
"i",
"{\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}",
"{\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}",
"b[i] = Integer.parseInt(sb[i])",
"b[i]",
"b",
"i",
"Integer.parseInt(sb[i])",
"Integer.parseInt",
"Integer",
"sb[i]",
"sb",
"i",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"Arrays.sort(b)",
"Arrays.sort",
"Arrays",
"b",
"int hit = 0;",
"hit",
"0",
"boolean[] flag = new boolean[limb];",
"flag",
"new boolean[limb]",
"limb",
"for (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < limb",
"i",
"limb",
"i++",
"i++",
"i",
"{\n\t\t\t\tflag[i] = false;\n\t\t\t}",
"{\n\t\t\t\tflag[i] = false;\n\t\t\t}",
"flag[i] = false",
"flag[i]",
"flag",
"i",
"false",
"for (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < limb",
"j",
"limb",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}",
"if (flag[j]) continue;",
"flag[j]",
"flag",
"j",
"continue;",
"int s = 0;",
"s",
"0",
"int g = lima - 1;",
"g",
"lima - 1",
"lima",
"1",
"int i = (s + g) / 2;",
"i",
"(s + g) / 2",
"(s + g)",
"s",
"g",
"2",
"while (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}",
"s <= g",
"s",
"g",
"{\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}",
"if (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}",
"b[j] > a[i]",
"b[j]",
"b",
"j",
"a[i]",
"a",
"i",
"{\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t}",
"s = i + 1",
"s",
"i + 1",
"i",
"1",
"if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}",
"b[j] == a[i]",
"b[j]",
"b",
"j",
"a[i]",
"a",
"i",
"{\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}",
"flag[j] = true",
"flag[j]",
"flag",
"j",
"true",
"hit++",
"hit",
"break;",
"{\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}",
"g = i - 1",
"g",
"i - 1",
"i",
"1",
"i = (s + g) / 2",
"i",
"(s + g) / 2",
"(s + g)",
"s",
"g",
"2",
"System.out.println(hit)",
"System.out.println",
"System.out",
"System",
"System.out",
"hit",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t\ttry {\n\t\t\tint lima = Integer.parseInt(in.readLine());\n\t\t\tString[] sa = in.readLine().split(\" \");\n\t\t\t\n\t\t\tint limb = Integer.parseInt(in.readLine());\n\t\t\tString[] sb = in.readLine().split(\" \");\n\n\t\t\tint[] a = new int[lima];\n\t\t\tint[] b = new int[limb];\n\n\t\t\tfor (int i = 0; i < lima; i++) {\n\t\t\t\ta[i] = Integer.parseInt(sa[i]);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tb[i] = Integer.parseInt(sb[i]);\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(a);\n\t\t\tArrays.sort(b);\n\t\t\t\n\t\t\tint hit = 0;\n\t\t\tboolean[] flag = new boolean[limb];\n\t\t\tfor (int i = 0; i < limb; i++) {\n\t\t\t\tflag[i] = false;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int j = 0; j < limb; j++) {\n\t\t\t\tif (flag[j]) continue;\n\n\t\t\t\tint s = 0;\n\t\t\t\tint g = lima - 1;\t\n\t\t\t\tint i = (s + g) / 2;\n\t\t\t\twhile (s <= g) {\n\t\t\t\t\tif (b[j] > a[i]) {\n\t\t\t\t\t\ts = i + 1;\n\t\t\t\t\t} else if (b[j] == a[i]) {\n\t\t\t\t\t\tflag[j] = true;\n\t\t\t\t\t\thit++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tg = i - 1;\n\t\t\t\t\t}\n\t\t\t\t\ti = (s + g) / 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(hit);\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}\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) {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
int lima = Integer.parseInt(in.readLine());
String[] sa = in.readLine().split(" ");
int limb = Integer.parseInt(in.readLine());
String[] sb = in.readLine().split(" ");
int[] a = new int[lima];
int[] b = new int[limb];
for (int i = 0; i < lima; i++) {
a[i] = Integer.parseInt(sa[i]);
}
for (int i = 0; i < limb; i++) {
b[i] = Integer.parseInt(sb[i]);
}
Arrays.sort(a);
Arrays.sort(b);
int hit = 0;
boolean[] flag = new boolean[limb];
for (int i = 0; i < limb; i++) {
flag[i] = false;
}
for (int j = 0; j < limb; j++) {
if (flag[j]) continue;
int s = 0;
int g = lima - 1;
int i = (s + g) / 2;
while (s <= g) {
if (b[j] > a[i]) {
s = i + 1;
} else if (b[j] == a[i]) {
flag[j] = true;
hit++;
break;
} else {
g = i - 1;
}
i = (s + g) / 2;
}
}
System.out.println(hit);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
[
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,
18,
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,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
18,
13,
13,
40,
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
],
[
126,
8
],
[
126,
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
],
[
31,
32
],
[
31,
33
],
[
24,
34
],
[
34,
35
],
[
35,
36
],
[
24,
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,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
11,
77
],
[
77,
78
],
[
77,
79
],
[
11,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
11,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
11,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
88,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
103,
114
],
[
114,
115
],
[
115,
116
],
[
11,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
9,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
] | [
"\n\nimport java.util.Arrays;\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个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\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\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt(); //n个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\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个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt(); //n个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] arr1 = new int[n];",
"arr1",
"new int[n]",
"n",
"for(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr1.length",
"i",
"arr1.length",
"arr1",
"arr1.length",
"i++",
"i++",
"i",
"{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}",
"arr1[i]=sc.nextInt()",
"arr1[i]",
"arr1",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] arr2 = new int[q];",
"arr2",
"new int[q]",
"q",
"for(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr2.length",
"i",
"arr2.length",
"arr2",
"arr2.length",
"i++",
"i++",
"i",
"{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}",
"arr2[i]=sc.nextInt()",
"arr2[i]",
"arr2",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sum=0;",
"sum",
"0",
"Arrays.sort(arr1)",
"Arrays.sort",
"Arrays",
"arr1",
"Arrays.sort(arr2)",
"Arrays.sort",
"Arrays",
"arr2",
"for(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr2.length",
"i",
"arr2.length",
"arr2",
"arr2.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"if(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}",
"Arrays.binarySearch(arr1, arr2[i])>-1",
"Arrays.binarySearch(arr1, arr2[i])",
"Arrays.binarySearch",
"Arrays",
"arr1",
"arr2[i]",
"arr2",
"i",
"-1",
"1",
"{\n\t\t\t\tsum++;\n\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\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt(); //n个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\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个\n\t\tint[] arr1 = new int[n];\n\t\tfor(int i=0;i<arr1.length;i++)\n\t\t{\n\t\t\tarr1[i]=sc.nextInt();\n\t\t}\n\t\tint q = sc.nextInt(); //q\n\t\tint[] arr2 = new int[q]; //不重复的\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tarr2[i]=sc.nextInt();\n\t\t}\n\t\tint sum=0;\n\t\t\n\t\t\n\t\t\n\t\tArrays.sort(arr1);\n\t\tArrays.sort(arr2);\n\t\t\n\t\tfor(int i=0;i<arr2.length;i++)\n\t\t{\n\t\t\tif(Arrays.binarySearch(arr1, arr2[i])>-1)\n\t\t\t{\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}\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(); //n个
int[] arr1 = new int[n];
for(int i=0;i<arr1.length;i++)
{
arr1[i]=sc.nextInt();
}
int q = sc.nextInt(); //q
int[] arr2 = new int[q]; //不重复的
for(int i=0;i<arr2.length;i++)
{
arr2[i]=sc.nextInt();
}
int sum=0;
Arrays.sort(arr1);
Arrays.sort(arr2);
for(int i=0;i<arr2.length;i++)
{
if(Arrays.binarySearch(arr1, arr2[i])>-1)
{
sum++;
}
}
System.out.println(sum);
}
}
|
[
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,
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,
2,
18,
13,
13,
17,
41,
13,
2,
2,
13,
13,
17,
42,
2,
13,
13,
30,
14,
2,
18,
13,
13,
13,
30,
29,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
0,
13,
2,
2,
13,
13,
17,
29,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
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
],
[
197,
17
],
[
197,
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
],
[
85,
87
],
[
20,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
88,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
101,
108
],
[
108,
109
],
[
109,
110
],
[
20,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
18,
117
],
[
117,
118
],
[
197,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
121,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
121,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
144,
150
],
[
150,
151
],
[
151,
152
],
[
144,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
153,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
163,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
143,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
121,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
181,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
187,
191
],
[
119,
192
],
[
192,
193
],
[
119,
194
],
[
194,
195
],
[
0,
196
],
[
196,
197
],
[
196,
198
]
] | [
"import javax.sound.midi.Soundbank;\nimport java.util.Scanner;\n\nimport static java.lang.System.currentTimeMillis;\nimport static java.lang.System.out;\nimport static java.lang.System.setOut;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }\n\n static boolean isContain (int num , int[] arr){\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }\n}",
"import javax.sound.midi.Soundbank;",
"Soundbank",
"javax.sound.midi",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import static java.lang.System.currentTimeMillis;",
"import static java.lang.System.currentTimeMillis;",
"import static java.lang.System.currentTimeMillis;",
"import static java.lang.System.out;",
"import static java.lang.System.out;",
"import static java.lang.System.out;",
"import static java.lang.System.setOut;",
"import static java.lang.System.setOut;",
"import static java.lang.System.setOut;",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }\n\n static boolean isContain (int num , int[] arr){\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int size = (scanner.nextInt());",
"size",
"(scanner.nextInt())",
"scanner.nextInt",
"scanner",
"int [] S= new int[size];",
"S",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"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 ansSize = (scanner.nextInt());",
"ansSize",
"(scanner.nextInt())",
"scanner.nextInt",
"scanner",
"int[] T = new int[ansSize];",
"T",
"new int[ansSize]",
"ansSize",
"for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < ansSize",
"i",
"ansSize",
"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",
"double roopCount = 0;",
"roopCount",
"0",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < ansSize",
"i",
"ansSize",
"i++",
"i++",
"i",
"{\n if(isContain(T[i],S)){\n count++;\n }\n }",
"{\n if(isContain(T[i],S)){\n count++;\n }\n }",
"if(isContain(T[i],S)){\n count++;\n }",
"isContain(T[i],S)",
"isContain",
"T[i]",
"T",
"i",
"S",
"{\n count++;\n }",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static boolean isContain (int num , int[] arr){\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }",
"isContain",
"{\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }",
"int head = 0;",
"head",
"0",
"int tail = arr.length-1;",
"tail",
"arr.length-1",
"arr.length",
"arr",
"arr.length",
"1",
"int mid = (head+tail)/2;",
"mid",
"(head+tail)/2",
"(head+tail)",
"head",
"tail",
"2",
"while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }",
"mid != head",
"mid",
"head",
"{\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }",
"if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }",
"arr[mid] == num",
"arr[mid]",
"arr",
"mid",
"num",
"{\n return true;\n }",
"return true;",
"true",
"if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }",
"arr[mid]< num",
"arr[mid]",
"arr",
"mid",
"num",
"{\n head = mid;\n }",
"head = mid",
"head",
"mid",
"if(arr[mid] > num){\n tail = mid;\n }",
"arr[mid] > num",
"arr[mid]",
"arr",
"mid",
"num",
"{\n tail = mid;\n }",
"tail = mid",
"tail",
"mid",
"mid = (tail+head)/2",
"mid",
"(tail+head)/2",
"(tail+head)",
"tail",
"head",
"2",
"return arr[mid]==num || arr[tail]==num;",
"arr[mid]==num || arr[tail]==num",
"arr[mid]==num",
"arr[mid]",
"arr",
"mid",
"num",
"arr[tail]==num",
"arr[tail]",
"arr",
"tail",
"num",
"int num",
"num",
"int[] arr",
"arr",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }\n\n static boolean isContain (int num , int[] arr){\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n //探索対象を取得\n int size = (scanner.nextInt());\n int [] S= new int[size];\n for (int i = 0; i < size; i++) {\n S[i] = scanner.nextInt();\n }\n\n //探索する値を取得\n int ansSize = (scanner.nextInt());\n int[] T = new int[ansSize];\n for (int i = 0; i < ansSize; i++) {\n T[i] = scanner.nextInt();\n }\n\n //System.out.println(\"読み込み完了!\");\n double roopCount = 0;\n int count = 0;\n //探索用のアルゴリズム\n for (int i = 0; i < ansSize; i++) {\n if(isContain(T[i],S)){\n count++;\n }\n }\n\n System.out.println(count);\n }\n\n static boolean isContain (int num , int[] arr){\n int head = 0;\n int tail = arr.length-1;\n int mid = (head+tail)/2;\n\n while (mid != head){\n if(arr[mid] == num){\n return true;\n }\n else if(arr[mid]< num){\n head = mid;\n }\n else if(arr[mid] > num){\n tail = mid;\n }\n mid = (tail+head)/2;\n }\n return arr[mid]==num || arr[tail]==num;\n\n }\n}",
"Main"
] | import javax.sound.midi.Soundbank;
import java.util.Scanner;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
import static java.lang.System.setOut;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//探索対象を取得
int size = (scanner.nextInt());
int [] S= new int[size];
for (int i = 0; i < size; i++) {
S[i] = scanner.nextInt();
}
//探索する値を取得
int ansSize = (scanner.nextInt());
int[] T = new int[ansSize];
for (int i = 0; i < ansSize; i++) {
T[i] = scanner.nextInt();
}
//System.out.println("読み込み完了!");
double roopCount = 0;
int count = 0;
//探索用のアルゴリズム
for (int i = 0; i < ansSize; i++) {
if(isContain(T[i],S)){
count++;
}
}
System.out.println(count);
}
static boolean isContain (int num , int[] arr){
int head = 0;
int tail = arr.length-1;
int mid = (head+tail)/2;
while (mid != head){
if(arr[mid] == num){
return true;
}
else if(arr[mid]< num){
head = mid;
}
else if(arr[mid] > num){
tail = mid;
}
mid = (tail+head)/2;
}
return arr[mid]==num || arr[tail]==num;
}
}
|
[
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,
0,
13,
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,
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,
2,
13,
17,
30,
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
],
[
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
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
4,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
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
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
129,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
138,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
138,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
106,
156
],
[
156,
157
],
[
104,
158
],
[
158,
159
],
[
104,
160
],
[
160,
161
]
] | [
"import java.util.Scanner;\nclass Main {\n 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\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint result = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tresult += BinarySearch(S, T[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(result);\n\t}\n\n\tstatic int BinarySearch(int data[], int serch){\n\t\t\n\t\tint min = 0;\n\t\tint max = data.length - 1;\n\t\t\n\t\twhile(min <= max){\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n 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\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint result = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tresult += BinarySearch(S, T[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(result);\n\t}\n\n\tstatic int BinarySearch(int data[], int serch){\n\t\t\n\t\tint min = 0;\n\t\tint max = data.length - 1;\n\t\t\n\t\twhile(min <= max){\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\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\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint result = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tresult += BinarySearch(S, T[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(result);\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\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tS[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint q = scan.nextInt();\n\t\tint[] T = new int[q];\n\t\t\n\t\tfor(int i = 0; i < q; i++){\n\t\t\tT[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint result = 0;\n\t\tfor(int i = 0; i < T.length; i++){\n\t\t\tresult += BinarySearch(S, T[i]);\n\t\t}\n\t\t\n\t\tSystem.out.println(result);\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",
"int result = 0;",
"result",
"0",
"for(int i = 0; i < T.length; i++){\n\t\t\tresult += BinarySearch(S, T[i]);\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\tresult += BinarySearch(S, T[i]);\n\t\t}",
"{\n\t\t\tresult += BinarySearch(S, T[i]);\n\t\t}",
"result += BinarySearch(S, T[i])",
"result",
"BinarySearch(S, T[i])",
"BinarySearch",
"S",
"T[i]",
"T",
"i",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"static int BinarySearch(int data[], int serch){\n\t\t\n\t\tint min = 0;\n\t\tint max = data.length - 1;\n\t\t\n\t\twhile(min <= max){\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"BinarySearch",
"{\n\t\t\n\t\tint min = 0;\n\t\tint max = data.length - 1;\n\t\t\n\t\twhile(min <= max){\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}",
"int min = 0;",
"min",
"0",
"int max = data.length - 1;",
"max",
"data.length - 1",
"data.length",
"data",
"data.length",
"1",
"while(min <= max){\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}",
"min <= max",
"min",
"max",
"{\n\t\t\t\n\t\t\tint middle = (min + max) / 2;\n\t\t\tif(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}\n\t\t}",
"int middle = (min + max) / 2;",
"middle",
"(min + max) / 2",
"(min + max)",
"min",
"max",
"2",
"if(serch == data[middle]){\n\t\t\t\treturn 1;\n\t\t\t}else if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}",
"serch == data[middle]",
"serch",
"data[middle]",
"data",
"middle",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if(serch < data[middle]){\n\t\t\t\tmax = middle - 1;\n\t\t\t}else{\n\t\t\t\tmin = middle + 1;\n\t\t\t}",
"serch < data[middle]",
"serch",
"data[middle]",
"data",
"middle",
"{\n\t\t\t\tmax = middle - 1;\n\t\t\t}",
"max = middle - 1",
"max",
"middle - 1",
"middle",
"1",
"{\n\t\t\t\tmin = middle + 1;\n\t\t\t}",
"min = middle + 1",
"min",
"middle + 1",
"middle",
"1",
"return 0;",
"0",
"int data[]",
"data",
"int serch",
"serch"
] | import java.util.Scanner;
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();
}
int result = 0;
for(int i = 0; i < T.length; i++){
result += BinarySearch(S, T[i]);
}
System.out.println(result);
}
static int BinarySearch(int data[], int serch){
int min = 0;
int max = data.length - 1;
while(min <= max){
int middle = (min + max) / 2;
if(serch == data[middle]){
return 1;
}else if(serch < data[middle]){
max = middle - 1;
}else{
min = middle + 1;
}
}
return 0;
}
} |
[
7,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
0,
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,
0,
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,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
17,
0,
13,
2,
13,
17,
11,
1,
2,
13,
13,
30,
30,
0,
13,
2,
2,
13,
13,
17,
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,
30,
40,
13,
3,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
20,
18,
13,
13,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
185,
2
],
[
185,
3
],
[
3,
4
],
[
3,
5
],
[
5,
6
],
[
6,
7
],
[
6,
8
],
[
5,
9
],
[
9,
10
],
[
5,
11
],
[
11,
12
],
[
5,
13
],
[
13,
14
],
[
5,
15
],
[
15,
16
],
[
5,
17
],
[
17,
18
],
[
5,
19
],
[
19,
20
],
[
5,
21
],
[
21,
22
],
[
5,
23
],
[
23,
24
],
[
5,
25
],
[
25,
26
],
[
5,
27
],
[
27,
28
],
[
5,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
5,
34
],
[
34,
35
],
[
34,
36
],
[
5,
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
],
[
5,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
5,
63
],
[
63,
64
],
[
63,
65
],
[
5,
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
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
5,
87
],
[
87,
88
],
[
87,
89
],
[
5,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
90,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
102,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
117,
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
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
125,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
144,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
139,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
5,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
5,
163
],
[
163,
164
],
[
164,
165
],
[
3,
166
],
[
166,
167
],
[
3,
168
],
[
168,
169
],
[
185,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
173,
176
],
[
176,
177
],
[
176,
178
],
[
173,
179
],
[
179,
180
],
[
179,
181
],
[
170,
182
],
[
182,
183
],
[
0,
184
],
[
184,
185
],
[
184,
186
]
] | [
"public class Main{\n public void run(java.io.InputStream in, java.io.PrintStream out){\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }\n public static void main(String[] args){\n (new Main()).run(System.in, System.out);\n }\n}",
"public class Main{\n public void run(java.io.InputStream in, java.io.PrintStream out){\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }\n public static void main(String[] args){\n (new Main()).run(System.in, System.out);\n }\n}",
"Main",
"public void run(java.io.InputStream in, java.io.PrintStream out){\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }",
"run",
"{\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }",
"java.util.Scanner sc = new java.util.Scanner(in);",
"sc",
"new java.util.Scanner(in)",
"int n",
"n",
"q;",
"q",
"int[] s",
"s",
"t;",
"t",
"int i",
"i",
"j",
"j",
"c",
"c",
"l",
"l",
"r",
"r",
"a;",
"a",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"s = new int[n]",
"s",
"new int[n]",
"n",
"for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }",
"i = 0;",
"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",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"t = new int[q]",
"t",
"new int[q]",
"q",
"for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }",
"i = 0;",
"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",
"c = 0",
"c",
"0",
"for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < q",
"i",
"q",
"i++",
"i++",
"i",
"{\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }",
"{\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }",
"l = 0",
"l",
"0",
"r = n - 1",
"r",
"n - 1",
"n",
"1",
"for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }",
";",
"l <= r",
"l",
"r",
"{\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }",
"{\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }",
"a = (l + r) / 2",
"a",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }",
"t[i] > s[a]",
"t[i]",
"t",
"i",
"s[a]",
"s",
"a",
"{\n l = a + 1;\n }",
"l = a + 1",
"l",
"a + 1",
"a",
"1",
"if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }",
"t[i] < s[a]",
"t[i]",
"t",
"i",
"s[a]",
"s",
"a",
"{\n r = a - 1;\n }",
"r = a - 1",
"r",
"a - 1",
"a",
"1",
"{\n c++;\n break;\n }",
"c++",
"c",
"break;",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"sc.close()",
"sc.close",
"sc",
"java.io.InputStream in",
"in",
"java.io.PrintStream out",
"out",
"public static void main(String[] args){\n (new Main()).run(System.in, System.out);\n }",
"main",
"{\n (new Main()).run(System.in, System.out);\n }",
"(new Main()).run(System.in, System.out)",
"(new Main()).run",
"(new Main())",
"System.in",
"System",
"System.in",
"System.out",
"System",
"System.out",
"String[] args",
"args",
"public class Main{\n public void run(java.io.InputStream in, java.io.PrintStream out){\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }\n public static void main(String[] args){\n (new Main()).run(System.in, System.out);\n }\n}",
"public class Main{\n public void run(java.io.InputStream in, java.io.PrintStream out){\n java.util.Scanner sc = new java.util.Scanner(in);\n/*answer*/\n int n, q;\n int[] s, t;\n int i, j, c, l, r, a;\n\n n = sc.nextInt();\n s = new int[n];\n for(i = 0;i < n;i++){\n s[i] = sc.nextInt();\n }\n q = sc.nextInt();\n t = new int[q];\n for(i = 0;i < q;i++){\n t[i] = sc.nextInt();\n }\n\n c = 0;\n for(i = 0;i < q;i++){\n l = 0;\n r = n - 1;\n for(;l <= r;){\n a = (l + r) / 2;\n if(t[i] > s[a]){\n l = a + 1;\n }else if(t[i] < s[a]){\n r = a - 1;\n }else{\n c++;\n break;\n }\n }\n }\n\n System.out.println(c);\n\n sc.close();\n }\n public static void main(String[] args){\n (new Main()).run(System.in, System.out);\n }\n}",
"Main"
] | public class Main{
public void run(java.io.InputStream in, java.io.PrintStream out){
java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
int n, q;
int[] s, t;
int i, j, c, l, r, a;
n = sc.nextInt();
s = new int[n];
for(i = 0;i < n;i++){
s[i] = sc.nextInt();
}
q = sc.nextInt();
t = new int[q];
for(i = 0;i < q;i++){
t[i] = sc.nextInt();
}
c = 0;
for(i = 0;i < q;i++){
l = 0;
r = n - 1;
for(;l <= r;){
a = (l + r) / 2;
if(t[i] > s[a]){
l = a + 1;
}else if(t[i] < s[a]){
r = a - 1;
}else{
c++;
break;
}
}
}
System.out.println(c);
sc.close();
}
public static void main(String[] args){
(new Main()).run(System.in, System.out);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
41,
13,
20,
41,
13,
20,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
20,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
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,
0,
13,
13,
14,
2,
18,
13,
13,
18,
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
],
[
159,
5
],
[
159,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
36,
38
],
[
29,
39
],
[
39,
40
],
[
40,
41
],
[
29,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
51,
53
],
[
54,
55
],
[
55,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
8,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
89,
90
],
[
90,
91
],
[
79,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
99,
101
],
[
93,
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
],
[
106,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
134,
136
],
[
106,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
142,
144
],
[
137,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
8,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
6,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}",
"main",
"{\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}",
"int i",
"i",
"cnt=0",
"cnt",
"0",
"big",
"big",
"sma",
"sma",
"mid;",
"mid",
"Scanner sca=new Scanner(System.in);",
"sca",
"new Scanner(System.in)",
"int hair1[]=new int[sca.nextInt()];",
"hair1",
"new int[sca.nextInt()]",
"sca.nextInt()",
"sca.nextInt",
"sca",
"for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<hair1.length",
"i",
"hair1.length",
"hair1",
"hair1.length",
"i++",
"i++",
"i",
"{\n \thair1[i]=sca.nextInt();\n }",
"{\n \thair1[i]=sca.nextInt();\n }",
"hair1[i]=sca.nextInt()",
"hair1[i]",
"hair1",
"i",
"sca.nextInt()",
"sca.nextInt",
"sca",
"int hair2[]=new int[sca.nextInt()];",
"hair2",
"new int[sca.nextInt()]",
"sca.nextInt()",
"sca.nextInt",
"sca",
"for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<hair2.length",
"i",
"hair2.length",
"hair2",
"hair2.length",
"i++",
"i++",
"i",
"{\n \thair2[i]=sca.nextInt();\n }",
"{\n \thair2[i]=sca.nextInt();\n }",
"hair2[i]=sca.nextInt()",
"hair2[i]",
"hair2",
"i",
"sca.nextInt()",
"sca.nextInt",
"sca",
"for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}",
"i=0;",
"i=0",
"i",
"0",
"i<hair2.length",
"i",
"hair2.length",
"hair2",
"hair2.length",
"i++",
"i++",
"i",
"{\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}",
"{\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}",
"big=hair1.length",
"big",
"hair1.length",
"hair1",
"hair1.length",
"sma=0",
"sma",
"0",
"while(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}",
"sma<big",
"sma",
"big",
"{\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}",
"mid=(big+sma)/2",
"mid",
"(big+sma)/2",
"(big+sma)",
"big",
"sma",
"2",
"if(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}",
"hair1[mid]==hair2[i]",
"hair1[mid]",
"hair1",
"mid",
"hair2[i]",
"hair2",
"i",
"{\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}",
"cnt++",
"cnt",
"break;",
"if(hair1[mid]>hair2[i])big=mid;",
"hair1[mid]>hair2[i]",
"hair1[mid]",
"hair1",
"mid",
"hair2[i]",
"hair2",
"i",
"big=mid",
"big",
"mid",
"if(hair1[mid]<hair2[i])sma=mid+1;",
"hair1[mid]<hair2[i]",
"hair1[mid]",
"hair1",
"mid",
"hair2[i]",
"hair2",
"i",
"sma=mid+1",
"sma",
"mid+1",
"mid",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}\n\n}",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\t\tint i,cnt=0,big,sma,mid;\n\t\t// TODO Auto-generated method stub\n Scanner sca=new Scanner(System.in);\n int hair1[]=new int[sca.nextInt()];\n for(i=0;i<hair1.length;i++){\n \thair1[i]=sca.nextInt();\n }\n int hair2[]=new int[sca.nextInt()];\n for(i=0;i<hair2.length;i++){\n \thair2[i]=sca.nextInt();\n }\n for(i=0;i<hair2.length;i++){\n \tbig=hair1.length;\n \tsma=0;\n \twhile(sma<big){\n \t\tmid=(big+sma)/2;\n \t\tif(hair1[mid]==hair2[i]){\n \t\t\tcnt++;\n \t\t\tbreak;\n \t\t}\n \t\tif(hair1[mid]>hair2[i])big=mid;\n \t\tif(hair1[mid]<hair2[i])sma=mid+1;\n \t\t}\n \t}\n System.out.println(cnt);\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
int i,cnt=0,big,sma,mid;
// TODO Auto-generated method stub
Scanner sca=new Scanner(System.in);
int hair1[]=new int[sca.nextInt()];
for(i=0;i<hair1.length;i++){
hair1[i]=sca.nextInt();
}
int hair2[]=new int[sca.nextInt()];
for(i=0;i<hair2.length;i++){
hair2[i]=sca.nextInt();
}
for(i=0;i<hair2.length;i++){
big=hair1.length;
sma=0;
while(sma<big){
mid=(big+sma)/2;
if(hair1[mid]==hair2[i]){
cnt++;
break;
}
if(hair1[mid]>hair2[i])big=mid;
if(hair1[mid]<hair2[i])sma=mid+1;
}
}
System.out.println(cnt);
}
}
|
[
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,
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,
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,
17,
40,
13,
4,
18,
13,
4,
18,
18,
13,
13,
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
],
[
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
],
[
32,
34
],
[
34,
35
],
[
34,
36
],
[
31,
37
],
[
37,
38
],
[
23,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
39,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
50,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
6,
62
],
[
62,
63
],
[
6,
64
],
[
64,
65
],
[
148,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
68,
77
],
[
77,
78
],
[
77,
79
],
[
68,
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
],
[
68,
101
],
[
101,
102
],
[
101,
103
],
[
68,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
68,
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
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
129,
132
],
[
128,
133
],
[
127,
134
],
[
134,
135
],
[
68,
136
],
[
136,
137
],
[
137,
138
],
[
68,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
66,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\t\n\tstatic int search(int[] a, int key) {\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tstatic int search(int[] a, int key) {\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n\n}",
"Main",
"static int search(int[] a, int key) {\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}",
"search",
"{\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}",
"int left=0",
"left",
"0",
"right=a.length;",
"right",
"a.length",
"a",
"a.length",
"int mid;",
"mid",
"while (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (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\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (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;",
"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 key",
"key",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"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",
"for (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int sum = 0;",
"sum",
"0",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}",
"{\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}",
"int key = sc.nextInt();",
"key",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (search(a, key) >= 0)\n\t\t\t\tsum ++;",
"search(a, key) >= 0",
"search(a, key)",
"search",
"a",
"key",
"0",
"sum ++",
"sum",
"sc.close()",
"sc.close",
"sc",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n\t\n\tstatic int search(int[] a, int key) {\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n\n}",
"public class Main {\n\t\n\tstatic int search(int[] a, int key) {\n\t\tint left=0, right=a.length;\n\t\tint mid;\n\t\twhile (left < right) {\n\t\t\tmid = (left+right) / 2;\n\t\t\tif (key == a[mid]) return mid;\n\t\t\tif (key > a[mid]) left = mid+1;\n\t\t\telse if (key < a[mid]) right = mid;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tint q = sc.nextInt();\n\t\tfor (int i=0; i<q; i++) {\n\t\t\tint key = sc.nextInt();\n\t\t\tif (search(a, key) >= 0)\n\t\t\t\tsum ++;\n\t\t}\n\t\t\n\t\tsc.close();\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
static int search(int[] a, int key) {
int left=0, right=a.length;
int mid;
while (left < right) {
mid = (left+right) / 2;
if (key == a[mid]) return mid;
if (key > a[mid]) left = mid+1;
else if (key < a[mid]) right = mid;
}
return -1;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i=0; i<n; i++) {
a[i] = sc.nextInt();
}
int sum = 0;
int q = sc.nextInt();
for (int i=0; i<q; i++) {
int key = sc.nextInt();
if (search(a, key) >= 0)
sum ++;
}
sc.close();
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
20,
12,
13,
30,
42,
4,
13,
30,
4,
18,
18,
13,
13,
4,
13,
23,
13,
12,
13,
30,
14,
40,
4,
18,
13,
29,
17,
0,
13,
4,
18,
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,
0,
13,
4,
18,
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,
29,
17,
12,
13,
30,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
40,
13,
29,
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,
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
],
[
182,
12
],
[
12,
13
],
[
182,
14
],
[
14,
15
],
[
14,
16
],
[
182,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
17,
31
],
[
31,
32
],
[
182,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
36,
41
],
[
41,
42
],
[
35,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
35,
48
],
[
48,
49
],
[
48,
50
],
[
35,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
63,
64
],
[
52,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
35,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
35,
79
],
[
79,
80
],
[
79,
81
],
[
35,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
83,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
103,
104
],
[
35,
105
],
[
105,
106
],
[
182,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
113,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
119,
122
],
[
118,
123
],
[
123,
124
],
[
109,
125
],
[
125,
126
],
[
182,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
129,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
142,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
150,
156
],
[
156,
157
],
[
157,
158
],
[
142,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
159,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
159,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
129,
175
],
[
175,
176
],
[
127,
177
],
[
177,
178
],
[
127,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.Scanner;\n\n/**\n * Created by akensho on 2015/11/23.\n */\npublic class Main {\n static int n, q;\n static int[] S, T;\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n while (read()){\n System.out.println(solve());\n }\n }\n\n static boolean read(){\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }\n\n static int solve(){\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }\n /**\n * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????\n * @param targets := ??¢?´¢??????????±???¨????????????\n * @param key := ??¢?????????????´?\n * @return res\n */\n static boolean binarySearch(int[] targets, int key){\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int n, q;\n static int[] S, T;\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n while (read()){\n System.out.println(solve());\n }\n }\n\n static boolean read(){\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }\n\n static int solve(){\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }\n /**\n * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????\n * @param targets := ??¢?´¢??????????±???¨????????????\n * @param key := ??¢?????????????´?\n * @return res\n */\n static boolean binarySearch(int[] targets, int key){\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }\n}",
"Main",
"static int n",
"n",
"q;",
"q",
"static int[] S",
"S",
"T;",
"T",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args){\n while (read()){\n System.out.println(solve());\n }\n }",
"main",
"{\n while (read()){\n System.out.println(solve());\n }\n }",
"while (read()){\n System.out.println(solve());\n }",
"read()",
"read",
"{\n System.out.println(solve());\n }",
"System.out.println(solve())",
"System.out.println",
"System.out",
"System",
"System.out",
"solve()",
"solve",
"String[] args",
"args",
"static boolean read(){\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }",
"read",
"{\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }",
"if( !sc.hasNext() ) return false;",
"!sc.hasNext()",
"sc.hasNext()",
"sc.hasNext",
"sc",
"return false;",
"false",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"S = new int[n]",
"S",
"new int[n]",
"n",
"for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < S.length",
"i",
"S.length",
"S",
"S.length",
"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",
"q = sc.nextInt()",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"T = new int[q]",
"T",
"new int[q]",
"q",
"for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < T.length",
"i",
"T.length",
"T",
"T.length",
"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",
"return true;",
"true",
"static int solve(){\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }",
"solve",
"{\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }",
"int res = 0;",
"res",
"0",
"for (int key : T){\n if( binarySearch(S, key) ) res++;\n }",
"int key",
"T",
"{\n if( binarySearch(S, key) ) res++;\n }",
"{\n if( binarySearch(S, key) ) res++;\n }",
"if( binarySearch(S, key) ) res++;",
"binarySearch(S, key)",
"binarySearch",
"S",
"key",
"res++",
"res",
"return res;",
"res",
"/**\n * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????\n * @param targets := ??¢?´¢??????????±???¨????????????\n * @param key := ??¢?????????????´?\n * @return res\n */\n static boolean binarySearch(int[] targets, int key){\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }",
"binarySearch",
"{\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }",
"int left = 0",
"left",
"0",
"right = targets.length;",
"right",
"targets.length",
"targets",
"targets.length",
"while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }",
"left < right",
"left",
"right",
"{\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }",
"int middle = (left+right)/2;",
"middle",
"(left+right)/2",
"(left+right)",
"left",
"right",
"2",
"if( targets[middle] == key ) {\n return true;\n }",
"targets[middle] == key",
"targets[middle]",
"targets",
"middle",
"key",
"{\n return true;\n }",
"return true;",
"true",
"if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }",
"targets[middle] < key",
"targets[middle]",
"targets",
"middle",
"key",
"{\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[] targets",
"targets",
"int key",
"key",
"public class Main {\n static int n, q;\n static int[] S, T;\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n while (read()){\n System.out.println(solve());\n }\n }\n\n static boolean read(){\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }\n\n static int solve(){\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }\n /**\n * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????\n * @param targets := ??¢?´¢??????????±???¨????????????\n * @param key := ??¢?????????????´?\n * @return res\n */\n static boolean binarySearch(int[] targets, int key){\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }\n}",
"public class Main {\n static int n, q;\n static int[] S, T;\n static Scanner sc = new Scanner(System.in);\n public static void main(String[] args){\n while (read()){\n System.out.println(solve());\n }\n }\n\n static boolean read(){\n if( !sc.hasNext() ) return false;\n n = sc.nextInt();\n S = new int[n];\n for (int i = 0; i < S.length; i++){\n S[i] = sc.nextInt();\n }\n q = sc.nextInt();\n T = new int[q];\n for (int i = 0; i < T.length; i++){\n T[i] = sc.nextInt();\n }\n return true;\n }\n\n static int solve(){\n int res = 0;\n for (int key : T){\n if( binarySearch(S, key) ) res++;\n }\n return res;\n }\n /**\n * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????\n * @param targets := ??¢?´¢??????????±???¨????????????\n * @param key := ??¢?????????????´?\n * @return res\n */\n static boolean binarySearch(int[] targets, int key){\n int left = 0, right = targets.length;\n while ( left < right ){\n int middle = (left+right)/2;\n if( targets[middle] == key ) {\n return true;\n }\n if( targets[middle] < key ){\n left = middle+1;\n }else {\n right = middle;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
/**
* Created by akensho on 2015/11/23.
*/
public class Main {
static int n, q;
static int[] S, T;
static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
while (read()){
System.out.println(solve());
}
}
static boolean read(){
if( !sc.hasNext() ) return false;
n = sc.nextInt();
S = new int[n];
for (int i = 0; i < S.length; i++){
S[i] = sc.nextInt();
}
q = sc.nextInt();
T = new int[q];
for (int i = 0; i < T.length; i++){
T[i] = sc.nextInt();
}
return true;
}
static int solve(){
int res = 0;
for (int key : T){
if( binarySearch(S, key) ) res++;
}
return res;
}
/**
* ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
* @param targets := ??¢?´¢??????????±???¨????????????
* @param key := ??¢?????????????´?
* @return res
*/
static boolean binarySearch(int[] targets, int key){
int left = 0, right = targets.length;
while ( left < right ){
int middle = (left+right)/2;
if( targets[middle] == key ) {
return true;
}
if( targets[middle] < key ){
left = middle+1;
}else {
right = middle;
}
}
return false;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
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,
0,
13,
4,
18,
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,
4,
18,
13,
13,
4,
18,
13,
13,
4,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
2,
13,
17,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
13,
13,
14,
2,
13,
40,
17,
9,
40,
13,
0,
13,
0,
13,
17,
12,
13,
30,
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,
29,
4,
13,
2,
13,
17,
13,
13,
14,
2,
18,
13,
13,
13,
29,
4,
13,
13,
2,
13,
17,
13,
29,
40,
17,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
228,
8
],
[
228,
9
],
[
9,
10
],
[
228,
11
],
[
11,
12
],
[
228,
13
],
[
13,
14
],
[
228,
15
],
[
15,
16
],
[
228,
17
],
[
17,
18
],
[
17,
19
],
[
228,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
32,
33
],
[
22,
34
],
[
34,
35
],
[
34,
36
],
[
22,
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
],
[
59,
60
],
[
22,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
67,
68
],
[
22,
69
],
[
69,
70
],
[
69,
71
],
[
22,
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
],
[
86,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
94,
95
],
[
22,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
22,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
22,
104
],
[
104,
105
],
[
22,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
20,
112
],
[
112,
113
],
[
228,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
116,
125
],
[
125,
126
],
[
116,
127
],
[
127,
128
],
[
116,
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
],
[
141,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
149,
152
],
[
149,
153
],
[
141,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
154,
159
],
[
141,
160
],
[
160,
161
],
[
141,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
228,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
174,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
182,
188
],
[
188,
189
],
[
174,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
191,
195
],
[
190,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
197,
202
],
[
197,
203
],
[
174,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
204,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
211,
214
],
[
214,
215
],
[
214,
216
],
[
211,
217
],
[
169,
218
],
[
218,
219
],
[
219,
220
],
[
167,
221
],
[
221,
222
],
[
167,
223
],
[
223,
224
],
[
167,
225
],
[
225,
226
],
[
0,
227
],
[
227,
228
],
[
227,
229
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic int n, m;\n\tstatic int[] a, b;\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void solve() {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}\n\n\tstatic int search(int l, int r, int t) {\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic int n, m;\n\tstatic int[] a, b;\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void solve() {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}\n\n\tstatic int search(int l, int r, int t) {\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main",
"static int n",
"n",
"m;",
"m",
"static int[] a",
"a",
"b;",
"b",
"static int count = 0;",
"count",
"0",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = Integer.parseInt(sc.next())",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"a = new int[n]",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}",
"a[i] = Integer.parseInt(sc.next())",
"a[i]",
"a",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"m = Integer.parseInt(sc.next())",
"m",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"b = new int[m]",
"b",
"new int[m]",
"m",
"for (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}",
"{\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}",
"b[i] = Integer.parseInt(sc.next())",
"b[i]",
"b",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"Arrays.sort(b)",
"Arrays.sort",
"Arrays",
"b",
"solve()",
"solve",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static void solve() {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}",
"solve",
"{\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}",
"int l = 0;",
"l",
"0",
"int r = n - 1;",
"r",
"n - 1",
"n",
"1",
"int t",
"t",
"at;",
"at",
"for (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}",
"{\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}",
"t = b[i]",
"t",
"b[i]",
"b",
"i",
"at = search(l, r, t)",
"at",
"search(l, r, t)",
"search",
"l",
"r",
"t",
"if (at == -1)\n\t\t\t\tcontinue;",
"at == -1",
"at",
"-1",
"1",
"continue;",
"count++",
"count",
"l = at = 1",
"l",
"at = 1",
"at",
"1",
"static int search(int l, int r, int t) {\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}",
"search",
"{\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}",
"while (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}",
"l <= r",
"l",
"r",
"{\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}",
"int mid = (l + r) / 2;",
"mid",
"(l + r) / 2",
"(l + r)",
"l",
"r",
"2",
"if (a[mid] == t)\n\t\t\t\treturn t;",
"a[mid] == t",
"a[mid]",
"a",
"mid",
"t",
"return t;",
"t",
"if (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);",
"a[mid] < t",
"a[mid]",
"a",
"mid",
"t",
"return search(mid + 1, r, t);",
"search(mid + 1, r, t)",
"search",
"mid + 1",
"mid",
"1",
"r",
"t",
"if (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);",
"a[mid] > t",
"a[mid]",
"a",
"mid",
"t",
"return search(l, mid - 1, t);",
"search(l, mid - 1, t)",
"search",
"l",
"mid - 1",
"mid",
"1",
"t",
"return -1;",
"-1",
"1",
"int l",
"l",
"int r",
"r",
"int t",
"t",
"public class Main {\n\tstatic int n, m;\n\tstatic int[] a, b;\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void solve() {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}\n\n\tstatic int search(int l, int r, int t) {\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"public class Main {\n\tstatic int n, m;\n\tstatic int[] a, b;\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = Integer.parseInt(sc.next());\n\t\ta = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tm = Integer.parseInt(sc.next());\n\t\tb = new int[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tb[i] = Integer.parseInt(sc.next());\n\t\t}\n\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tsolve();\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void solve() {\n\t\tint l = 0;\n\t\tint r = n - 1;\n\t\tint t, at;\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tt = b[i];\n\t\t\tat = search(l, r, t);\n\t\t\tif (at == -1)\n\t\t\t\tcontinue;\n\t\t\tcount++;\n\t\t\tl = at = 1;\n\t\t}\n\t}\n\n\tstatic int search(int l, int r, int t) {\n\t\twhile (l <= r) {\n\t\t\tint mid = (l + r) / 2;\n\t\t\tif (a[mid] == t)\n\t\t\t\treturn t;\n\t\t\tif (a[mid] < t)\n\t\t\t\treturn search(mid + 1, r, t);\n\t\t\tif (a[mid] > t)\n\t\t\t\treturn search(l, mid - 1, t);\n\t\t}\n\t\treturn -1;\n\t}\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int n, m;
static int[] a, b;
static int count = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = Integer.parseInt(sc.next());
a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = Integer.parseInt(sc.next());
}
m = Integer.parseInt(sc.next());
b = new int[m];
for (int i = 0; i < m; i++) {
b[i] = Integer.parseInt(sc.next());
}
Arrays.sort(a);
Arrays.sort(b);
solve();
System.out.println(count);
}
static void solve() {
int l = 0;
int r = n - 1;
int t, at;
for (int i = 0; i < m; i++) {
t = b[i];
at = search(l, r, t);
if (at == -1)
continue;
count++;
l = at = 1;
}
}
static int search(int l, int r, int t) {
while (l <= r) {
int mid = (l + r) / 2;
if (a[mid] == t)
return t;
if (a[mid] < t)
return search(mid + 1, r, t);
if (a[mid] > t)
return search(l, mid - 1, t);
}
return -1;
}
}
|
[
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,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
4,
18,
13,
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
],
[
91,
8
],
[
91,
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
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
11,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
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
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
73,
77
],
[
72,
78
],
[
71,
79
],
[
79,
80
],
[
80,
81
],
[
11,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
9,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
]
] | [
"\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\n\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\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\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[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] a1 = new int[n];",
"a1",
"new int[n]",
"n",
"for (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"a1[i] = scan.nextInt();",
"a1[i] = scan.nextInt()",
"a1[i]",
"a1",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int q = scan.nextInt();",
"q",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int t;",
"t",
"int sum = 0;",
"sum",
"0",
"for (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\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 = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"t = scan.nextInt()",
"t",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}",
"Arrays.binarySearch(a1, t) >= 0",
"Arrays.binarySearch(a1, t)",
"Arrays.binarySearch",
"Arrays",
"a1",
"t",
"0",
"{//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\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\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] a1 = new int[n];\n\t\tfor (int i = 0; i < n; ++i)\n\t\t\ta1[i] = scan.nextInt();\n\t\t//System.out.println(Arrays.toString(a1));\n\t\t//System.out.println(Arrays.binarySearch(a1, 1));\n\t\tint q = scan.nextInt();\n\t\tint t;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < q; ++i) {\n\t\t\tt = scan.nextInt();\n\t\t\tif (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)\n\t\t\t\t//System.out.println(\"t:\" + t);\n\t\t\t\t//System.out.println(Arrays.binarySearch(a1, t));\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t\n//\t\tint[] a2 = new int[10];\n//\t\tfor (int i = 0; i < a2.length; i++) {\n//\t\t\ta2[a2.length - 1 - i] = i;\n//\t\t}\n//\t\tSystem.out.println(Arrays.binarySearch(a2, 4));\n\t}\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a1 = new int[n];
for (int i = 0; i < n; ++i)
a1[i] = scan.nextInt();
//System.out.println(Arrays.toString(a1));
//System.out.println(Arrays.binarySearch(a1, 1));
int q = scan.nextInt();
int t;
int sum = 0;
for (int i = 0; i < q; ++i) {
t = scan.nextInt();
if (Arrays.binarySearch(a1, t) >= 0) {//如果找不到则返回应该插入位置的负数值(逻辑索引,实际-1)
//System.out.println("t:" + t);
//System.out.println(Arrays.binarySearch(a1, t));
sum++;
}
}
System.out.println(sum);
// int[] a2 = new int[10];
// for (int i = 0; i < a2.length; i++) {
// a2[a2.length - 1 - i] = i;
// }
// System.out.println(Arrays.binarySearch(a2, 4));
}
}
|
[
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,
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,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
13,
13,
13,
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,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
14,
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,
14,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
29,
4,
18,
13,
29,
4,
18,
13,
17,
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
],
[
242,
8
],
[
242,
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
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
11,
48
],
[
48,
49
],
[
48,
50
],
[
11,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
11,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
74,
76
],
[
74,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
80,
83
],
[
79,
84
],
[
84,
85
],
[
11,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
9,
92
],
[
92,
93
],
[
242,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
96,
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
],
[
117,
123
],
[
123,
124
],
[
124,
125
],
[
117,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
96,
142
],
[
142,
143
],
[
94,
144
],
[
144,
145
],
[
94,
146
],
[
146,
147
],
[
242,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
153,
155
],
[
148,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
162,
164
],
[
156,
165
],
[
165,
166
],
[
148,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
170,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
180,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
169,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
148,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
197,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
207,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
196,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
148,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
227,
230
],
[
230,
231
],
[
148,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
239,
240
],
[
0,
241
],
[
241,
242
],
[
241,
243
]
] | [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }\n public 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 }\n return false;\n }\n\n\n static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (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 public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }\n public 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 }\n return false;\n }\n\n\n static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (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 public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }",
"main",
"{\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }",
"FastScanner sc = new FastScanner(System.in);",
"sc",
"new FastScanner(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[] 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 ans = 0;",
"ans",
"0",
"for(int key:T){\n if(binarySearch(S, key)) ans++;\n }",
"int key",
"T",
"{\n if(binarySearch(S, key)) ans++;\n }",
"{\n if(binarySearch(S, key)) ans++;\n }",
"if(binarySearch(S, key)) ans++;",
"binarySearch(S, key)",
"binarySearch",
"S",
"key",
"ans++",
"ans",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public 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 }\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 }\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\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\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 class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (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 public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }",
"FastScanner",
"private BufferedReader reader = null;",
"reader",
"null",
"private StringTokenizer tokenizer = null;",
"tokenizer",
"null",
"public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }",
"FastScanner",
"{\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }",
"reader = new BufferedReader(new InputStreamReader(in))",
"reader",
"new BufferedReader(new InputStreamReader(in))",
"tokenizer = null",
"tokenizer",
"null",
"InputStream in",
"in",
"public String next() {\n if (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 if (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 }",
"if (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",
"public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }",
"nextLine",
"{\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }",
"if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return 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 return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n return 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 return reader.readLine();\n }",
"return reader.readLine();",
"reader.readLine()",
"reader.readLine",
"reader",
"return tokenizer.nextToken(\"\\n\");",
"tokenizer.nextToken(\"\\n\")",
"tokenizer.nextToken",
"tokenizer",
"\"\\n\"",
"public 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 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",
"public class Main {\n\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }\n public 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 }\n return false;\n }\n\n\n static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (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 public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"public class Main {\n\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(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[] T = new int[q];\n for(int i=0; i<q; i++) T[i] = sc.nextInt();\n int ans = 0;\n for(int key:T){\n if(binarySearch(S, key)) ans++;\n }\n System.out.println(ans);\n\n }\n public 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 }\n return false;\n }\n\n\n static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (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 public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(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 ans = 0;
for(int key:T){
if(binarySearch(S, key)) ans++;
}
System.out.println(ans);
}
public 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 class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
|
[
7,
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,
4,
13,
13,
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
],
[
141,
5
],
[
141,
6
],
[
6,
7
],
[
141,
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,
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
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
10,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
8,
82
],
[
82,
83
],
[
141,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
86,
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
],
[
116,
117
],
[
101,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
118,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
86,
136
],
[
136,
137
],
[
84,
138
],
[
138,
139
],
[
0,
140
],
[
140,
141
],
[
140,
142
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n static int[] s;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int[] s;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"Main",
"static int[] s;",
"s",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\n c++;\n }\n }\n System.out.println(c);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\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",
"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 if (binarySearchContains(t)) {\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 }",
"{\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\n c++;\n }\n }",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (binarySearchContains(t)) {\n c++;\n }",
"binarySearchContains(t)",
"binarySearchContains",
"t",
"{\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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[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 = s.length - 1;",
"r",
"s.length - 1",
"s.length",
"s",
"s.length",
"1",
"while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[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 (s[m] == v) {\n return true;\n }\n if (s[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 (s[m] == v) {\n return true;\n }",
"s[m] == v",
"s[m]",
"s",
"m",
"v",
"{\n return true;\n }",
"return true;",
"true",
"if (s[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }",
"s[m] > v",
"s[m]",
"s",
"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[] s;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[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[] s;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int 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 c = 0;\n for (int i = 0; i < q; i++) {\n int t = sc.nextInt();\n if (binarySearchContains(t)) {\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 = s.length - 1; // right\n while (l <= r) {\n int m = (r + l) / 2;\n if (s[m] == v) {\n return true;\n }\n if (s[m] > v) {\n r = m - 1;\n } else {\n l = m + 1;\n }\n }\n return false;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int[] s;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
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();
if (binarySearchContains(t)) {
c++;
}
}
System.out.println(c);
}
public static boolean binarySearchContains(int v) {
int l = 0; // left
int r = s.length - 1; // right
while (l <= r) {
int m = (r + l) / 2;
if (s[m] == v) {
return true;
}
if (s[m] > v) {
r = m - 1;
} else {
l = m + 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,
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,
4,
18,
13,
13,
41,
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,
41,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
41,
13,
13,
41,
13,
17,
42,
2,
2,
13,
13,
17,
30,
0,
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,
13,
30,
0,
13,
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
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
173,
23
],
[
173,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
35,
36
],
[
36,
37
],
[
26,
38
],
[
38,
39
],
[
38,
40
],
[
26,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
44,
49
],
[
26,
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
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
26,
73
],
[
73,
74
],
[
74,
75
],
[
73,
76
],
[
26,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
26,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
87,
92
],
[
26,
93
],
[
93,
94
],
[
93,
95
],
[
26,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
96,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
108,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
120,
122
],
[
108,
123
],
[
123,
124
],
[
123,
125
],
[
108,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
132,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
150,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
150,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
26,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
24,
170
],
[
170,
171
],
[
0,
172
],
[
172,
173
],
[
172,
174
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\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",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\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",
"int s[] = new int[n];",
"s",
"new int[n]",
"n",
"String str[] = br.readLine().split(\" \");",
"str",
"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(str[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(str[i]);\n\t\t}",
"{\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}",
"s[i] = Integer.parseInt(str[i])",
"s[i]",
"s",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"Arrays.sort(s)",
"Arrays.sort",
"Arrays",
"s",
"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 ans = 0;",
"ans",
"0",
"for (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\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 t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int t = Integer.parseInt(str[i]);",
"t",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int left = 0;",
"left",
"0",
"int right = n;",
"right",
"n",
"int mid = 0;",
"mid",
"0",
"while (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}",
"right - left > 1",
"right - left",
"right",
"left",
"1",
"{\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}",
"mid = (right + left) / 2",
"mid",
"(right + left) / 2",
"(right + left)",
"right",
"left",
"2",
"if (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"t == s[mid]",
"t",
"s[mid]",
"s",
"mid",
"{\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"ans++",
"ans",
"break;",
"if (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"t > s[mid]",
"t",
"s[mid]",
"s",
"mid",
"{\n\t\t\t\t\tleft = mid;\n\t\t\t\t}",
"left = mid",
"left",
"mid",
"{\n\t\t\t\t\tright = mid;\n\t\t\t\t}",
"right = mid",
"right",
"mid",
"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) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tint s[] = new int[n];\n\n\t\tString str[] = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ts[i] = Integer.parseInt(str[i]);\n\t\t}\n\n\t\tArrays.sort(s);\n\n\t\tint q = Integer.parseInt(br.readLine());\n\n\t\tstr = br.readLine().split(\" \");\n\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint t = Integer.parseInt(str[i]);\n\n\t\t\tint left = 0;\n\t\t\tint right = n;\n\t\t\tint mid = 0;\n\n\t\t\twhile (right - left > 1) {\n\t\t\t\tmid = (right + left) / 2;\n\n\t\t\t\tif (t == s[mid]) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (t > s[mid]) {\n\t\t\t\t\tleft = mid;\n\t\t\t\t} else {\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\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.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
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 str[] = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
s[i] = Integer.parseInt(str[i]);
}
Arrays.sort(s);
int q = Integer.parseInt(br.readLine());
str = br.readLine().split(" ");
int ans = 0;
for (int i = 0; i < q; i++) {
int t = Integer.parseInt(str[i]);
int left = 0;
int right = n;
int mid = 0;
while (right - left > 1) {
mid = (right + left) / 2;
if (t == s[mid]) {
ans++;
break;
}
if (t > s[mid]) {
left = mid;
} else {
right = mid;
}
}
}
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,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
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,
13,
13,
41,
13,
38,
5,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
42,
2,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
18,
13,
13,
13,
30,
40,
13,
30,
4,
18,
13,
13,
9,
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
],
[
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
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
31,
36
],
[
14,
37
],
[
37,
38
],
[
37,
39
],
[
14,
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
],
[
53,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
59,
61
],
[
14,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
68,
69
],
[
14,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
72,
77
],
[
14,
78
],
[
78,
79
],
[
78,
80
],
[
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
],
[
95,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
14,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
14,
109
],
[
109,
110
],
[
14,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
116,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
130,
136
],
[
136,
137
],
[
136,
138
],
[
128,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
139,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
148,
153
],
[
14,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
12,
160
],
[
160,
161
]
] | [
"import java.io.*;\nimport java.util.Arrays;\nimport java.util.*;\n\nclass Main{\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tDeque<Integer> stack = new ArrayDeque<Integer>();\n\t\tString[] str = (br.readLine()).split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0 ; i<n ; i++ ) {\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] st = (br.readLine()).split(\" \");\n\t\tint[] num = new int[q];\n\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}\n\n\t\tArrays.sort(num);\n\n\t\tint a;\n\t\ttry{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NullPointerException e){\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tDeque<Integer> stack = new ArrayDeque<Integer>();\n\t\tString[] str = (br.readLine()).split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0 ; i<n ; i++ ) {\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] st = (br.readLine()).split(\" \");\n\t\tint[] num = new int[q];\n\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}\n\n\t\tArrays.sort(num);\n\n\t\tint a;\n\t\ttry{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NullPointerException e){\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tDeque<Integer> stack = new ArrayDeque<Integer>();\n\t\tString[] str = (br.readLine()).split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0 ; i<n ; i++ ) {\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] st = (br.readLine()).split(\" \");\n\t\tint[] num = new int[q];\n\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}\n\n\t\tArrays.sort(num);\n\n\t\tint a;\n\t\ttry{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NullPointerException e){\n\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tDeque<Integer> stack = new ArrayDeque<Integer>();\n\t\tString[] str = (br.readLine()).split(\" \");\n\t\tint count = 0;\n\t\tfor (int i = 0 ; i<n ; i++ ) {\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}\n\t\tint q = Integer.parseInt(br.readLine());\n\t\tString[] st = (br.readLine()).split(\" \");\n\t\tint[] num = new int[q];\n\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}\n\n\t\tArrays.sort(num);\n\n\t\tint a;\n\t\ttry{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NullPointerException e){\n\n\t\t}\n\n\t\tSystem.out.println(count);\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",
"Deque<Integer> stack = new ArrayDeque<Integer>();",
"stack",
"new ArrayDeque<Integer>()",
"String[] str = (br.readLine()).split(\" \");",
"str",
"(br.readLine()).split(\" \")",
"(br.readLine()).split",
"(br.readLine())",
"br.readLine",
"br",
"\" \"",
"int count = 0;",
"count",
"0",
"for (int i = 0 ; i<n ; i++ ) {\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}",
"{\n\t\t\tstack.addLast(Integer.parseInt(str[i]));\n\t\t}",
"stack.addLast(Integer.parseInt(str[i]))",
"stack.addLast",
"stack",
"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",
"String[] st = (br.readLine()).split(\" \");",
"st",
"(br.readLine()).split(\" \")",
"(br.readLine()).split",
"(br.readLine())",
"br.readLine",
"br",
"\" \"",
"int[] num = new int[q];",
"num",
"new int[q]",
"q",
"for (int i = 0; i<q ; i++ ) {\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}",
"{\n\t\t\tnum[i] = Integer.parseInt(st[i]);\n\t\t}",
"num[i] = Integer.parseInt(st[i])",
"num[i]",
"num",
"i",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"Arrays.sort(num)",
"Arrays.sort",
"Arrays",
"num",
"int a;",
"a",
"try{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NullPointerException e){\n\n\t\t}",
"catch (NullPointerException e){\n\n\t\t}",
"NullPointerException e",
"{\n\n\t\t}",
"{\n\n\t\t\tfor (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int i = 0; i<q ; i++ ) {\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\twhile((a = stack.pollFirst()) < num[i]);\n\t\t\t\tif (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}",
"while((a = stack.pollFirst()) < num[i]);",
"(a = stack.pollFirst()) < num[i]",
"(a = stack.pollFirst())",
"a",
"stack.pollFirst()",
"stack.pollFirst",
"stack",
"num[i]",
"num",
"i",
"if (num[i] == a) {\n\t\t\t\t\tcount++;\t\n\t\t\t\t}else{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"num[i] == a",
"num[i]",
"num",
"i",
"a",
"{\n\t\t\t\t\tcount++;\t\n\t\t\t\t}",
"count++",
"count",
"{\n\n\t\t\t\t\tstack.addFirst(a);\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"stack.addFirst(a)",
"stack.addFirst",
"stack",
"a",
"continue;",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.*;
import java.util.Arrays;
import java.util.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
Deque<Integer> stack = new ArrayDeque<Integer>();
String[] str = (br.readLine()).split(" ");
int count = 0;
for (int i = 0 ; i<n ; i++ ) {
stack.addLast(Integer.parseInt(str[i]));
}
int q = Integer.parseInt(br.readLine());
String[] st = (br.readLine()).split(" ");
int[] num = new int[q];
for (int i = 0; i<q ; i++ ) {
num[i] = Integer.parseInt(st[i]);
}
Arrays.sort(num);
int a;
try{
for (int i = 0; i<q ; i++ ) {
while((a = stack.pollFirst()) < num[i]);
if (num[i] == a) {
count++;
}else{
stack.addFirst(a);
continue;
}
}
}catch (NullPointerException e){
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
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,
4,
18,
13,
4,
18,
13,
41,
13,
20,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
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
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
36,
37
],
[
37,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
8,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
8,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
8,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
76,
77
],
[
6,
78
],
[
78,
79
]
] | [
"import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n Set<String> S = new HashSet<>();\n int n = sc.nextInt();\n for (int i=0; i<n; i++) {\n S.add(sc.next());\n }\n\n Set<String> T = new HashSet<>();\n int q = sc.nextInt();\n for (int i=0; i<q; i++) {\n T.add(sc.next());\n }\n\n S.retainAll(T);\n System.out.println(S.size());\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n Set<String> S = new HashSet<>();\n int n = sc.nextInt();\n for (int i=0; i<n; i++) {\n S.add(sc.next());\n }\n\n Set<String> T = new HashSet<>();\n int q = sc.nextInt();\n for (int i=0; i<q; i++) {\n T.add(sc.next());\n }\n\n S.retainAll(T);\n System.out.println(S.size());\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n Set<String> S = new HashSet<>();\n int n = sc.nextInt();\n for (int i=0; i<n; i++) {\n S.add(sc.next());\n }\n\n Set<String> T = new HashSet<>();\n int q = sc.nextInt();\n for (int i=0; i<q; i++) {\n T.add(sc.next());\n }\n\n S.retainAll(T);\n System.out.println(S.size());\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n Set<String> S = new HashSet<>();\n int n = sc.nextInt();\n for (int i=0; i<n; i++) {\n S.add(sc.next());\n }\n\n Set<String> T = new HashSet<>();\n int q = sc.nextInt();\n for (int i=0; i<q; i++) {\n T.add(sc.next());\n }\n\n S.retainAll(T);\n System.out.println(S.size());\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"Set<String> S = new HashSet<>();",
"S",
"new HashSet<>()",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i=0; i<n; i++) {\n S.add(sc.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n S.add(sc.next());\n }",
"{\n S.add(sc.next());\n }",
"S.add(sc.next())",
"S.add",
"S",
"sc.next()",
"sc.next",
"sc",
"Set<String> T = new HashSet<>();",
"T",
"new HashSet<>()",
"int q = sc.nextInt();",
"q",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i=0; i<q; i++) {\n T.add(sc.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<q",
"i",
"q",
"i++",
"i++",
"i",
"{\n T.add(sc.next());\n }",
"{\n T.add(sc.next());\n }",
"T.add(sc.next())",
"T.add",
"T",
"sc.next()",
"sc.next",
"sc",
"S.retainAll(T)",
"S.retainAll",
"S",
"T",
"System.out.println(S.size())",
"System.out.println",
"System.out",
"System",
"System.out",
"S.size()",
"S.size",
"S",
"String[] args",
"args"
] | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Set<String> S = new HashSet<>();
int n = sc.nextInt();
for (int i=0; i<n; i++) {
S.add(sc.next());
}
Set<String> T = new HashSet<>();
int q = sc.nextInt();
for (int i=0; i<q; i++) {
T.add(sc.next());
}
S.retainAll(T);
System.out.println(S.size());
}
}
|
[
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,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
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
],
[
193,
5
],
[
193,
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
],
[
18,
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
],
[
193,
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
],
[
193,
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
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
107,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
107,
148
],
[
148,
149
],
[
148,
150
],
[
107,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
157,
158
],
[
157,
159
],
[
152,
160
],
[
160,
161
],
[
161,
162
],
[
152,
163
],
[
164,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
164,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
107,
175
],
[
175,
176
],
[
176,
177
],
[
107,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
180,
183
],
[
107,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
184,
189
],
[
105,
190
],
[
190,
191
],
[
0,
192
],
[
192,
193
],
[
192,
194
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static Boolean BinarySearch(int[] Value, int input, int left, int right) {\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] Value, int[] Array) {\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\t\n\tpublic static Boolean BinarySearch(int[] Value, int input, int left, int right) {\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] Value, int[] Array) {\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}\n\n}",
"Main",
"public static Boolean BinarySearch(int[] Value, int input, int left, int right) {\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}",
"BinarySearch",
"{\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}",
"int middle = left + (right-left)/2;",
"middle",
"left + (right-left)/2",
"left",
"(right-left)/2",
"(right-left)",
"right",
"left",
"2",
"if (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}",
"right < left",
"right",
"left",
"{\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}",
"return false; // This means that the algorithm is not sorted",
"false",
"if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}",
"Value[middle] > input",
"Value[middle]",
"Value",
"middle",
"input",
"{\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}",
"return BinarySearch(Value,input,left,middle-1);",
"BinarySearch(Value,input,left,middle-1)",
"BinarySearch",
"Value",
"input",
"left",
"middle-1",
"middle",
"1",
"if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}",
"Value[middle] < input",
"Value[middle]",
"Value",
"middle",
"input",
"{\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}",
"return BinarySearch(Value,input,middle+1,right);",
"BinarySearch(Value,input,middle+1,right)",
"BinarySearch",
"Value",
"input",
"middle+1",
"middle",
"1",
"right",
"{ \n\t\t\treturn true;\n\t\t\t}",
"return true;",
"true",
"int[] Value",
"Value",
"int input",
"input",
"int left",
"left",
"int right",
"right",
"public static int contains(int[] Value, int[] Array) {\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}",
"contains",
"{\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}",
"int sum = 0;",
"sum",
"0",
"int left = 0;",
"left",
"0",
"int right = Value.length - 1;",
"right",
"Value.length - 1",
"Value.length",
"Value",
"Value.length",
"1",
"for (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"int elements",
"Array",
"{\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}",
"if (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}",
"BinarySearch(Value, elements, left, right)",
"BinarySearch",
"Value",
"elements",
"left",
"right",
"{ // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}",
"sum++",
"sum",
"return sum;",
"sum",
"int[] Value",
"Value",
"int[] Array",
"Array",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int array1 = in.nextInt();",
"array1",
"in.nextInt()",
"in.nextInt",
"in",
"int[] Value = new int[array1];",
"Value",
"new int[array1]",
"array1",
"for (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array1",
"i",
"array1",
"i++",
"i++",
"i",
"{\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}",
"{\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}",
"int number = in.nextInt();",
"number",
"in.nextInt()",
"in.nextInt",
"in",
"Value[i] = number",
"Value[i]",
"Value",
"i",
"number",
"int array2 = in.nextInt();",
"array2",
"in.nextInt()",
"in.nextInt",
"in",
"int[] Array = new int[array2];",
"Array",
"new int[array2]",
"array2",
"for (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array2",
"i",
"array2",
"i++",
"i++",
"i",
"{\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}",
"{\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}",
"int number = in.nextInt();",
"number",
"in.nextInt()",
"in.nextInt",
"in",
"Array[i] = number",
"Array[i]",
"Array",
"i",
"number",
"in.close()",
"in.close",
"in",
"int value = contains(Value,Array);",
"value",
"contains(Value,Array)",
"contains",
"Value",
"Array",
"System.out.println(value)",
"System.out.println",
"System.out",
"System",
"System.out",
"value",
"String[] args",
"args",
"public class Main {\n\t\n\tpublic static Boolean BinarySearch(int[] Value, int input, int left, int right) {\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] Value, int[] Array) {\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}\n\n}",
"public class Main {\n\t\n\tpublic static Boolean BinarySearch(int[] Value, int input, int left, int right) {\n\t\tint middle = left + (right-left)/2; // \n\t\tif (right < left) {\n\t\t\treturn false; // This means that the algorithm is not sorted\n\t\t\t}\n\t\telse if (Value[middle] > input) {\n\t\t\treturn BinarySearch(Value,input,left,middle-1); \n\t\t\t}\n\t\telse if (Value[middle] < input) {\n\t\t\treturn BinarySearch(Value,input,middle+1,right); \n\t\t\t}\n\t\telse { \n\t\t\treturn true;\n\t\t\t}\n\t}\n\t\n\tpublic static int contains(int[] Value, int[] Array) {\n\t\tint sum = 0;\n\t\tint left = 0;\n\t\tint right = Value.length - 1;\n\t\tfor (int elements : Array) {\n\t\t\tif (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S\n\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint array1 = in.nextInt();\n\t\tint[] Value = new int[array1];\n\t\tfor (int i = 0; i < array1; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tValue[i] = number;\n\t\t}\n\t\tint array2 = in.nextInt();\n\t\tint[] Array = new int[array2];\n\t\tfor (int i = 0; i < array2; i++) {\n\t\t\tint number = in.nextInt();\n\t\t\tArray[i] = number;\n\t\t}\n\t\tin.close();\n\t\tint value = contains(Value,Array);\n\t\tSystem.out.println(value);\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static Boolean BinarySearch(int[] Value, int input, int left, int right) {
int middle = left + (right-left)/2; //
if (right < left) {
return false; // This means that the algorithm is not sorted
}
else if (Value[middle] > input) {
return BinarySearch(Value,input,left,middle-1);
}
else if (Value[middle] < input) {
return BinarySearch(Value,input,middle+1,right);
}
else {
return true;
}
}
public static int contains(int[] Value, int[] Array) {
int sum = 0;
int left = 0;
int right = Value.length - 1;
for (int elements : Array) {
if (BinarySearch(Value, elements, left, right)) { // iterates through each value in T and searches for it in S
sum++;
}
}
return sum;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int array1 = in.nextInt();
int[] Value = new int[array1];
for (int i = 0; i < array1; i++) {
int number = in.nextInt();
Value[i] = number;
}
int array2 = in.nextInt();
int[] Array = new int[array2];
for (int i = 0; i < array2; i++) {
int number = in.nextInt();
Array[i] = number;
}
in.close();
int value = contains(Value,Array);
System.out.println(value);
}
}
|
[
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,
28,
13,
13,
30,
30,
14,
2,
4,
13,
13,
13,
17,
18,
13,
13,
40,
17,
40,
13,
4,
18,
18,
13,
13,
13,
4,
18,
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,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
30,
0,
13,
13,
29,
40,
17,
23,
13,
23,
13,
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
],
[
73,
75
],
[
73,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
80,
83
],
[
80,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
79,
88
],
[
88,
89
],
[
78,
90
],
[
90,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
8,
98
],
[
98,
99
],
[
99,
100
],
[
6,
101
],
[
101,
102
],
[
161,
103
],
[
103,
104
],
[
103,
105
],
[
105,
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
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
127,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
105,
149
],
[
149,
150
],
[
150,
151
],
[
103,
152
],
[
152,
153
],
[
103,
154
],
[
154,
155
],
[
103,
156
],
[
156,
157
],
[
103,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
] | [
"\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}\n\tstatic int binarySearch(int[]a,int n, int l, int r){\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\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 in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}\n\tstatic int binarySearch(int[]a,int n, int l, int r){\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"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\t\t\ta[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int m = in.nextInt();",
"m",
"in.nextInt()",
"in.nextInt",
"in",
"int[] b = new int[m];",
"b",
"new int[m]",
"m",
"for(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < m",
"i",
"m",
"i++",
"i++",
"i",
"{\n\t\t\tb[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tb[i] = in.nextInt();\n\t\t}",
"b[i] = in.nextInt()",
"b[i]",
"b",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int count = 0;",
"count",
"0",
"for(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}",
"int bb",
"b",
"{\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}",
"{\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}",
"if(binarySearch(a, bb, 0, a.length) != -1)count++;",
"binarySearch(a, bb, 0, a.length) != -1",
"binarySearch(a, bb, 0, a.length)",
"binarySearch",
"a",
"bb",
"0",
"a.length",
"a",
"a.length",
"-1",
"1",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"in.close()",
"in.close",
"in",
"String[] args",
"args",
"static int binarySearch(int[]a,int n, int l, int r){\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"binarySearch",
"{\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}",
"while(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}",
"l != r",
"l",
"r",
"{\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}",
"int mid = (l+r)/2;",
"mid",
"(l+r)/2",
"(l+r)",
"l",
"r",
"2",
"if(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}",
"a[mid] == n",
"a[mid]",
"a",
"mid",
"n",
"{\n\t\t\t\treturn mid;\n\t\t\t}",
"return mid;",
"mid",
"if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}",
"a[mid] < n",
"a[mid]",
"a",
"mid",
"n",
"{\n\t\t\t\tl = mid + 1;\n\t\t\t}",
"l = mid + 1",
"l",
"mid + 1",
"mid",
"1",
"if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}",
"a[mid] > n",
"a[mid]",
"a",
"mid",
"n",
"{\n\t\t\t\tr = mid;\n\t\t\t}",
"r = mid",
"r",
"mid",
"return -1;",
"-1",
"1",
"int[]a",
"a",
"int n",
"n",
"int l",
"l",
"int r",
"r",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}\n\tstatic int binarySearch(int[]a,int n, int l, int r){\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint[] b = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tfor(int bb : b){\n\t\t\tif(binarySearch(a, bb, 0, a.length) != -1)count++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}\n\tstatic int binarySearch(int[]a,int n, int l, int r){\n\t\twhile(l != r){\n\t\t\tint mid = (l+r)/2;\n\t\t\tif(a[mid] == n){\n\t\t\t\treturn mid;\n\t\t\t}else if(a[mid] < n){\n\t\t\t\tl = mid + 1;\n\t\t\t}else if(a[mid] > n){\n\t\t\t\tr = mid;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++){
a[i] = in.nextInt();
}
int m = in.nextInt();
int[] b = new int[m];
for(int i = 0; i < m; i++){
b[i] = in.nextInt();
}
int count = 0;
for(int bb : b){
if(binarySearch(a, bb, 0, a.length) != -1)count++;
}
System.out.println(count);
in.close();
}
static int binarySearch(int[]a,int n, int l, int r){
while(l != r){
int mid = (l+r)/2;
if(a[mid] == n){
return mid;
}else if(a[mid] < n){
l = mid + 1;
}else if(a[mid] > n){
r = mid;
}
}
return -1;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
42,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
3,
41,
13,
17,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
13,
2,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
18,
13,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
2,
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
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
16,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
16,
27
],
[
27,
28
],
[
27,
29
],
[
16,
30
],
[
30,
31
],
[
30,
32
],
[
16,
33
],
[
33,
34
],
[
33,
35
],
[
16,
36
],
[
36,
37
],
[
16,
38
],
[
38,
39
],
[
38,
40
],
[
16,
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
],
[
16,
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
],
[
77,
79
],
[
16,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
16,
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
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
100,
108
],
[
16,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
6,
120
],
[
120,
121
]
] | [
"import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String args[]){\t\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n;\n\t\twhile(true){\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}\n\t}\n\t\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String args[]){\t\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n;\n\t\twhile(true){\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}\n\t}\n\t\n}",
"Main",
"public static void main(String args[]){\t\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n;\n\t\twhile(true){\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}\n\t}",
"main",
"{\t\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n;\n\t\twhile(true){\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n;",
"n",
"while(true){\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}",
"true",
"{\n\t\t\tn = scan.nextInt();\n\t\t\tif(n == 0)break;\n\t\t\tdouble sum = 0;\n\t\t\tdouble ave = 0;\n\t\t\tdouble var = 0;\n\t\t\n\t\t\tint a[];\n\t\t\ta = new int[n];\n\t\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\n\t\t\tave = sum / n;\n\t\t\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}\n\t\t\n\t\t\tSystem.out.println(Math.sqrt(var/n));\n\t\t}",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(n == 0)break;",
"n == 0",
"n",
"0",
"break;",
"double sum = 0;",
"sum",
"0",
"double ave = 0;",
"ave",
"0",
"double var = 0;",
"var",
"0",
"int a[];",
"a",
"a = new int[n]",
"a",
"new int[n]",
"n",
"for(int i = 0;i < n;i++){\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}",
"{\n\t\t\t\ta[i] = scan.nextInt();\n\t\t\t}",
"a[i] = scan.nextInt()",
"a[i]",
"a",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i = 0; i < n; i++){\n\t\t\t\tsum += a[i];\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tsum += a[i];\n\t\t\t}",
"{\n\t\t\t\tsum += a[i];\n\t\t\t}",
"sum += a[i]",
"sum",
"a[i]",
"a",
"i",
"ave = sum / n",
"ave",
"sum / n",
"sum",
"n",
"for(int i = 0; i < n; i++){\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}",
"{\n\t\t\t\tvar += Math.pow((a[i] - ave),2);\n\t\t\t}",
"var += Math.pow((a[i] - ave),2)",
"var",
"Math.pow((a[i] - ave),2)",
"Math.pow",
"Math",
"(a[i] - ave)",
"a[i]",
"a",
"i",
"ave",
"2",
"System.out.println(Math.sqrt(var/n))",
"System.out.println",
"System.out",
"System",
"System.out",
"Math.sqrt(var/n)",
"Math.sqrt",
"Math",
"var/n",
"var",
"n",
"String args[]",
"args"
] | import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int n;
while(true){
n = scan.nextInt();
if(n == 0)break;
double sum = 0;
double ave = 0;
double var = 0;
int a[];
a = new int[n];
for(int i = 0;i < n;i++){
a[i] = scan.nextInt();
}
for(int i = 0; i < n; i++){
sum += a[i];
}
ave = sum / n;
for(int i = 0; i < n; i++){
var += Math.pow((a[i] - ave),2);
}
System.out.println(Math.sqrt(var/n));
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
42,
2,
13,
17,
30,
41,
13,
20,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
18,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
2,
13,
13,
41,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
17,
13,
0,
13,
4,
18,
13,
4,
18,
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
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
21,
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
],
[
43,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
21,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
21,
61
],
[
61,
62
],
[
61,
63
],
[
21,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
79,
87
],
[
21,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
21,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
21,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
99,
105
],
[
21,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
8,
111
],
[
111,
112
],
[
112,
113
],
[
6,
114
],
[
114,
115
],
[
0,
116
],
[
116,
117
],
[
116,
118
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }\n\n}",
"Main",
"public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }",
"main",
"{\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }",
"Scanner scn = new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int n = scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }",
"n!=0",
"n",
"0",
"{\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }",
"double[] a = new double[n];",
"a",
"new double[n]",
"n",
"double sum =0",
"sum",
"0",
"ave;",
"ave",
"for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=scn.nextDouble();\n sum +=a[i];\n }",
"{\n a[i]=scn.nextDouble();\n sum +=a[i];\n }",
"a[i]=scn.nextDouble()",
"a[i]",
"a",
"i",
"scn.nextDouble()",
"scn.nextDouble",
"scn",
"sum +=a[i]",
"sum",
"a[i]",
"a",
"i",
"ave = sum/n",
"ave",
"sum/n",
"sum",
"n",
"sum=0",
"sum",
"0",
"for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n sum +=Math.pow(a[i]-ave,2);\n }",
"{\n sum +=Math.pow(a[i]-ave,2);\n }",
"sum +=Math.pow(a[i]-ave,2)",
"sum",
"Math.pow(a[i]-ave,2)",
"Math.pow",
"Math",
"a[i]-ave",
"a[i]",
"a",
"i",
"ave",
"2",
"ave = sum/n",
"ave",
"sum/n",
"sum",
"n",
"double sd = Math.sqrt(ave);",
"sd",
"Math.sqrt(ave)",
"Math.sqrt",
"Math",
"ave",
"System.out.printf(\"%.8f%n\",sd)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%.8f%n\"",
"sd",
"n=scn.nextInt()",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"scn.close()",
"scn.close",
"scn",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }\n\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n\n while(n!=0){\n double[] a = new double[n];\n double sum =0, ave;\n for(int i=0;i<n;i++){\n a[i]=scn.nextDouble();\n sum +=a[i];\n }\n ave = sum/n;\n sum=0;\n for(int i=0;i<n;i++){\n sum +=Math.pow(a[i]-ave,2);\n }\n ave = sum/n;\n double sd = Math.sqrt(ave);\n System.out.printf(\"%.8f%n\",sd);\n n=scn.nextInt();\n\n }\n\n scn.close();\n\n }\n\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
while(n!=0){
double[] a = new double[n];
double sum =0, ave;
for(int i=0;i<n;i++){
a[i]=scn.nextDouble();
sum +=a[i];
}
ave = sum/n;
sum=0;
for(int i=0;i<n;i++){
sum +=Math.pow(a[i]-ave,2);
}
ave = sum/n;
double sd = Math.sqrt(ave);
System.out.printf("%.8f%n",sd);
n=scn.nextInt();
}
scn.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
42,
17,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
3,
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,
0,
13,
2,
13,
18,
13,
13,
41,
13,
2,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
13,
2,
2,
18,
13,
13,
13,
2,
18,
13,
13,
13,
0,
13,
2,
13,
13,
41,
13,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
119,
5
],
[
119,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
14,
25
],
[
25,
26
],
[
25,
27
],
[
14,
29
],
[
29,
30
],
[
29,
31
],
[
14,
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
],
[
44,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
14,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
14,
64
],
[
64,
65
],
[
64,
66
],
[
14,
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
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
14,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
14,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
102,
106
],
[
14,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
8,
113
],
[
113,
114
],
[
114,
115
],
[
6,
116
],
[
116,
117
],
[
0,
118
],
[
118,
119
],
[
118,
120
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }\n}",
"Main",
"public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }",
"true",
"{\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(n==0) break;",
"n==0",
"n",
"0",
"break;",
"int s[] = new int[n];",
"s",
"new int[n]",
"n",
"int sum = 0;",
"sum",
"0",
"for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }",
"{\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }",
"s[i] = sc.nextInt()",
"s[i]",
"s",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sum = sum+s[i]",
"sum",
"sum+s[i]",
"sum",
"s[i]",
"s",
"i",
"double ave = (double)sum/n;",
"ave",
"(double)sum/n",
"(double)sum",
"n",
"double a2 = 0;",
"a2",
"0",
"for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }",
"{\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }",
"a2 = a2+(s[i]-ave)*(s[i]-ave)",
"a2",
"a2+(s[i]-ave)*(s[i]-ave)",
"a2",
"(s[i]-ave)*(s[i]-ave)",
"(s[i]-ave)",
"s[i]",
"s",
"i",
"ave",
"(s[i]-ave)",
"s[i]",
"s",
"i",
"ave",
"a2 = a2/n",
"a2",
"a2/n",
"a2",
"n",
"double a = Math.pow(a2, 0.5);",
"a",
"Math.pow(a2, 0.5)",
"Math.pow",
"Math",
"a2",
"0.5",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"sc.close()",
"sc.close",
"sc",
"String[] arg",
"arg",
"public class Main{\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }\n}",
"public class Main{\n public static void main(String[] arg){\n Scanner sc = new Scanner(System.in);\n while(true){\n int n = sc.nextInt();\n if(n==0) break;\n int s[] = new int[n];\n int sum = 0;\n for(int i=0;i<n;i++){\n s[i] = sc.nextInt();\n sum = sum+s[i];\n }\n double ave = (double)sum/n;\n double a2 = 0;\n for(int i=0;i<n;i++){\n a2 = a2+(s[i]-ave)*(s[i]-ave);\n }\n a2 = a2/n;\n double a = Math.pow(a2, 0.5);\n System.out.println(a);\n }\n sc.close();\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0) break;
int s[] = new int[n];
int sum = 0;
for(int i=0;i<n;i++){
s[i] = sc.nextInt();
sum = sum+s[i];
}
double ave = (double)sum/n;
double a2 = 0;
for(int i=0;i<n;i++){
a2 = a2+(s[i]-ave)*(s[i]-ave);
}
a2 = a2/n;
double a = Math.pow(a2, 0.5);
System.out.println(a);
}
sc.close();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.